class Gsk::GLShaderNode

Overview

A render node using a GL shader when drawing its children nodes.

Defined in:

lib/gi-crystal/src/auto/gsk-4.0/gl_shader_node.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Gsk::RenderNode

bounds : Graphene::Rect bounds, draw(cr : Cairo::Context) : Nil draw, finalize finalize, node_type : Gsk::RenderNodeType node_type, serialize : GLib::Bytes serialize, to_unsafe : Pointer(Void) to_unsafe, write_to_file(filename : String) : Bool write_to_file

Class methods inherited from class Gsk::RenderNode

deserialize(bytes : GLib::Bytes, error_func : Gsk::ParseErrorFunc?, user_data : Pointer(Void)?) : Gsk::RenderNode? deserialize, g_type : UInt64 g_type

Constructor Detail

def self.new(shader : Gsk::GLShader, bounds : Graphene::Rect, args : GLib::Bytes, children : Enumerable(Gsk::RenderNode)?) : self #

Creates a Gsk::RenderNode that will render the given @shader into the area given by @bounds.

The @args is a block of data to use for uniform input, as per types and offsets defined by the @shader. Normally this is generated by Gsk::GLShader#format_args or Gsk::ShaderArgsBuilder.

See Gsk::GLShader for details about how the shader should be written.

All the children will be rendered into textures (if they aren't already Gsk::TextureNodes, which will be used directly). These textures will be sent as input to the shader.

If the renderer doesn't support GL shaders, or if there is any problem when compiling the shader, then the node will draw pink. You should use Gsk::GLShader#compile to ensure the @shader will work for the renderer before using it.


def self.new #

Initialize a new GLShaderNode.


Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


Instance Method Detail

def args : GLib::Bytes #

Gets args for the node.


def child(idx : UInt32) : Gsk::RenderNode #

Gets one of the children.


def n_children : UInt32 #

Returns the number of children


def shader : Gsk::GLShader #

Gets shader code for the node.