Class (GI Class)

Cogl-18CoglPipeline

Functions for creating and manipulating the GPU pipeline

Cogl allows creating and manipulating objects representing the full configuration of the GPU pipeline. In simplified terms the GPU pipeline takes primitive geometry as the input, it first performs vertex processing, allowing you to deform your geometry, then rasterizes that (turning it from pure geometry into fragments) then performs fragment processing including depth testing and texture mapping. Finally it blends the result with the framebuffer.

Hierarchy (View Summary)

Index

Constructors

Properties

Methods

Methods - Inherited from GObject

Constructors

Properties

Compile-time signal type information.

This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.

Methods

  • Adds a shader snippet that will hook on to the given layer of the pipeline. The exact part of the pipeline that the snippet wraps around depends on the hook that is given to cogl_snippet_new(). Note that some hooks can't be used with a layer and need to be added with cogl_pipeline_add_snippet() instead.

    Parameters

    Returns void

  • Adds a shader snippet to pipeline. The snippet will wrap around or replace some part of the pipeline as defined by the hook point in snippet. Note that some hook points are specific to a layer and must be added with cogl_pipeline_add_layer_snippet() instead.

    Parameters

    Returns void

  • Creates a new pipeline with the configuration copied from the source pipeline.

    We would strongly advise developers to always aim to use cogl_pipeline_copy() instead of cogl_pipeline_new() whenever there will be any similarity between two pipelines. Copying a pipeline helps Cogl keep track of a pipelines ancestry which we may use to help minimize GPU state changes.

    Returns Cogl.Pipeline

    a pointer to the newly allocated Cogl.Pipeline

  • Returns number

    The alpha test reference value of pipeline.

  • Gets whether point sprite coordinate generation is enabled for this texture layer.

    Parameters

    • layer_index: number

      the layer number to check.

    Returns boolean

    whether the texture coordinates will be replaced with point sprite coordinates.

  • Parameters

    • layer_index: number

      the index of the layer

    Returns Cogl.Texture

    the texture that was set for the given layer of the pipeline or null if no texture was set.

  • Returns the wrap mode for the 's' coordinate of texture lookups on this layer.

    Parameters

    • layer_index: number

      the layer number to change.

    Returns PipelineWrapMode

    the wrap mode for the 's' coordinate of texture lookups on this layer.

  • Returns the wrap mode for the 't' coordinate of texture lookups on this layer.

    Parameters

    • layer_index: number

      the layer number to change.

    Returns PipelineWrapMode

    the wrap mode for the 't' coordinate of texture lookups on this layer.

  • Retrieves the number of layers defined for the given pipeline

    Returns number

    the number of layers

  • Returns boolean

    true if the pipeline has per-vertex point size enabled or false otherwise. The per-vertex point size can be enabled with cogl_pipeline_set_per_vertex_point_size().

  • This is used to get an integer representing the uniform with the name uniform_name. The integer can be passed to functions such as cogl_pipeline_set_uniform_1f() to set the value of a uniform.

    This function will always return a valid integer. Ie, unlike OpenGL, it does not return -1 if the uniform is not available in this pipeline so it can not be used to test whether uniforms are present. It is not necessary to set the program on the pipeline before calling this function.

    Parameters

    • uniform_name: string

      The name of a uniform

    Returns number

    A integer representing the location of the given uniform.

  • Parameters

    • domain: number
    • capability: number

    Returns boolean

  • This function removes a layer from your pipeline

    Parameters

    • layer_index: number

      Specifies the layer you want to remove

    Returns void

  • Before a primitive is blended with the framebuffer, it goes through an alpha test stage which lets you discard fragments based on the current alpha value. This function lets you change the function used to evaluate the alpha channel, and thus determine which fragments are discarded and which continue on to the blending stage.

    The default is Cogl.PipelineAlphaFunc.ALWAYS

    Parameters

    • alpha_func: PipelineAlphaFunc

      A CoglPipelineAlphaFunc constant

    • alpha_reference: number

      A reference point that the chosen alpha function uses to compare incoming fragments to.

    Returns void

  • Blending occurs after the alpha test function, and combines fragments with the framebuffer.

    Currently the only blend function Cogl exposes is ADD(). So any valid blend statements will be of the form:

      <channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))
    

    This is the list of source-names usable as blend factors:

    • SRC_COLOR: The color of the incoming fragment
    • DST_COLOR: The color of the framebuffer
    • CONSTANT: The constant set via cogl_pipeline_set_blend_constant()

    These can also be used as factors:

    • 0: (0, 0, 0, 0)
    • 1: (1, 1, 1, 1)
    • SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])

    Remember; all color components are normalized to the range [0, 1] before computing the result of blending.

    • Blend Strings/1: Blend a non-premultiplied source over a destination with premultiplied alpha:
      
      

    "RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))" "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"


    Blend Strings/2:
    Blend a premultiplied source over a destination with
    premultiplied alpha

    "RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"


    The default blend string is:

    RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))


    That gives normal alpha-blending when the calculated color for the pipeline
    is in premultiplied form

    Parameters

    • blend_string: string

      A Cogl blend string describing the desired blend function.

    Returns boolean

    true if the blend string was successfully parsed, and the described blending is supported by the underlying driver/hardware. If there was an error, false is returned and error is set accordingly (if present).

  • When blending is setup to reference a CONSTANT blend factor then blending will depend on the constant set with this function.

    Parameters

    • constant_color: Cogl.Color

      The constant color you want

    Returns void

  • Sets the basic color of the pipeline, used when no lighting is enabled.

    Note that if you don't add any layers to the pipeline then the color will be blended unmodified with the destination; the default blend expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for semi-transparent red. See cogl_color_premultiply().

    The default value is (1.0, 1.0, 1.0, 1.0)

    Parameters

    • color: Cogl.Color

      The components of the color

    Returns void

  • Sets which faces will be culled when drawing. Face culling can be used to increase efficiency by avoiding drawing faces that would get overridden. For example, if a model has gaps so that it is impossible to see the inside then faces which are facing away from the screen will never be seen so there is no point in drawing them. This can be achieved by setting the cull face mode to Cogl.PipelineCullFaceMode.BACK.

    Face culling relies on the primitives being drawn with a specific order to represent which faces are facing inside and outside the model. This order can be specified by calling cogl_pipeline_set_front_face_winding().

    Parameters

    Returns void

  • This commits all the depth state configured in state struct to the given pipeline. The configuration values are copied into the pipeline so there is no requirement to keep the Cogl.DepthState struct around if you don't need it any more.

    Note: Since some platforms do not support the depth range feature it is possible for this function to fail and report an error.

    Parameters

    Returns boolean

    true if the GPU supports all the given state else false and returns an error.

  • These are all the functions available for texture combining:

    • REPLACE(arg0) = arg0
    • MODULATE(arg0, arg1) = arg0 x arg1
    • ADD(arg0, arg1) = arg0 + arg1
    • ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5
    • INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)
    • SUBTRACT(arg0, arg1) = arg0 - arg1
     DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
    (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
    (arg0[B] - 0.5)) * (arg1[B] - 0.5))
     DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
    (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
    (arg0[B] - 0.5)) * (arg1[B] - 0.5))

    The valid source names for texture combining are:

    • TEXTURE: Use the color from the current texture layer
    • TEXTURE_0, TEXTURE_1, etc: Use the color from the specified texture layer
    • CONSTANT: Use the color from the constant given with Cogl.Pipeline.set_layer_combine_constant
    • PRIMARY: Use the color of the pipeline as set with Cogl.Pipeline.set_color
    • PREVIOUS: Either use the texture color from the previous layer, or if this is layer 0, use the color of the pipeline as set with Cogl.Pipeline.set_color

    Layer Combine Examples:

    This is effectively what the default blending is:

    RGBA = MODULATE (PREVIOUS, TEXTURE)
    

    This could be used to cross-fade between two images, using the alpha component of a constant as the interpolator. The constant color is given by calling Cogl.Pipeline.set_layer_combine_constant.

    RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A])
    

    You can't give a multiplication factor for arguments as you can with blending.

    Parameters

    • layer_index: number

      Specifies the layer you want define a combine function for

    • blend_string: string

      A Cogl blend string describing the desired texture combine function.

    Returns boolean

    true if the blend string was successfully parsed, and the described texture combining is supported by the underlying driver and or hardware. On failure, false is returned and error is set

  • When you are using the 'CONSTANT' color source in a layer combine description then you can use this function to define its value.

    Parameters

    • layer_index: number

      Specifies the layer you want to specify a constant used for texture combining

    • constant: Cogl.Color

      The constant color you want

    Returns void

  • Changes the decimation and interpolation filters used when a texture is drawn at other scales than 100%.

    It is an error to pass anything other than Cogl.PipelineFilter.NEAREST or Cogl.PipelineFilter.LINEAR as magnification filters since magnification doesn't ever need to reference values stored in the mipmap chain.

    Parameters

    • layer_index: number

      the layer number to change.

    • min_filter: PipelineFilter

      the filter used when scaling a texture down.

    • mag_filter: PipelineFilter

      the filter used when magnifying a texture.

    Returns void

  • This function lets you set a matrix that can be used to e.g. translate and rotate a single layer of a pipeline used to fill your geometry.

    Parameters

    • layer_index: number

      the index for the layer inside pipeline

    • matrix: Graphene.Matrix

      the transformation matrix for the layer

    Returns void

  • Parameters

    • layer: number
    • max_level: number

    Returns void

  • Sets the texture for this layer to be the default texture for the given type. The default texture is a 1x1 pixel white texture.

    This function is mostly useful if you want to create a base pipeline that you want to create multiple copies from using cogl_pipeline_copy(). In that case this function can be used to specify the texture type so that any pipeline copies can share the internal texture type state for efficiency.

    Parameters

    • layer_index: number

      The layer number to modify

    Returns void

  • When rendering points, if enable is true then the texture coordinates for this layer will be replaced with coordinates that vary from 0.0 to 1.0 across the primitive. The top left of the point will have the coordinates 0.0,0.0 and the bottom right will have 1.0,1.0. If enable is false then the coordinates will be fixed for the entire point.

    Parameters

    • layer_index: number

      the layer number to change.

    • enable: boolean

      whether to enable point sprite coord generation.

    Returns boolean

    true if the function succeeds, false otherwise.

  • Sets the wrap mode for all three coordinates of texture lookups on this layer. This is equivalent to calling cogl_pipeline_set_layer_wrap_mode_s() and cogl_pipeline_set_layer_wrap_mode_t() separately.

    Parameters

    • layer_index: number

      the layer number to change.

    • mode: PipelineWrapMode

      the new wrap mode

    Returns void

  • Sets the wrap mode for the 's' coordinate of texture lookups on this layer.

    Parameters

    • layer_index: number

      the layer number to change.

    • mode: PipelineWrapMode

      the new wrap mode

    Returns void

  • Sets the wrap mode for the 't' coordinate of texture lookups on this layer.

    Parameters

    • layer_index: number

      the layer number to change.

    • mode: PipelineWrapMode

      the new wrap mode

    Returns void

  • Sets whether to use a per-vertex point size or to use the value set by cogl_pipeline_set_point_size(). If per-vertex point size is enabled then the point size can be set for an individual point either by drawing with a Cogl.Attribute with the name ‘cogl_point_size_in’ or by writing to the GLSL builtin ‘cogl_point_size_out’ from a vertex shader snippet.

    If per-vertex point size is enabled and this attribute is not used and cogl_point_size_out is not written to then the results are undefined.

    Parameters

    • enable: boolean

      whether to enable per-vertex point size

    Returns boolean

    true if the change succeeded or false otherwise

  • Changes the size of points drawn when Cogl.VerticesMode.POINTS is used with the attribute buffer API. Note that typically the GPU will only support a limited minimum and maximum range of point sizes. If the chosen point size is outside that range then the nearest value within that range will be used instead. The size of a point is in screen space so it will be the same regardless of any transformations.

    If the point size is set to 0.0 then drawing points with the pipeline will have undefined results. This is the default value so if an application wants to draw points it must make sure to use a pipeline that has an explicit point size set on it.

    Parameters

    • point_size: number

      the new point size.

    Returns void

  • Set a pipeline name. It may be used for debugging or logging purposes. The string must be a static string, and string. It will not be copied.

    Parameters

    • name: string

      A descriptive name

    Returns void

  • Sets a new value for the uniform at uniform_location. If this pipeline has a user program attached and is later used as a source for drawing, the given value will be assigned to the uniform which can be accessed from the shader's source. The value for uniform_location should be retrieved from the string name of the uniform by calling cogl_pipeline_get_uniform_location().

    This function should be used to set uniforms that are of type float. It can also be used to set a single member of a float array uniform.

    Parameters

    • uniform_location: number

      The uniform's location identifier

    • value: number

      The new value for the uniform

    Returns void

  • Sets a new value for the uniform at uniform_location. If this pipeline has a user program attached and is later used as a source for drawing, the given value will be assigned to the uniform which can be accessed from the shader's source. The value for uniform_location should be retrieved from the string name of the uniform by calling cogl_pipeline_get_uniform_location().

    This function should be used to set uniforms that are of type int. It can also be used to set a single member of a int array uniform or a sampler uniform.

    Parameters

    • uniform_location: number

      The uniform's location identifier

    • value: number

      The new value for the uniform

    Returns void

  • Sets new values for the uniform at uniform_location. If this pipeline has a user program attached and is later used as a source for drawing, the given values will be assigned to the uniform which can be accessed from the shader's source. The value for uniform_location should be retrieved from the string name of the uniform by calling cogl_pipeline_get_uniform_location().

    This function can be used to set any floating point type uniform, including float arrays and float vectors. For example, to set a single vec4 uniform you would use 4 for n_components and 1 for count. To set an array of 8 float values, you could use 1 for n_components and 8 for count.

    Parameters

    • uniform_location: number

      The uniform's location identifier

    • n_components: number

      The number of components in the corresponding uniform's type

    • count: number

      The number of values to set

    • value: number[]

      The array of float to set uniform

    Returns void

  • Sets new values for the uniform at uniform_location. If this pipeline has a user program attached and is later used as a source for drawing, the given values will be assigned to the uniform which can be accessed from the shader's source. The value for uniform_location should be retrieved from the string name of the uniform by calling cogl_pipeline_get_uniform_location().

    This function can be used to set any integer type uniform, including int arrays and int vectors. For example, to set a single ivec4 uniform you would use 4 for n_components and 1 for count. To set an array of 8 int values, you could use 1 for n_components and 8 for count.

    Parameters

    • uniform_location: number

      The uniform's location identifier

    • n_components: number

      The number of components in the corresponding uniform's type

    • count: number

      The number of values to set

    • value: number[]

      The array of int to set uniform

    Returns void

  • Sets new values for the uniform at uniform_location. If this pipeline has a user program attached and is later used as a source for drawing, the given values will be assigned to the uniform which can be accessed from the shader's source. The value for uniform_location should be retrieved from the string name of the uniform by calling cogl_pipeline_get_uniform_location().

    This function can be used to set any matrix type uniform, including matrix arrays. For example, to set a single mat4 uniform you would use 4 for dimensions and 1 for count. To set an array of 8 mat3 values, you could use 3 for dimensions and 8 for count.

    If transpose is false then the matrix is expected to be in column-major order or if it is true then the matrix is in row-major order. You can pass a Graphene.Matrix by calling by passing the result of graphene_matrix_to_float() in value and setting transpose to false.

    Parameters

    • uniform_location: number

      The uniform's location identifier

    • dimensions: number

      The size of the matrix

    • count: number

      The number of values to set

    • transpose: boolean

      Whether to transpose the matrix

    • value: number[]

      The array of float to set uniform

    Returns void

  • Associates a linked CoglProgram with the given pipeline so that the program can take full control of vertex and/or fragment processing.

    This is an example of how it can be used to associate an ARBfp program with a Cogl.Pipeline:

    CoglShader *shader;
    CoglProgram *program;
    CoglPipeline *pipeline;

    shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT);
    cogl_shader_source (shader,
    "!!ARBfp1.0\n"
    "MOV result.color,fragment.color;\n"
    "END\n");

    program = cogl_program_new ();
    cogl_program_attach_shader (program, shader);
    cogl_program_link (program);

    pipeline = cogl_pipeline_new ();
    cogl_pipeline_set_user_program (pipeline, program);

    cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
    cogl_rectangle (0, 0, 100, 100);

    It is possibly worth keeping in mind that this API is not part of the long term design for how we want to expose shaders to Cogl developers (We are planning on deprecating the cogl_program and cogl_shader APIs in favour of a "snippet" framework) but in the meantime we hope this will handle most practical GLSL and ARBfp requirements.

    Parameters

    Returns void

Methods - Inherited from GObject

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned GObject.Binding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A GObject.Object can have multiple bindings.

    Parameters

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.

    Parameters

    • id: number

      Handler ID of the handler to be disconnected

    Returns void

  • This function is intended for GObject.Object implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one GObject.Object::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • key: string

      name of the key for that association

    Returns any

    the data if found, or null if no such data exists.

  • Gets a property of an object.

    The value can be:

    • an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a GObject.Value initialized with the expected type of the property
    • a GObject.Value initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.

    Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.

    Parameters

    • property_name: string

      The name of the property to get

    • value: any

      Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type

    Returns any

  • This function gets back user data pointers stored via g_object_set_qdata().

    Parameters

    • quark: number

      A GLib.Quark, naming the user data pointer

    Returns any

    The user data pointer set, or null

  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • property_name: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      typedef enum
    {
    PROP_FOO = 1,
    PROP_LAST
    } MyObjectProperty;

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
    0, 100,
    50,
    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    Returns void

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

    the same object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

    object

  • Releases all references to other objects. This can be used to break reference cycles.

    This function should only be called from object system implementations.

    Returns void

  • Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.

    Parameters

    • properties: { [key: string]: any }

      Object containing the properties to set

    Returns void

  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a GLib.Quark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the GLib.Quark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • data: any

      data to associate with that key

    Returns void

  • Sets a property on an object.

    Parameters

    • property_name: string

      The name of the property to set

    • value: any

      The value to set the property to

    Returns void

  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • key: string

      name of the key

    Returns any

    the data if found, or null if no such data exists.

  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A GLib.Quark, naming the user data pointer

    Returns any

    The user data pointer set, or null

  • Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.

    Parameters

    • detailedName: string

      Name of the signal to stop emission of

    Returns void

  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the GObject.Object may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to null rather than retain a dangling pointer to a potentially invalid GObject.Object instance. Use g_clear_object() for this.

    Returns void

  • the constructed function is called by g_object_new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation.

    Returns void

  • the dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, dispose should chain up to the dispose method of the parent class.

    Returns void

  • instance finalization function, should finish the finalization of the instance begun in dispose and chain up to the finalize method of the parent class.

    Returns void

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    Returns void

  • the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of set_property don't emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

    Parameters

    Returns void

  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    Returns void

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GObject.ParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of GObject.TypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    Returns void

  • Parameters

    • property_id: number

      the new property ID

    • name: string

      the name of a property registered in a parent class or in an interface of this class.

    Returns void

Interfaces

ConstructorProps
SignalSignatures