///
///
///
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://Cogl?version=2.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type GL from 'gi://GL?version=1.0';
export namespace Cogl {
/**
* Cogl-2.0
*/
/**
* Data types for the components of a vertex attribute.
*/
/**
* Data types for the components of a vertex attribute.
*/
export namespace AttributeType {
export const $gtype: GObject.GType;
}
enum AttributeType {
/**
* Data is the same size of a byte
*/
BYTE,
/**
* Data is the same size of an
* unsigned byte
*/
UNSIGNED_BYTE,
/**
* Data is the same size of a short integer
*/
SHORT,
/**
* Data is the same size of
* an unsigned short integer
*/
UNSIGNED_SHORT,
/**
* Data is the same size of a float
*/
FLOAT,
}
/**
* Error codes that can be thrown when performing bitmap
* operations. Note that gdk_pixbuf_new_from_file() can also throw
* errors directly from the underlying image loading library. For
* example, if GdkPixbuf is used then errors #GdkPixbufErrors
* will be used directly.
*/
/**
* Error codes that can be thrown when performing bitmap
* operations. Note that gdk_pixbuf_new_from_file() can also throw
* errors directly from the underlying image loading library. For
* example, if GdkPixbuf is used then errors #GdkPixbufErrors
* will be used directly.
*/
export namespace BitmapError {
export const $gtype: GObject.GType;
}
enum BitmapError {
/**
* Generic failure code, something went
* wrong.
*/
FAILED,
/**
* Unknown image type.
*/
UNKNOWN_TYPE,
/**
* An image file was broken somehow.
*/
CORRUPT_IMAGE,
}
/**
* Error enumeration for the blend strings parser
*/
/**
* Error enumeration for the blend strings parser
*/
export namespace BlendStringError {
export const $gtype: GObject.GType;
}
enum BlendStringError {
/**
* Generic parse error
*/
PARSE_ERROR,
/**
* Argument parse error
*/
ARGUMENT_PARSE_ERROR,
/**
* Internal parser error
*/
INVALID_ERROR,
/**
* Blend string not
* supported by the GPU
*/
GPU_UNSUPPORTED_ERROR,
}
/**
* Error enumeration for #CoglBuffer
*/
/**
* Error enumeration for #CoglBuffer
*/
export namespace BufferError {
export const $gtype: GObject.GType;
}
enum BufferError {
/**
* A buffer could not be mapped either
* because the feature isn't supported or because a system
* limitation was hit.
*/
BUFFER_ERROR_MAP,
}
/**
* The update hint on a buffer allows the user to give some detail on how often
* the buffer data is going to be updated.
*/
/**
* The update hint on a buffer allows the user to give some detail on how often
* the buffer data is going to be updated.
*/
export namespace BufferUpdateHint {
export const $gtype: GObject.GType;
}
enum BufferUpdateHint {
/**
* the buffer will not change over time
*/
STATIC,
/**
* the buffer will change from time to time
*/
DYNAMIC,
/**
* the buffer will be used once or a couple of
* times
*/
STREAM,
}
/**
* When using depth testing one of these functions is used to compare
* the depth of an incoming fragment against the depth value currently
* stored in the depth buffer. The function is changed using
* cogl_depth_state_set_test_function().
*
* The test is only done when depth testing is explicitly enabled. (See
* cogl_depth_state_set_test_enabled())
*/
/**
* When using depth testing one of these functions is used to compare
* the depth of an incoming fragment against the depth value currently
* stored in the depth buffer. The function is changed using
* cogl_depth_state_set_test_function().
*
* The test is only done when depth testing is explicitly enabled. (See
* cogl_depth_state_set_test_enabled())
*/
export namespace DepthTestFunction {
export const $gtype: GObject.GType;
}
enum DepthTestFunction {
/**
* Never passes.
*/
NEVER,
/**
* Passes if the fragment's depth
* value is less than the value currently in the depth buffer.
*/
LESS,
/**
* Passes if the fragment's depth
* value is equal to the value currently in the depth buffer.
*/
EQUAL,
/**
* Passes if the fragment's depth
* value is less or equal to the value currently in the depth buffer.
*/
LEQUAL,
/**
* Passes if the fragment's depth
* value is greater than the value currently in the depth buffer.
*/
GREATER,
/**
* Passes if the fragment's depth
* value is not equal to the value currently in the depth buffer.
*/
NOTEQUAL,
/**
* Passes if the fragment's depth
* value greater than or equal to the value currently in the depth buffer.
*/
GEQUAL,
/**
* Always passes.
*/
ALWAYS,
}
/**
* Identifiers for underlying hardware drivers that may be used by
* Cogl for rendering.
*/
/**
* Identifiers for underlying hardware drivers that may be used by
* Cogl for rendering.
*/
export namespace Driver {
export const $gtype: GObject.GType;
}
enum Driver {
/**
* Implies no preference for which driver is used
*/
ANY,
/**
* A No-Op driver.
*/
NOP,
/**
* An OpenGL driver.
*/
GL,
/**
* An OpenGL driver using the core GL 3.1 profile
*/
GL3,
/**
* An OpenGL ES 1.1 driver.
*/
GLES1,
/**
* An OpenGL ES 2.0 driver.
*/
GLES2,
/**
* A WebGL driver.
*/
WEBGL,
}
/**
* All the capabilities that can vary between different GPUs supported
* by Cogl. Applications that depend on any of these features should explicitly
* check for them using cogl_has_feature() or cogl_has_features().
*/
/**
* All the capabilities that can vary between different GPUs supported
* by Cogl. Applications that depend on any of these features should explicitly
* check for them using cogl_has_feature() or cogl_has_features().
*/
export namespace FeatureID {
export const $gtype: GObject.GType;
}
enum FeatureID {
/**
* The hardware supports non power
* of two textures, but you also need to check the
* %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT
* features to know if the hardware supports npot texture mipmaps
* or repeat modes other than
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
*/
OGL_FEATURE_ID_TEXTURE_NPOT_BASIC,
/**
* Mipmapping is supported in
* conjuntion with non power of two textures.
*/
OGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP,
/**
* Repeat modes other than
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the
* hardware.
*/
OGL_FEATURE_ID_TEXTURE_NPOT_REPEAT,
/**
* Non power of two textures are supported
* by the hardware. This is a equivalent to the
* %COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP
* and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined.
*/
OGL_FEATURE_ID_TEXTURE_NPOT,
/**
* Support for rectangular
* textures with non-normalized texture coordinates.
*/
OGL_FEATURE_ID_TEXTURE_RECTANGLE,
/**
* 3D texture support
*/
OGL_FEATURE_ID_TEXTURE_3D,
/**
* GLSL support
*/
OGL_FEATURE_ID_GLSL,
/**
* ARBFP support
*/
OGL_FEATURE_ID_ARBFP,
/**
* Offscreen rendering support
*/
OGL_FEATURE_ID_OFFSCREEN,
/**
* Multisample support for
* offscreen framebuffers
*/
OGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
/**
* Multiple onscreen framebuffers
* supported.
*/
OGL_FEATURE_ID_ONSCREEN_MULTIPLE,
/**
* Set if
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
* cogl_indices_new().
*/
OGL_FEATURE_ID_UNSIGNED_INT_INDICES,
/**
* cogl_pipeline_set_depth_range() support
*/
OGL_FEATURE_ID_DEPTH_RANGE,
/**
* Whether
* cogl_pipeline_set_layer_point_sprite_coords_enabled() is supported.
*/
OGL_FEATURE_ID_POINT_SPRITE,
/**
* Whether cogl_buffer_map() is
* supported with CoglBufferAccess including read support.
*/
OGL_FEATURE_ID_MAP_BUFFER_FOR_READ,
/**
* Whether cogl_buffer_map() is
* supported with CoglBufferAccess including write support.
*/
OGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE,
/**
* Whether
* %COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT is supported.
*/
OGL_FEATURE_ID_MIRRORED_REPEAT,
/**
* Available if the window system supports reporting an event
* for swap buffer completions.
*/
OGL_FEATURE_ID_SWAP_BUFFERS_EVENT,
/**
* Whether creating new GLES2 contexts is
* suported.
*/
OGL_FEATURE_ID_GLES2_CONTEXT,
/**
* Whether #CoglFramebuffer support rendering
* the depth buffer to a texture.
*/
OGL_FEATURE_ID_DEPTH_TEXTURE,
/**
* Whether frame presentation
* time stamps will be recorded in #CoglFrameInfo objects.
*/
OGL_FEATURE_ID_PRESENTATION_TIME,
OGL_FEATURE_ID_FENCE,
/**
* Whether cogl_point_size_in
* can be used as an attribute to set a per-vertex point size.
*/
OGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
/**
* Support for
* %COGL_TEXTURE_COMPONENTS_RG as the internal components of a
* texture.
*/
OGL_FEATURE_ID_TEXTURE_RG,
/**
* Available if the age of #CoglOnscreen back
* buffers are tracked and so cogl_onscreen_get_buffer_age() can be
* expected to return age values other than 0.
*/
OGL_FEATURE_ID_BUFFER_AGE,
}
/**
* Return values for the #CoglXlibFilterFunc and #CoglWin32FilterFunc functions.
*/
/**
* Return values for the #CoglXlibFilterFunc and #CoglWin32FilterFunc functions.
*/
export namespace FilterReturn {
export const $gtype: GObject.GType;
}
enum FilterReturn {
/**
* The event was not handled, continues the
* processing
*/
CONTINUE,
/**
* Remove the event, stops the processing
*/
REMOVE,
}
/**
* The fog mode determines the equation used to calculate the fogging blend
* factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
* determines f as:
*
*
* ```
* f = end - eye_distance / end - start
* ```
*
*
* Where eye_distance is the distance of the current fragment in eye
* coordinates from the origin.
*/
/**
* The fog mode determines the equation used to calculate the fogging blend
* factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
* determines f as:
*
*
* ```
* f = end - eye_distance / end - start
* ```
*
*
* Where eye_distance is the distance of the current fragment in eye
* coordinates from the origin.
*/
export namespace FogMode {
export const $gtype: GObject.GType;
}
enum FogMode {
/**
* Calculates the fog blend factor as:
*
* ```
* f = end - eye_distance / end - start
* ```
*
*/
LINEAR,
/**
* Calculates the fog blend factor as:
*
* ```
* f = e ^ -(density * eye_distance)
* ```
*
*/
EXPONENTIAL,
/**
* Calculates the fog blend factor as:
*
* ```
* f = e ^ -(density * eye_distance)^2
* ```
*
*/
EXPONENTIAL_SQUARED,
}
/**
* Identifiers that are passed to #CoglFrameCallback functions
* (registered using cogl_onscreen_add_frame_callback()) that
* mark the progression of a frame in some way which usually
* means that new information will have been accumulated in the
* frame's corresponding #CoglFrameInfo object.
*
* The last event that will be sent for a frame will be a
* `COGL_FRAME_EVENT_COMPLETE` event and so these are a good
* opportunity to collect statistics about a frame since the
* #CoglFrameInfo should hold the most data at this point.
*
* A frame may not be completed before the next frame can start
* so applications should avoid needing to collect all statistics for
* a particular frame before they can start a new frame.
*/
/**
* Identifiers that are passed to #CoglFrameCallback functions
* (registered using cogl_onscreen_add_frame_callback()) that
* mark the progression of a frame in some way which usually
* means that new information will have been accumulated in the
* frame's corresponding #CoglFrameInfo object.
*
* The last event that will be sent for a frame will be a
* `COGL_FRAME_EVENT_COMPLETE` event and so these are a good
* opportunity to collect statistics about a frame since the
* #CoglFrameInfo should hold the most data at this point.
*
* A frame may not be completed before the next frame can start
* so applications should avoid needing to collect all statistics for
* a particular frame before they can start a new frame.
*/
export namespace FrameEvent {
export const $gtype: GObject.GType;
}
enum FrameEvent {
/**
* Notifies that the system compositor has
* acknowledged a frame and is ready for a
* new frame to be created.
*/
SYNC,
/**
* Notifies that a frame has ended. This
* is a good time for applications to
* collect statistics about the frame
* since the #CoglFrameInfo should hold
* the most data at this point. No other
* events should be expected after a
* `COGL_FRAME_EVENT_COMPLETE` event.
*/
COMPLETE,
}
export namespace FramebufferError {
export const $gtype: GObject.GType;
}
enum FramebufferError {
FRAMEBUFFER_ERROR_ALLOCATE,
}
/**
* Error codes that relate to the cogl_gles2_context api.
*/
/**
* Error codes that relate to the cogl_gles2_context api.
*/
export namespace GLES2ContextError {
export const $gtype: GObject.GType;
}
enum GLES2ContextError {
/**
* Creating GLES2 contexts
* isn't supported. Applications should use cogl_has_feature() to
* check for the %COGL_FEATURE_ID_GLES2_CONTEXT.
*/
UNSUPPORTED,
/**
* An underlying driver error
* occured.
*/
DRIVER,
}
/**
* You should aim to use the smallest data type that gives you enough
* range, since it reduces the size of your index array and can help
* reduce the demand on memory bandwidth.
*
* Note that %COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the
* %COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This
* should always be available on OpenGL but on OpenGL ES it will only
* be available if the GL_OES_element_index_uint extension is
* advertized.
*/
/**
* You should aim to use the smallest data type that gives you enough
* range, since it reduces the size of your index array and can help
* reduce the demand on memory bandwidth.
*
* Note that %COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the
* %COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This
* should always be available on OpenGL but on OpenGL ES it will only
* be available if the GL_OES_element_index_uint extension is
* advertized.
*/
export namespace IndicesType {
export const $gtype: GObject.GType;
}
enum IndicesType {
/**
* Your indices are unsigned bytes
*/
BYTE,
/**
* Your indices are unsigned shorts
*/
SHORT,
/**
* Your indices are unsigned ints
*/
INT,
}
export namespace MaterialAlphaFunc {
export const $gtype: GObject.GType;
}
enum MaterialAlphaFunc {
NEVER,
LESS,
EQUAL,
LEQUAL,
GREATER,
NOTEQUAL,
GEQUAL,
ALWAYS,
}
export namespace MaterialFilter {
export const $gtype: GObject.GType;
}
enum MaterialFilter {
NEAREST,
LINEAR,
NEAREST_MIPMAP_NEAREST,
LINEAR_MIPMAP_NEAREST,
NEAREST_MIPMAP_LINEAR,
LINEAR_MIPMAP_LINEAR,
}
export namespace MaterialLayerType {
export const $gtype: GObject.GType;
}
enum MaterialLayerType {
TEXTURE,
}
export namespace MaterialWrapMode {
export const $gtype: GObject.GType;
}
enum MaterialWrapMode {
REPEAT,
CLAMP_TO_EDGE,
AUTOMATIC,
}
/**
* Alpha testing happens before blending primitives with the framebuffer and
* gives an opportunity to discard fragments based on a comparison with the
* incoming alpha value and a reference alpha value. The #CoglPipelineAlphaFunc
* determines how the comparison is done.
*/
/**
* Alpha testing happens before blending primitives with the framebuffer and
* gives an opportunity to discard fragments based on a comparison with the
* incoming alpha value and a reference alpha value. The #CoglPipelineAlphaFunc
* determines how the comparison is done.
*/
export namespace PipelineAlphaFunc {
export const $gtype: GObject.GType;
}
enum PipelineAlphaFunc {
/**
* Never let the fragment through.
*/
NEVER,
/**
* Let the fragment through if the incoming
* alpha value is less than the reference alpha value
*/
LESS,
/**
* Let the fragment through if the incoming
* alpha value equals the reference alpha value
*/
EQUAL,
/**
* Let the fragment through if the incoming
* alpha value is less than or equal to the reference alpha value
*/
LEQUAL,
/**
* Let the fragment through if the incoming
* alpha value is greater than the reference alpha value
*/
GREATER,
/**
* Let the fragment through if the incoming
* alpha value does not equal the reference alpha value
*/
NOTEQUAL,
/**
* Let the fragment through if the incoming
* alpha value is greater than or equal to the reference alpha value.
*/
GEQUAL,
/**
* Always let the fragment through.
*/
ALWAYS,
}
/**
* Specifies which faces should be culled. This can be set on a
* pipeline using cogl_pipeline_set_cull_face_mode().
*/
/**
* Specifies which faces should be culled. This can be set on a
* pipeline using cogl_pipeline_set_cull_face_mode().
*/
export namespace PipelineCullFaceMode {
export const $gtype: GObject.GType;
}
enum PipelineCullFaceMode {
/**
* Neither face will be
* culled. This is the default.
*/
NONE,
/**
* Front faces will be culled.
*/
FRONT,
/**
* Back faces will be culled.
*/
BACK,
/**
* All faces will be culled.
*/
BOTH,
}
/**
* Texture filtering is used whenever the current pixel maps either to more
* than one texture element (texel) or less than one. These filter enums
* correspond to different strategies used to come up with a pixel color, by
* possibly referring to multiple neighbouring texels and taking a weighted
* average or simply using the nearest texel.
*/
/**
* Texture filtering is used whenever the current pixel maps either to more
* than one texture element (texel) or less than one. These filter enums
* correspond to different strategies used to come up with a pixel color, by
* possibly referring to multiple neighbouring texels and taking a weighted
* average or simply using the nearest texel.
*/
export namespace PipelineFilter {
export const $gtype: GObject.GType;
}
enum PipelineFilter {
/**
* Measuring in manhatten distance from the,
* current pixel center, use the nearest texture texel
*/
NEAREST,
/**
* Use the weighted average of the 4 texels
* nearest the current pixel center
*/
LINEAR,
/**
* Select the mimap level whose
* texel size most closely matches the current pixel, and use the
* %COGL_PIPELINE_FILTER_NEAREST criterion
*/
NEAREST_MIPMAP_NEAREST,
/**
* Select the mimap level whose
* texel size most closely matches the current pixel, and use the
* %COGL_PIPELINE_FILTER_LINEAR criterion
*/
LINEAR_MIPMAP_NEAREST,
/**
* Select the two mimap levels
* whose texel size most closely matches the current pixel, use
* the %COGL_PIPELINE_FILTER_NEAREST criterion on each one and take
* their weighted average
*/
NEAREST_MIPMAP_LINEAR,
/**
* Select the two mimap levels
* whose texel size most closely matches the current pixel, use
* the %COGL_PIPELINE_FILTER_LINEAR criterion on each one and take
* their weighted average
*/
LINEAR_MIPMAP_LINEAR,
}
/**
* The wrap mode specifies what happens when texture coordinates
* outside the range 0→1 are used. Note that if the filter mode is
* anything but %COGL_PIPELINE_FILTER_NEAREST then texels outside the
* range 0→1 might be used even when the coordinate is exactly 0 or 1
* because OpenGL will try to sample neighbouring pixels. For example
* if you are trying to render the full texture then you may get
* artifacts around the edges when the pixels from the other side are
* merged in if the wrap mode is set to repeat.
*/
/**
* The wrap mode specifies what happens when texture coordinates
* outside the range 0→1 are used. Note that if the filter mode is
* anything but %COGL_PIPELINE_FILTER_NEAREST then texels outside the
* range 0→1 might be used even when the coordinate is exactly 0 or 1
* because OpenGL will try to sample neighbouring pixels. For example
* if you are trying to render the full texture then you may get
* artifacts around the edges when the pixels from the other side are
* merged in if the wrap mode is set to repeat.
*/
export namespace PipelineWrapMode {
export const $gtype: GObject.GType;
}
enum PipelineWrapMode {
/**
* The texture will be repeated. This
* is useful for example to draw a tiled background.
*/
REPEAT,
MIRRORED_REPEAT,
/**
* The coordinates outside the
* range 0→1 will sample copies of the edge pixels of the
* texture. This is useful to avoid artifacts if only one copy of
* the texture is being rendered.
*/
CLAMP_TO_EDGE,
/**
* Cogl will try to automatically
* decide which of the above two to use. For cogl_rectangle(), it
* will use repeat mode if any of the texture coordinates are
* outside the range 0→1, otherwise it will use clamp to edge. For
* cogl_polygon() it will always use repeat mode. For
* cogl_vertex_buffer_draw() it will use repeat mode except for
* layers that have point sprite coordinate generation enabled. This
* is the default value.
*/
AUTOMATIC,
}
/**
* Pixel formats used by Cogl. For the formats with a byte per
* component, the order of the components specify the order in
* increasing memory addresses. So for example
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
* lowest address, green in the next address and blue after that
* regardless of the endianness of the system.
*
* For the formats with non byte aligned components the component
* order specifies the order within a 16-bit or 32-bit number from
* most significant bit to least significant. So for
* %COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits
* 11-15, the green component would be in 6-11 and the blue component
* would be in 1-5. Therefore the order in memory depends on the
* endianness of the system.
*
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
* internal format. Cogl will try to pick the best format to use
* internally and convert the texture data if necessary.
*/
/**
* Pixel formats used by Cogl. For the formats with a byte per
* component, the order of the components specify the order in
* increasing memory addresses. So for example
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
* lowest address, green in the next address and blue after that
* regardless of the endianness of the system.
*
* For the formats with non byte aligned components the component
* order specifies the order within a 16-bit or 32-bit number from
* most significant bit to least significant. So for
* %COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits
* 11-15, the green component would be in 6-11 and the blue component
* would be in 1-5. Therefore the order in memory depends on the
* endianness of the system.
*
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
* internal format. Cogl will try to pick the best format to use
* internally and convert the texture data if necessary.
*/
export namespace PixelFormat {
export const $gtype: GObject.GType;
}
enum PixelFormat {
/**
* Any format
*/
ANY,
/**
* 8 bits alpha mask
*/
A_8,
/**
* RGB, 16 bits
*/
RGB_565,
/**
* RGBA, 16 bits
*/
RGBA_4444,
/**
* RGBA, 16 bits
*/
RGBA_5551,
/**
* Not currently supported
*/
YUV,
/**
* Single luminance component
*/
G_8,
/**
* RG, 16 bits. Note that red-green textures
* are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised.
* See cogl_texture_set_components() for details.
*/
RG_88,
/**
* RGB, 24 bits
*/
RGB_888,
/**
* BGR, 24 bits
*/
BGR_888,
/**
* RGBA, 32 bits
*/
RGBA_8888,
/**
* BGRA, 32 bits
*/
BGRA_8888,
/**
* ARGB, 32 bits
*/
ARGB_8888,
/**
* ABGR, 32 bits
*/
ABGR_8888,
/**
* RGBA, 32 bits, 10 bpc
*/
RGBA_1010102,
/**
* BGRA, 32 bits, 10 bpc
*/
BGRA_1010102,
/**
* ARGB, 32 bits, 10 bpc
*/
ARGB_2101010,
/**
* ABGR, 32 bits, 10 bpc
*/
ABGR_2101010,
/**
* Premultiplied RGBA, 32 bits
*/
RGBA_8888_PRE,
/**
* Premultiplied BGRA, 32 bits
*/
BGRA_8888_PRE,
/**
* Premultiplied ARGB, 32 bits
*/
ARGB_8888_PRE,
/**
* Premultiplied ABGR, 32 bits
*/
ABGR_8888_PRE,
/**
* Premultiplied RGBA, 16 bits
*/
RGBA_4444_PRE,
/**
* Premultiplied RGBA, 16 bits
*/
RGBA_5551_PRE,
/**
* Premultiplied RGBA, 32 bits, 10 bpc
*/
RGBA_1010102_PRE,
/**
* Premultiplied BGRA, 32 bits, 10 bpc
*/
BGRA_1010102_PRE,
/**
* Premultiplied ARGB, 32 bits, 10 bpc
*/
ARGB_2101010_PRE,
/**
* Premultiplied ABGR, 32 bits, 10 bpc
*/
ABGR_2101010_PRE,
DEPTH_16,
DEPTH_32,
DEPTH_24_STENCIL_8,
}
/**
* A bitmask of events that Cogl may need to wake on for a file
* descriptor. Note that these all have the same values as the
* corresponding defines for the poll function call on Unix so they
* may be directly passed to poll.
*/
/**
* A bitmask of events that Cogl may need to wake on for a file
* descriptor. Note that these all have the same values as the
* corresponding defines for the poll function call on Unix so they
* may be directly passed to poll.
*/
export namespace PollFDEvent {
export const $gtype: GObject.GType;
}
enum PollFDEvent {
/**
* there is data to read
*/
IN,
/**
* data can be written (without blocking)
*/
PRI,
/**
* there is urgent data to read.
*/
OUT,
/**
* error condition
*/
ERR,
/**
* hung up (the connection has been broken, usually
* for pipes and sockets).
*/
HUP,
/**
* invalid request. The file descriptor is not open.
*/
NVAL,
}
export namespace RendererError {
export const $gtype: GObject.GType;
}
enum RendererError {
XLIB_DISPLAY_OPEN,
BAD_CONSTRAINT,
}
export namespace ShaderType {
export const $gtype: GObject.GType;
}
enum ShaderType {
VERTEX,
FRAGMENT,
}
/**
* #CoglSnippetHook is used to specify a location within a
* #CoglPipeline where the code of the snippet should be used when it
* is attached to a pipeline.
*
*
*
* %COGL_SNIPPET_HOOK_VERTEX_GLOBALS
*
*
* Adds a shader snippet at the beginning of the global section of the
* shader for the vertex processing. Any declarations here can be
* shared with all other snippets that are attached to a vertex hook.
* Only the ‘declarations’ string is used and the other strings are
* ignored.
*
*
*
*
* %COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS
*
*
* Adds a shader snippet at the beginning of the global section of the
* shader for the fragment processing. Any declarations here can be
* shared with all other snippets that are attached to a fragment
* hook. Only the ‘declarations’ string is used and the other strings
* are ignored.
*
*
*
*
* %COGL_SNIPPET_HOOK_VERTEX
*
*
* Adds a shader snippet that will hook on to the vertex processing
* stage of the pipeline. This gives a chance for the application to
* modify the vertex attributes generated by the shader. Typically the
* snippet will modify cogl_color_out or cogl_position_out builtins.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before any vertex processing is done.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated vertex processing if it is present. This can be used if
* the application wants to provide a complete vertex shader and
* doesn't need the generated output from Cogl.
*
*
* The ‘post’ string in `snippet` will be inserted after all of the
* standard vertex processing is done. This can be used to modify the
* outputs.
*
*
*
*
* %COGL_SNIPPET_HOOK_VERTEX_TRANSFORM
*
*
* Adds a shader snippet that will hook on to the vertex transform stage.
* Typically the snippet will use the cogl_modelview_matrix,
* cogl_projection_matrix and cogl_modelview_projection_matrix matrices and the
* cogl_position_in attribute. The hook must write to cogl_position_out.
* The default processing for this hook will multiply cogl_position_in by
* the combined modelview-projection matrix and store it on cogl_position_out.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before the vertex transform is done.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated vertex transform if it is present.
*
*
* The ‘post’ string in `snippet` will be inserted after all of the
* standard vertex transformation is done. This can be used to modify the
* cogl_position_out in addition to the default processing.
*
*
*
*
* %COGL_SNIPPET_HOOK_POINT_SIZE
*
*
* Adds a shader snippet that will hook on to the point size
* calculation step within the vertex shader stage. The snippet should
* write to the builtin cogl_point_size_out with the new point size.
* The snippet can either read cogl_point_size_in directly and write a
* new value or first read an existing value in cogl_point_size_out
* that would be set by a previous snippet. Note that this hook is
* only used if cogl_pipeline_set_per_vertex_point_size() is enabled
* on the pipeline.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted just before
* calculating the point size.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated point size calculation if it is present.
*
*
* The ‘post’ string in `snippet` will be inserted after the
* standard point size calculation is done. This can be used to modify
* cogl_point_size_out in addition to the default processing.
*
*
*
*
* %COGL_SNIPPET_HOOK_FRAGMENT
*
*
* Adds a shader snippet that will hook on to the fragment processing
* stage of the pipeline. This gives a chance for the application to
* modify the fragment color generated by the shader. Typically the
* snippet will modify cogl_color_out.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before any fragment processing is done.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated fragment processing if it is present. This can be used if
* the application wants to provide a complete fragment shader and
* doesn't need the generated output from Cogl.
*
*
* The ‘post’ string in `snippet` will be inserted after all of the
* standard fragment processing is done. At this point the generated
* value for the rest of the pipeline state will already be in
* cogl_color_out so the application can modify the result by altering
* this variable.
*
*
*
*
* %COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM
*
*
* Adds a shader snippet that will hook on to the texture coordinate
* transformation of a particular layer. This can be used to replace
* the processing for a layer or to modify the results.
*
*
* Within the snippet code for this hook there are two extra
* variables. The first is a mat4 called cogl_matrix which represents
* the user matrix for this layer. The second is called cogl_tex_coord
* and represents the incoming and outgoing texture coordinate. On
* entry to the hook, cogl_tex_coord contains the value of the
* corresponding texture coordinate attribute for this layer. The hook
* is expected to modify this variable. The output will be passed as a
* varying to the fragment processing stage. The default code will
* just multiply cogl_matrix by cogl_tex_coord and store the result in
* cogl_tex_coord.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted just before the
* fragment processing for this layer. At this point cogl_tex_coord
* still contains the value of the texture coordinate attribute.
*
*
* If a ‘replace’ string is given then this will be used instead of
* the default fragment processing for this layer. The snippet can
* modify cogl_tex_coord or leave it as is to apply no transformation.
*
*
* The ‘post’ string in `snippet` will be inserted just after the
* transformation. At this point cogl_tex_coord will contain the
* results of the transformation but it can be further modified by the
* snippet.
*
*
*
*
* %COGL_SNIPPET_HOOK_LAYER_FRAGMENT
*
*
* Adds a shader snippet that will hook on to the fragment processing
* of a particular layer. This can be used to replace the processing
* for a layer or to modify the results.
*
*
* Within the snippet code for this hook there is an extra vec4
* variable called ‘cogl_layer’. This contains the resulting color
* that will be used for the layer. This can be modified in the ‘post’
* section or it the default processing can be replaced entirely using
* the ‘replace’ section.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted just before the
* fragment processing for this layer.
*
*
* If a ‘replace’ string is given then this will be used instead of
* the default fragment processing for this layer. The snippet must write to
* the ‘cogl_layer’ variable in that case.
*
*
* The ‘post’ string in `snippet` will be inserted just after the
* fragment processing for the layer. The results can be modified by changing
* the value of the ‘cogl_layer’ variable.
*
*
*
*
* %COGL_SNIPPET_HOOK_TEXTURE_LOOKUP
*
*
* Adds a shader snippet that will hook on to the texture lookup part
* of a given layer. This gives a chance for the application to modify
* the coordinates that will be used for the texture lookup or to
* alter the returned texel.
*
*
* Within the snippet code for this hook there are three extra
* variables available. ‘cogl_sampler’ is a sampler object
* representing the sampler for the layer where the snippet is
* attached. ‘cogl_tex_coord’ is a vec4 which contains the texture
* coordinates that will be used for the texture lookup. This can be
* modified. ‘cogl_texel’ will contain the result of the texture
* lookup. This can also be modified.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before any fragment processing is done. This is a
* good place to modify the cogl_tex_coord variable.
*
*
* If a ‘replace’ string is given then this will be used instead of a
* the default texture lookup. The snippet would typically use its own
* sampler in this case.
*
*
* The ‘post’ string in `snippet` will be inserted after texture lookup
* has been preformed. Here the snippet can modify the cogl_texel
* variable to alter the returned texel.
*
*
*
*
*/
/**
* #CoglSnippetHook is used to specify a location within a
* #CoglPipeline where the code of the snippet should be used when it
* is attached to a pipeline.
*
*
*
* %COGL_SNIPPET_HOOK_VERTEX_GLOBALS
*
*
* Adds a shader snippet at the beginning of the global section of the
* shader for the vertex processing. Any declarations here can be
* shared with all other snippets that are attached to a vertex hook.
* Only the ‘declarations’ string is used and the other strings are
* ignored.
*
*
*
*
* %COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS
*
*
* Adds a shader snippet at the beginning of the global section of the
* shader for the fragment processing. Any declarations here can be
* shared with all other snippets that are attached to a fragment
* hook. Only the ‘declarations’ string is used and the other strings
* are ignored.
*
*
*
*
* %COGL_SNIPPET_HOOK_VERTEX
*
*
* Adds a shader snippet that will hook on to the vertex processing
* stage of the pipeline. This gives a chance for the application to
* modify the vertex attributes generated by the shader. Typically the
* snippet will modify cogl_color_out or cogl_position_out builtins.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before any vertex processing is done.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated vertex processing if it is present. This can be used if
* the application wants to provide a complete vertex shader and
* doesn't need the generated output from Cogl.
*
*
* The ‘post’ string in `snippet` will be inserted after all of the
* standard vertex processing is done. This can be used to modify the
* outputs.
*
*
*
*
* %COGL_SNIPPET_HOOK_VERTEX_TRANSFORM
*
*
* Adds a shader snippet that will hook on to the vertex transform stage.
* Typically the snippet will use the cogl_modelview_matrix,
* cogl_projection_matrix and cogl_modelview_projection_matrix matrices and the
* cogl_position_in attribute. The hook must write to cogl_position_out.
* The default processing for this hook will multiply cogl_position_in by
* the combined modelview-projection matrix and store it on cogl_position_out.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before the vertex transform is done.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated vertex transform if it is present.
*
*
* The ‘post’ string in `snippet` will be inserted after all of the
* standard vertex transformation is done. This can be used to modify the
* cogl_position_out in addition to the default processing.
*
*
*
*
* %COGL_SNIPPET_HOOK_POINT_SIZE
*
*
* Adds a shader snippet that will hook on to the point size
* calculation step within the vertex shader stage. The snippet should
* write to the builtin cogl_point_size_out with the new point size.
* The snippet can either read cogl_point_size_in directly and write a
* new value or first read an existing value in cogl_point_size_out
* that would be set by a previous snippet. Note that this hook is
* only used if cogl_pipeline_set_per_vertex_point_size() is enabled
* on the pipeline.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted just before
* calculating the point size.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated point size calculation if it is present.
*
*
* The ‘post’ string in `snippet` will be inserted after the
* standard point size calculation is done. This can be used to modify
* cogl_point_size_out in addition to the default processing.
*
*
*
*
* %COGL_SNIPPET_HOOK_FRAGMENT
*
*
* Adds a shader snippet that will hook on to the fragment processing
* stage of the pipeline. This gives a chance for the application to
* modify the fragment color generated by the shader. Typically the
* snippet will modify cogl_color_out.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before any fragment processing is done.
*
*
* The ‘replace’ string in `snippet` will be used instead of the
* generated fragment processing if it is present. This can be used if
* the application wants to provide a complete fragment shader and
* doesn't need the generated output from Cogl.
*
*
* The ‘post’ string in `snippet` will be inserted after all of the
* standard fragment processing is done. At this point the generated
* value for the rest of the pipeline state will already be in
* cogl_color_out so the application can modify the result by altering
* this variable.
*
*
*
*
* %COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM
*
*
* Adds a shader snippet that will hook on to the texture coordinate
* transformation of a particular layer. This can be used to replace
* the processing for a layer or to modify the results.
*
*
* Within the snippet code for this hook there are two extra
* variables. The first is a mat4 called cogl_matrix which represents
* the user matrix for this layer. The second is called cogl_tex_coord
* and represents the incoming and outgoing texture coordinate. On
* entry to the hook, cogl_tex_coord contains the value of the
* corresponding texture coordinate attribute for this layer. The hook
* is expected to modify this variable. The output will be passed as a
* varying to the fragment processing stage. The default code will
* just multiply cogl_matrix by cogl_tex_coord and store the result in
* cogl_tex_coord.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted just before the
* fragment processing for this layer. At this point cogl_tex_coord
* still contains the value of the texture coordinate attribute.
*
*
* If a ‘replace’ string is given then this will be used instead of
* the default fragment processing for this layer. The snippet can
* modify cogl_tex_coord or leave it as is to apply no transformation.
*
*
* The ‘post’ string in `snippet` will be inserted just after the
* transformation. At this point cogl_tex_coord will contain the
* results of the transformation but it can be further modified by the
* snippet.
*
*
*
*
* %COGL_SNIPPET_HOOK_LAYER_FRAGMENT
*
*
* Adds a shader snippet that will hook on to the fragment processing
* of a particular layer. This can be used to replace the processing
* for a layer or to modify the results.
*
*
* Within the snippet code for this hook there is an extra vec4
* variable called ‘cogl_layer’. This contains the resulting color
* that will be used for the layer. This can be modified in the ‘post’
* section or it the default processing can be replaced entirely using
* the ‘replace’ section.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted just before the
* fragment processing for this layer.
*
*
* If a ‘replace’ string is given then this will be used instead of
* the default fragment processing for this layer. The snippet must write to
* the ‘cogl_layer’ variable in that case.
*
*
* The ‘post’ string in `snippet` will be inserted just after the
* fragment processing for the layer. The results can be modified by changing
* the value of the ‘cogl_layer’ variable.
*
*
*
*
* %COGL_SNIPPET_HOOK_TEXTURE_LOOKUP
*
*
* Adds a shader snippet that will hook on to the texture lookup part
* of a given layer. This gives a chance for the application to modify
* the coordinates that will be used for the texture lookup or to
* alter the returned texel.
*
*
* Within the snippet code for this hook there are three extra
* variables available. ‘cogl_sampler’ is a sampler object
* representing the sampler for the layer where the snippet is
* attached. ‘cogl_tex_coord’ is a vec4 which contains the texture
* coordinates that will be used for the texture lookup. This can be
* modified. ‘cogl_texel’ will contain the result of the texture
* lookup. This can also be modified.
*
*
* The ‘declarations’ string in `snippet` will be inserted in the
* global scope of the shader. Use this to declare any uniforms,
* attributes or functions that the snippet requires.
*
*
* The ‘pre’ string in `snippet` will be inserted at the top of the
* main() function before any fragment processing is done. This is a
* good place to modify the cogl_tex_coord variable.
*
*
* If a ‘replace’ string is given then this will be used instead of a
* the default texture lookup. The snippet would typically use its own
* sampler in this case.
*
*
* The ‘post’ string in `snippet` will be inserted after texture lookup
* has been preformed. Here the snippet can modify the cogl_texel
* variable to alter the returned texel.
*
*
*
*
*/
export namespace SnippetHook {
export const $gtype: GObject.GType;
}
enum SnippetHook {
/**
* A hook for the entire vertex processing
* stage of the pipeline.
*/
VERTEX,
/**
* A hook for the vertex transformation.
*/
VERTEX_TRANSFORM,
/**
* A hook for declaring global data
* that can be shared with all other snippets that are on a vertex
* hook.
*/
VERTEX_GLOBALS,
/**
* A hook for manipulating the point
* size of a vertex. This is only used if
* cogl_pipeline_set_per_vertex_point_size() is enabled on the
* pipeline.
*/
POINT_SIZE,
/**
* A hook for the entire fragment
* processing stage of the pipeline.
*/
FRAGMENT,
/**
* A hook for declaring global
* data wthat can be shared with all other snippets that are on a
* fragment hook.
*/
FRAGMENT_GLOBALS,
/**
* A hook for applying the
* layer matrix to a texture coordinate for a layer.
*/
TEXTURE_COORD_TRANSFORM,
/**
* A hook for the fragment
* processing of a particular layer.
*/
LAYER_FRAGMENT,
/**
* A hook for the texture lookup
* stage of a given layer in a pipeline.
*/
TEXTURE_LOOKUP,
}
/**
* Represents how draw should affect the two buffers
* of a stereo framebuffer. See cogl_framebuffer_set_stereo_mode().
*/
/**
* Represents how draw should affect the two buffers
* of a stereo framebuffer. See cogl_framebuffer_set_stereo_mode().
*/
export namespace StereoMode {
export const $gtype: GObject.GType;
}
enum StereoMode {
/**
* draw to both stereo buffers
*/
BOTH,
/**
* draw only to the left stereo buffer
*/
LEFT,
/**
* draw only to the left stereo buffer
*/
RIGHT,
}
/**
* Some output devices (such as LCD panels) display colors
* by making each pixel consist of smaller "subpixels"
* that each have a particular color. By using knowledge
* of the layout of this subpixel components, it is possible
* to create image content with higher resolution than the
* pixel grid.
*/
/**
* Some output devices (such as LCD panels) display colors
* by making each pixel consist of smaller "subpixels"
* that each have a particular color. By using knowledge
* of the layout of this subpixel components, it is possible
* to create image content with higher resolution than the
* pixel grid.
*/
export namespace SubpixelOrder {
export const $gtype: GObject.GType;
}
enum SubpixelOrder {
/**
* the layout of subpixel
* components for the device is unknown.
*/
UNKNOWN,
/**
* the device displays colors
* without geometrically-separated subpixel components,
* or the positioning or colors of the components do not
* match any of the values in the enumeration.
*/
NONE,
/**
* the device has
* horizontally arranged components in the order
* red-green-blue from left to right.
*/
HORIZONTAL_RGB,
/**
* the device has
* horizontally arranged components in the order
* blue-green-red from left to right.
*/
HORIZONTAL_BGR,
/**
* the device has
* vertically arranged components in the order
* red-green-blue from top to bottom.
*/
VERTICAL_RGB,
/**
* the device has
* vertically arranged components in the order
* blue-green-red from top to bottom.
*/
VERTICAL_BGR,
}
/**
* Error enumeration for Cogl
*
* The `COGL_SYSTEM_ERROR_UNSUPPORTED` error can be thrown for a
* variety of reasons. For example:
*
*
* You've tried to use a feature that is not
* advertised by cogl_has_feature(). This could happen if you create
* a 2d texture with a non-power-of-two size when
* %COGL_FEATURE_ID_TEXTURE_NPOT is not advertised.
* The GPU can not handle the configuration you have
* requested. An example might be if you try to use too many texture
* layers in a single #CoglPipeline
* The driver does not support some
* configuration.
*
*
* Currently this is only used by Cogl API marked as experimental so
* this enum should also be considered experimental.
*/
/**
* Error enumeration for Cogl
*
* The `COGL_SYSTEM_ERROR_UNSUPPORTED` error can be thrown for a
* variety of reasons. For example:
*
*
* You've tried to use a feature that is not
* advertised by cogl_has_feature(). This could happen if you create
* a 2d texture with a non-power-of-two size when
* %COGL_FEATURE_ID_TEXTURE_NPOT is not advertised.
* The GPU can not handle the configuration you have
* requested. An example might be if you try to use too many texture
* layers in a single #CoglPipeline
* The driver does not support some
* configuration.
*
*
* Currently this is only used by Cogl API marked as experimental so
* this enum should also be considered experimental.
*/
export namespace SystemError {
export const $gtype: GObject.GType;
}
enum SystemError {
/**
* You tried to use a feature or
* configuration not currently available.
*/
COGL_SYSTEM_ERROR_UNSUPPORTED,
/**
* You tried to allocate a resource
* such as a texture and there wasn't enough memory.
*/
COGL_SYSTEM_ERROR_NO_MEMORY,
}
/**
* See cogl_texture_set_components().
*/
/**
* See cogl_texture_set_components().
*/
export namespace TextureComponents {
export const $gtype: GObject.GType;
}
enum TextureComponents {
/**
* Only the alpha component
*/
A,
/**
* Red and green components. Note that
* this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
* is advertised.
*/
RG,
/**
* Red, green and blue components
*/
RGB,
/**
* Red, green, blue and alpha components
*/
RGBA,
/**
* Only a depth component
*/
DEPTH,
}
/**
* Error codes that can be thrown when allocating textures.
*/
/**
* Error codes that can be thrown when allocating textures.
*/
export namespace TextureError {
export const $gtype: GObject.GType;
}
enum TextureError {
/**
* Unsupported size
*/
SIZE,
/**
* Unsupported format
*/
FORMAT,
BAD_PARAMETER,
/**
* A primitive texture type that is
* unsupported by the driver was used
*/
TYPE,
}
/**
* Error codes that can be thrown when performing texture-pixmap-x11
* operations.
*/
/**
* Error codes that can be thrown when performing texture-pixmap-x11
* operations.
*/
export namespace TexturePixmapX11Error {
export const $gtype: GObject.GType;
}
enum TexturePixmapX11Error {
/**
* An X11 protocol error
*/
TEXTURE_PIXMAP_X11_ERROR_X11,
}
export namespace TexturePixmapX11ReportLevel {
export const $gtype: GObject.GType;
}
enum TexturePixmapX11ReportLevel {
RAW_RECTANGLES,
DELTA_RECTANGLES,
BOUNDING_BOX,
NON_EMPTY,
}
/**
* Constants representing the underlying hardware texture type of a
* #CoglTexture.
*/
/**
* Constants representing the underlying hardware texture type of a
* #CoglTexture.
*/
export namespace TextureType {
export const $gtype: GObject.GType;
}
enum TextureType {
/**
* A #CoglTexture2D
*/
'2D',
/**
* A #CoglTexture3D
*/
'3D',
/**
* A #CoglTextureRectangle
*/
RECTANGLE,
}
/**
* Different ways of interpreting vertices when drawing.
*/
/**
* Different ways of interpreting vertices when drawing.
*/
export namespace VerticesMode {
export const $gtype: GObject.GType;
}
enum VerticesMode {
/**
* FIXME, equivalent to
* GL_POINTS
*/
POINTS,
/**
* FIXME, equivalent to GL_LINES
*/
LINES,
/**
* FIXME, equivalent to
* GL_LINE_LOOP
*/
LINE_LOOP,
/**
* FIXME, equivalent to
* GL_LINE_STRIP
*/
LINE_STRIP,
/**
* FIXME, equivalent to
* GL_TRIANGLES
*/
TRIANGLES,
/**
* FIXME, equivalent to
* GL_TRIANGLE_STRIP
*/
TRIANGLE_STRIP,
/**
* FIXME, equivalent to GL_TRIANGLE_FAN
*/
TRIANGLE_FAN,
}
/**
* Enum used to represent the two directions of rotation. This can be
* used to set the front face for culling by calling
* cogl_pipeline_set_front_face_winding().
*/
/**
* Enum used to represent the two directions of rotation. This can be
* used to set the front face for culling by calling
* cogl_pipeline_set_front_face_winding().
*/
export namespace Winding {
export const $gtype: GObject.GType;
}
enum Winding {
/**
* Vertices are in a clockwise order
*/
CLOCKWISE,
/**
* Vertices are in a counter-clockwise order
*/
COUNTER_CLOCKWISE,
}
export namespace WinsysFeature {
export const $gtype: GObject.GType;
}
enum WinsysFeature {
MULTIPLE_ONSCREEN,
SWAP_THROTTLE,
VBLANK_COUNTER,
VBLANK_WAIT,
TEXTURE_FROM_PIXMAP,
SWAP_BUFFERS_EVENT,
SWAP_REGION,
SWAP_REGION_THROTTLE,
SWAP_REGION_SYNCHRONIZED,
BUFFER_AGE,
SYNC_AND_COMPLETE_EVENT,
N_FEATURES,
}
/**
* Identifies specific window system backends that Cogl supports.
*
* These can be used to query what backend Cogl is using or to try and
* explicitly select a backend to use.
*/
/**
* Identifies specific window system backends that Cogl supports.
*
* These can be used to query what backend Cogl is using or to try and
* explicitly select a backend to use.
*/
export namespace WinsysID {
export const $gtype: GObject.GType;
}
enum WinsysID {
/**
* Implies no preference for which backend is used
*/
ANY,
/**
* Use the no-op stub backend
*/
STUB,
/**
* Use the GLX window system binding API
*/
GLX,
/**
* Use EGL with the X window system via XLib
*/
EGL_XLIB,
/**
* Use EGL with the PowerVR NULL window system
*/
EGL_NULL,
/**
* Use EGL with the GDL platform
*/
EGL_GDL,
/**
* Use EGL with the Wayland window system
*/
EGL_WAYLAND,
/**
* Use EGL with the KMS platform
*/
EGL_KMS,
/**
* Use EGL with the Android platform
*/
EGL_ANDROID,
/**
* Use EGL with the Mir server
*/
EGL_MIR,
/**
* Use the Microsoft Windows WGL binding API
*/
WGL,
/**
* Use the SDL window system
*/
SDL,
}
const AFIRST_BIT: number;
const A_BIT: number;
const BGR_BIT: number;
const DEPTH_BIT: number;
const PREMULT_BIT: number;
const STENCIL_BIT: number;
const TEXTURE_MAX_WASTE: number;
const VERSION_COMPONENT_BITS: number;
const VERSION_MAX_COMPONENT_VALUE: number;
function bitmap_error_quark(): number;
function blend_string_error_quark(): number;
/**
* Retrieves the size of buffer
* @param buffer a buffer object
* @returns the size of the buffer in bytes
*/
function buffer_get_size(buffer: Buffer): number;
/**
* Retrieves the update hints set using cogl_buffer_set_update_hint()
* @param buffer a buffer object
* @returns the #CoglBufferUpdateHint currently used by the buffer
*/
function buffer_get_update_hint(buffer: Buffer): BufferUpdateHint;
/**
* Maps the buffer into the application address space for direct
* access. This is equivalent to calling cogl_buffer_map_range() with
* zero as the offset and the size of the entire buffer as the size.
*
* It is strongly recommended that you pass
* %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace
* all the buffer's data. This way if the buffer is currently being
* used by the GPU then the driver won't have to stall the CPU and
* wait for the hardware to finish because it can instead allocate a
* new buffer to map.
*
* The behaviour is undefined if you access the buffer in a way
* conflicting with the `access` mask you pass. It is also an error to
* release your last reference while the buffer is mapped.
* @param buffer a buffer object
* @param access how the mapped buffer will be used by the application
* @param hints A mask of #CoglBufferMapHints that tell Cogl how the data will be modified once mapped.
* @returns A pointer to the mapped memory or %NULL is the call fails
*/
function buffer_map(buffer: Buffer, access: BufferAccess | null, hints: BufferMapHint | null): any | null;
/**
* Maps a sub-region of the buffer into the application's address space
* for direct access.
*
* It is strongly recommended that you pass
* %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace
* all the buffer's data. This way if the buffer is currently being
* used by the GPU then the driver won't have to stall the CPU and
* wait for the hardware to finish because it can instead allocate a
* new buffer to map. You can pass
* %COGL_BUFFER_MAP_HINT_DISCARD_RANGE instead if you want the
* regions outside of the mapping to be retained.
*
* The behaviour is undefined if you access the buffer in a way
* conflicting with the `access` mask you pass. It is also an error to
* release your last reference while the buffer is mapped.
* @param buffer a buffer object
* @param offset Offset within the buffer to start the mapping
* @param size The size of data to map
* @param access how the mapped buffer will be used by the application
* @param hints A mask of #CoglBufferMapHints that tell Cogl how the data will be modified once mapped.
* @returns A pointer to the mapped memory or %NULL is the call fails
*/
function buffer_map_range(
buffer: Buffer,
offset: number,
size: number,
access: BufferAccess | null,
hints: BufferMapHint | null,
): any | null;
/**
* Updates part of the buffer with new data from `data`. Where to put this new
* data is controlled by `offset` and `offset` + `data` should be less than the
* buffer size.
* @param buffer a buffer object
* @param offset destination offset (in bytes) in the buffer
* @param data a pointer to the data to be copied into the buffer
* @param size number of bytes to copy
* @returns %TRUE is the operation succeeded, %FALSE otherwise
*/
function buffer_set_data(buffer: Buffer, offset: number, data: any | null, size: number): Bool;
/**
* Sets the update hint on a buffer. See #CoglBufferUpdateHint for a description
* of the available hints.
* @param buffer a buffer object
* @param hint the new hint
*/
function buffer_set_update_hint(buffer: Buffer, hint: BufferUpdateHint | null): void;
/**
* Unmaps a buffer previously mapped by cogl_buffer_map().
* @param buffer a buffer object
*/
function buffer_unmap(buffer: Buffer): void;
/**
* Compares two #CoglColors and checks if they are the same.
*
* This function can be passed to g_hash_table_new() as the `key_equal_func`
* parameter, when using #CoglColors as keys in a #GHashTable.
* @param v1 a #CoglColor
* @param v2 a #CoglColor
* @returns %TRUE if the two colors are the same.
*/
function color_equal(v1?: any | null, v2?: any | null): Bool;
/**
* Converts a color expressed in HLS (hue, luminance and saturation)
* values into a #CoglColor.
* @param hue hue value, in the 0 .. 360 range
* @param saturation saturation value, in the 0 .. 1 range
* @param luminance luminance value, in the 0 .. 1 range
*/
function color_init_from_hsl(hue: number, saturation: number, luminance: number): Color;
/**
* Allows visualizing the operations that build up the given `entry`
* for debugging purposes by printing to stdout.
* @param entry A #CoglMatrixEntry
*/
function debug_matrix_entry_print(entry: MatrixEntry): void;
/**
* Prints the contents of a #CoglMatrix to stdout.
* @param matrix A #CoglMatrix
*/
function debug_matrix_print(matrix: Matrix): void;
/**
* Invokes `func` once for each type of object that Cogl uses and
* passes a count of the number of objects for that type. This is
* intended to be used solely for debugging purposes to track down
* issues with objects leaking.
* @param func A callback function for each type
*/
function debug_object_foreach_type(func: DebugObjectForeachTypeCallback): void;
/**
* Prints a list of all the object types that Cogl uses along with the
* number of objects of that type that are currently in use. This is
* intended to be used solely for debugging purposes to track down
* issues with objects leaking.
*/
function debug_object_print_instances(): void;
/**
* Makes a copy of `error` which can later be freed using
* cogl_error_free().
* @param error A #CoglError thrown by the Cogl api
* @returns A newly allocated #CoglError initialized to match the contents of @error.
*/
function error_copy(error: GLib.Error): GLib.Error;
/**
* Frees a #CoglError and associated resources.
* @param error A #CoglError thrown by the Cogl api
*/
function error_free(error: GLib.Error): void;
/**
* Returns %TRUE if error matches `domain` and `code,` %FALSE otherwise.
* In particular, when error is %NULL, FALSE will be returned.
* @param error A #CoglError thrown by the Cogl api or %NULL
* @param domain The error domain
* @param code The error code
* @returns whether the @error corresponds to the given @domain and @code.
*/
function error_matches(error: GLib.Error, domain: number, code: number): Bool;
/**
* Compares the two given euler angles `v1` and `v1` and it they are
* equal returns %TRUE else %FALSE.
*
* This function only checks that all three components rotations
* are numerically equal, it does not consider that some rotations
* can be represented with different component rotations
* @param v1 The first euler angle to compare
* @param v2 The second euler angle to compare
* @returns %TRUE if @v1 and @v2 are equal else %FALSE.
*/
function euler_equal(v1?: any | null, v2?: any | null): Bool;
/**
* Iterates through all the context level features currently supported
* for a given `context` and for each feature `callback` is called.
* @param context A #CoglContext pointer
* @param callback A #CoglFeatureCallback called for each supported feature
*/
function foreach_feature(context: Context, callback: FeatureCallback): void;
function framebuffer_error_quark(): number;
/**
* Returns the current time value from Cogl's internal clock. This
* clock is used for measuring times such as the presentation time
* in a #CoglFrameInfo.
*
* This method is meant for converting timestamps retrieved from Cogl
* to other time systems, and is not meant to be used as a standalone
* timing system. For that reason, if this function is called without
* having retrieved a valid (non-zero) timestamp from Cogl first, it
* may return 0 to indicate that Cogl has no active internal clock.
* @param context a #CoglContext pointer
* @returns the time value for the Cogl clock, in nanoseconds from an arbitrary point in time, or 0 if Cogl doesn't have an active internal clock.
*/
function get_clock_time(context: Context): number;
/**
* Gets the current #CoglFramebuffer as set using
* cogl_push_framebuffer()
* @returns The current #CoglFramebuffer
*/
function get_draw_framebuffer(): Framebuffer;
/**
* Returns a pointer to a singleton quaternion constant describing the
* canonical identity [1 (0, 0, 0)] which represents no rotation.
*
* If you multiply a quaternion with the identity quaternion you will
* get back the same value as the original quaternion.
* @returns A pointer to an identity quaternion
*/
function get_static_identity_quaternion(): Quaternion;
function get_static_zero_quaternion(): Quaternion;
/**
* Gets an OpenGL ES 2.0 texture handle for a #CoglTexture that can
* then be referenced by a #CoglGLES2Context. As well as returning
* a texture handle the texture's target (such as GL_TEXTURE_2D) is
* also returned.
*
* If the #CoglTexture can not be shared with a #CoglGLES2Context then
* this function will return %FALSE.
*
* This api does not affect the lifetime of the CoglTexture and you
* must take care not to reference the returned handle after the
* original texture has been freed.
*
* This interface is only intended for sharing textures to read
* from. The behaviour is undefined if the texture is modified by a
* GLES2 context.
*
* This function will only return %TRUE for low-level
* #CoglTextures such as #CoglTexture2D or #CoglTexture3D but
* not for high level meta textures such as
* #CoglTexture2DSliced
*
* The handle returned should not be passed directly to a system
* OpenGL ES 2.0 library, the handle is only intended to be used via
* a #CoglGLES2Vtable or via libcogl-gles2.
* @param texture A #CoglTexture
* @param handle A return location for an OpenGL ES 2.0 texture handle
* @param target A return location for an OpenGL ES 2.0 texture target
* @returns %TRUE if a handle and target could be returned otherwise %FALSE is returned.
*/
function gles2_texture_get_handle(texture: Texture, handle: number, target: number): Bool;
/**
* Creates a #GSource which handles Cogl's internal system event
* processing. This can be used as a convenience instead of
* cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in
* applications that are already using the GLib main loop. After this
* is called the #GSource should be attached to the main loop using
* g_source_attach().
* @param renderer A #CoglRenderer
* @param priority The priority of the #GSource
* @returns a new #GSource
*/
function glib_renderer_source_new(renderer: Renderer, priority: number): GLib.Source;
/**
* Creates a #GSource which handles Cogl's internal system event
* processing. This can be used as a convenience instead of
* cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in
* applications that are already using the GLib main loop. After this
* is called the #GSource should be attached to the main loop using
* g_source_attach().
*
* Applications that manually connect to a #CoglRenderer before they
* create a #CoglContext should instead use
* cogl_glib_renderer_source_new() so that events may be dispatched
* before a context has been created. In that case you don't need to
* use this api in addition later, it is simply enough to use
* cogl_glib_renderer_source_new() instead.
*
* This api is actually just a thin convenience wrapper around
* cogl_glib_renderer_source_new()
* @param context A #CoglContext
* @param priority The priority of the #GSource
* @returns a new #GSource
*/
function glib_source_new(context: Context, priority: number): GLib.Source;
function gtype_matrix_get_type(): GObject.GType;
function handle_get_type(): GObject.GType;
/**
* Increases the reference count of `handle` by 1
* @param handle a #CoglHandle
* @returns the handle, with its reference count increased
*/
function handle_ref(handle: Handle): Handle;
/**
* Drecreases the reference count of `handle` by 1; if the reference
* count reaches 0, the resources allocated by `handle` will be freed
* @param handle a #CoglHandle
*/
function handle_unref(handle: Handle): void;
/**
* Checks if a given `feature` is currently available
*
* Cogl does not aim to be a lowest common denominator API, it aims to
* expose all the interesting features of GPUs to application which
* means applications have some responsibility to explicitly check
* that certain features are available before depending on them.
* @param context A #CoglContext pointer
* @param feature A #CoglFeatureID
* @returns %TRUE if the @feature is currently supported or %FALSE if not.
*/
function has_feature(context: Context, feature: FeatureID | null): Bool;
/**
* Checks whether the given object references a #CoglAtlasTexture
* @param object a #CoglObject
* @returns %TRUE if the passed object represents an atlas texture and %FALSE otherwise
*/
function is_atlas_texture(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglAttribute.
* @param object A #CoglObject
* @returns %TRUE if the @object references a #CoglAttribute, %FALSE otherwise
*/
function is_attribute(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglAttributeBuffer.
* @param object A #CoglObject
* @returns %TRUE if @object references a #CoglAttributeBuffer, %FALSE otherwise
*/
function is_attribute_buffer(object?: any | null): Bool;
/**
* Checks whether `object` is a #CoglBitmap
* @param object a #CoglObject pointer
* @returns %TRUE if the passed @object represents a bitmap, and %FALSE otherwise
*/
function is_bitmap(object?: any | null): Bool;
/**
* Checks whether `buffer` is a buffer object.
* @param object a buffer object
* @returns %TRUE if the handle is a CoglBuffer, and %FALSE otherwise
*/
function is_buffer(object?: any | null): Bool;
/**
* Gets whether the given object references an existing context object.
* @param object An object or %NULL
* @returns %TRUE if the @object references a #CoglContext, %FALSE otherwise
*/
function is_context(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglDisplay.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglDisplay and %FALSE otherwise.
*/
function is_display(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglFrameInfo.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglFrameInfo and %FALSE otherwise.
*/
function is_frame_info(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglFramebuffer.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglFramebuffer and %FALSE otherwise.
*/
function is_framebuffer(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglGLES2Context.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglGLES2Context and %FALSE otherwise.
*/
function is_gles2_context(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglIndexBuffer.
* @param object A #CoglObject
* @returns %TRUE if the @object references a #CoglIndexBuffer, %FALSE otherwise
*/
function is_index_buffer(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglIndices.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglIndices and %FALSE otherwise.
*/
function is_indices(object?: any | null): Bool;
/**
* Determines if the given #CoglObject refers to a #CoglMatrixStack.
* @param object a #CoglObject
* @returns %TRUE if @object is a #CoglMatrixStack, otherwise %FALSE.
*/
function is_matrix_stack(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglOnscreen.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglOnscreen and %FALSE otherwise.
*/
function is_onscreen(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglOnscreenTemplate.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglOnscreenTemplate and %FALSE otherwise.
*/
function is_onscreen_template(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglOutput.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglOutput and %FALSE otherwise.
*/
function is_output(object?: any | null): Bool;
/**
* Gets whether the given `object` references an existing pipeline object.
* @param object A #CoglObject
* @returns %TRUE if the @object references a #CoglPipeline, %FALSE otherwise
*/
function is_pipeline(object?: any | null): Bool;
/**
* Checks whether `object` is a pixel buffer.
* @param object a #CoglObject to test
* @returns %TRUE if the @object is a pixel buffer, and %FALSE otherwise
*/
function is_pixel_buffer(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglPrimitive.
* @param object A #CoglObject
* @returns %TRUE if the @object references a #CoglPrimitive, %FALSE otherwise
*/
function is_primitive(object?: any | null): Bool;
/**
* Gets whether the given object references a primitive texture object.
* @param object A #CoglObject pointer
* @returns %TRUE if the pointer references a primitive texture, and %FALSE otherwise
*/
function is_primitive_texture(object?: any | null): Bool;
/**
* Determines if the given `object` is a #CoglRenderer
* @param object A #CoglObject pointer
* @returns %TRUE if @object is a #CoglRenderer, else %FALSE.
*/
function is_renderer(object?: any | null): Bool;
/**
* Gets whether the given `object` references an existing snippet object.
* @param object A #CoglObject pointer
* @returns %TRUE if the @object references a #CoglSnippet, %FALSE otherwise
*/
function is_snippet(object?: any | null): Bool;
/**
* Checks whether `object` is a #CoglSubTexture.
* @param object a #CoglObject
* @returns %TRUE if the passed @object represents a #CoglSubTexture and %FALSE otherwise.
*/
function is_sub_texture(object?: any | null): Bool;
function is_swap_chain(object?: any | null): Bool;
/**
* Gets whether the given object references a texture object.
* @param object A #CoglObject pointer
* @returns %TRUE if the @object references a texture, and %FALSE otherwise
*/
function is_texture(object?: any | null): Bool;
/**
* Gets whether the given object references an existing #CoglTexture2D
* object.
* @param object A #CoglObject
* @returns %TRUE if the object references a #CoglTexture2D, %FALSE otherwise
*/
function is_texture_2d(object?: any | null): Bool;
/**
* Gets whether the given object references a #CoglTexture2DSliced.
* @param object A #CoglObject pointer
* @returns %TRUE if the object references a #CoglTexture2DSliced and %FALSE otherwise.
*/
function is_texture_2d_sliced(object?: any | null): Bool;
/**
* Checks whether the given object references a #CoglTexture3D
* @param object a #CoglObject
* @returns %TRUE if the passed object represents a 3D texture and %FALSE otherwise
*/
function is_texture_3d(object?: any | null): Bool;
/**
* Checks whether `object` points to a #CoglTexturePixmapX11 instance.
* @param object A pointer to a #CoglObject
* @returns %TRUE if the object is a #CoglTexturePixmapX11, and %FALSE otherwise
*/
function is_texture_pixmap_x11(object?: any | null): Bool;
/**
* Gets whether the given object references an existing
* #CoglTextureRectangle object.
* @param object A #CoglObject
* @returns %TRUE if the object references a #CoglTextureRectangle, %FALSE otherwise.
*/
function is_texture_rectangle(object?: any | null): Bool;
/**
* Asks Cogl to explicitly reset the crtc output modes at the next
* #CoglOnscreen swap_buffers request. For applications that support
* VT switching they may want to re-assert the output modes when
* switching back to the applications VT since the modes are often not
* correctly restored automatically.
*
* The `display` must have been either explicitly setup via
* cogl_display_setup() or implicitily setup by having created a
* context using the `display<`/note>
* @param display A #CoglDisplay
*/
function kms_display_queue_modes_reset(display: Display): void;
/**
* Tells cogl to ignore (or stop ignoring) a ctrc which means
* it never flips buffers at this crtc.
* @param display
* @param id KMS output id
* @param ignore Ignore ouput or not
*/
function kms_display_set_ignore_crtc(display: Display, id: number, ignore: Bool): void;
/**
* Configures `display` to use a framebuffer sized `width` x `height,` covering
* the CRTCS in `crtcs`.
* `width` and `height` must be within the driver framebuffer limits, and `crtcs`
* must be valid KMS API IDs.
*
* Calling this function overrides the automatic mode setting done by Cogl,
* and for this reason must be called before the first call to cogl_onscreen_swap_buffers().
*
* If you want to restore the default behaviour, you can call this function
* with `width` and `height` set to -1.
* @param display
* @param width the framebuffer width
* @param height the framebuffer height
* @param crtcs the array of #CoglKmsCrtc structure with the desired CRTC layout
* @param n_crtcs
*/
function kms_display_set_layout(
display: Display,
width: number,
height: number,
crtcs: KmsCrtc,
n_crtcs: number,
): Bool;
function kms_renderer_get_gbm(renderer: Renderer): any | null;
/**
* Queries the file descriptor Cogl is using internally for
* communicating with the kms driver.
* @param renderer A #CoglRenderer
* @returns The kms file descriptor or -1 if no kms file desriptor has been opened by Cogl.
*/
function kms_renderer_get_kms_fd(renderer: Renderer): number;
/**
* Sets the file descriptor Cogl should use to communicate
* to the kms driver. If -1 (the default), then Cogl will
* open its own FD by trying to open "/dev/dri/card0".
* @param renderer A #CoglRenderer
* @param fd The fd to kms to use
*/
function kms_renderer_set_kms_fd(renderer: Renderer, fd: number): void;
/**
* Compares two matrices to see if they represent the same
* transformation. Although internally the matrices may have different
* annotations associated with them and may potentially have a cached
* inverse matrix these are not considered in the comparison.
* @param v1 A 4x4 transformation matrix
* @param v2 A 4x4 transformation matrix
*/
function matrix_equal(v1?: any | null, v2?: any | null): Bool;
/**
* This should be called whenever an application is woken up from
* going idle in its main loop. The `poll_fds` array should contain a
* list of file descriptors matched with the events that occurred in
* revents. The events field is ignored. It is safe to pass in extra
* file descriptors that Cogl didn't request when calling
* cogl_poll_renderer_get_info() or a shorter array missing some file
* descriptors that Cogl requested.
*
* If your application didn't originally create a #CoglRenderer
* manually then you can easily get a #CoglRenderer pointer by calling
* cogl_get_renderer().
* @param renderer A #CoglRenderer
* @param poll_fds An array of #CoglPollFDs describing the events that have occurred since the application went idle.
* @param n_poll_fds The length of the @poll_fds array.
*/
function poll_renderer_dispatch(renderer: Renderer, poll_fds: PollFD, n_poll_fds: number): void;
/**
* Is used to integrate Cogl with an application mainloop that is based
* on the unix poll(2) api (or select() or something equivalent). This
* api should be called whenever an application is about to go idle so
* that Cogl has a chance to describe what file descriptor events it
* needs to be woken up for.
*
* If your application is using the Glib mainloop then you
* should jump to the cogl_glib_source_new() api as a more convenient
* way of integrating Cogl with the mainloop.
*
* After the function is called *`poll_fds` will contain a pointer to
* an array of #CoglPollFD structs describing the file descriptors
* that Cogl expects. The fd and events members will be updated
* accordingly. After the application has completed its idle it is
* expected to either update the revents members directly in this
* array or to create a copy of the array and update them
* there.
*
* When the application mainloop returns from calling poll(2) (or its
* equivalent) then it should call cogl_poll_renderer_dispatch()
* passing a pointer the array of CoglPollFDs with updated
* revent values.
*
* When using the %COGL_WINSYS_ID_WGL winsys (where file descriptors
* don't make any sense) or %COGL_WINSYS_ID_SDL (where the event
* handling functions of SDL don't allow blocking on a file
* descriptor) *n_poll_fds is guaranteed to be zero.
*
* `timeout` will contain a maximum amount of time to wait in
* microseconds before the application should wake up or -1 if the
* application should wait indefinitely. This can also be 0 if
* Cogl needs to be woken up immediately.
* @param renderer A #CoglRenderer
* @param poll_fds A return location for a pointer to an array of #CoglPollFDs
* @param n_poll_fds A return location for the number of entries in *@poll_fds
* @param timeout A return location for the maximum length of time to wait in microseconds, or -1 to wait indefinitely.
* @returns A "poll fd state age" that changes whenever the set of poll_fds has changed. If this API is being used to integrate with another system mainloop api then knowing if the set of file descriptors and events has really changed can help avoid redundant work depending the api. The age isn't guaranteed to change when the timeout changes.
*/
function poll_renderer_get_info(
renderer: Renderer,
poll_fds: PollFD,
n_poll_fds: number,
timeout: number,
): number;
/**
* Restores the previously active #CoglGLES2Context if there
* were nested calls to cogl_push_gles2_context() or otherwise
* restores the ability to render with the Cogl api instead
* of OpenGLES 2.0.
*
* The behaviour is undefined if calls to cogl_pop_gles2_context()
* are not balenced with the number of corresponding calls to
* cogl_push_gles2_context().
* @param ctx A #CoglContext
*/
function pop_gles2_context(ctx: Context): void;
/**
* Pushes the given `gles2`_ctx onto a stack associated with `ctx` so
* that the OpenGLES 2.0 api can be used instead of the Cogl
* rendering apis to read and write to the specified framebuffers.
*
* Usage of the api available through a #CoglGLES2Vtable is only
* allowed between cogl_push_gles2_context() and
* cogl_pop_gles2_context() calls.
*
* If there is a runtime problem with switching over to the given
* `gles2`_ctx then this function will return %FALSE and return
* an error through `error`.
* @param ctx A #CoglContext
* @param gles2_ctx A #CoglGLES2Context allocated with cogl_gles2_context_new()
* @param read_buffer A #CoglFramebuffer to access to read operations such as glReadPixels. (must be a #CoglOffscreen framebuffer currently)
* @param write_buffer A #CoglFramebuffer to access for drawing operations such as glDrawArrays. (must be a #CoglOffscreen framebuffer currently)
* @returns %TRUE if operation was successfull or %FALSE otherwise and @error will be updated.
*/
function push_gles2_context(
ctx: Context,
gles2_ctx: GLES2Context,
read_buffer: Framebuffer,
write_buffer: Framebuffer,
): Bool;
/**
* Compares that all the components of quaternions `a` and `b` are
* equal.
*
* An epsilon value is not used to compare the float components, but
* the == operator is at least used so that 0 and -0 are considered
* equal.
* @param v1 A #CoglQuaternion
* @param v2 A #CoglQuaternion
* @returns %TRUE if the quaternions are equal else %FALSE.
*/
function quaternion_equal(v1?: any | null, v2?: any | null): Bool;
function renderer_error_quark(): number;
function texture_error_quark(): number;
/**
* Adds each of the corresponding components in vectors `a` and `b`
* storing the results in `result`.
* @param result Where you want the result written
* @param a The first vector operand
* @param b The second vector operand
*/
function vector3_add(result: number, a: number, b: number): void;
/**
* Allocates a new 3 component float vector on the heap initializing
* the components from the given `vector` and returns a pointer to the
* newly allocated vector. You should free the memory using
* cogl_vector3_free()
* @param vector The 3 component vector you want to copy
* @returns A newly allocated 3 component float vector
*/
function vector3_copy(vector: number): number;
/**
* Calculates the cross product between the two vectors `u` and `v`.
*
* The cross product is a vector perpendicular to both `u` and `v`. This
* can be useful for calculating the normal of a polygon by creating
* two vectors in its plane using the polygons vertices and taking
* their cross product.
*
* If the two vectors are parallel then the cross product is 0.
*
* You can use a right hand rule to determine which direction the
* perpendicular vector will point: If you place the two vectors tail,
* to tail and imagine grabbing the perpendicular line that extends
* through the common tail with your right hand such that you fingers
* rotate in the direction from `u` to `v` then the resulting vector
* points along your extended thumb.
* @param result Where you want the result written
* @param u Your first 3 component vector
* @param v Your second 3 component vector
*/
function vector3_cross_product(result: number, u: number, v: number): void;
/**
* If you consider the two given vectors as (x,y,z) points instead
* then this will compute the distance between those two points.
* @param a The first point
* @param b The second point
* @returns The distance between two points given as 3 component vectors.
*/
function vector3_distance(a: number, b: number): number;
/**
* Divides each of the `vector` components by the given scalar.
* @param vector The 3 component vector you want to manipulate
* @param scalar The scalar you want to divide the vector components by
*/
function vector3_divide_scalar(vector: number, scalar: number): void;
/**
* Calculates the dot product of the two 3 component vectors. This
* can be used to determine the magnitude of one vector projected onto
* another. (for example a surface normal)
*
* For example if you have a polygon with a given normal vector and
* some other point for which you want to calculate its distance from
* the polygon, you can create a vector between one of the polygon
* vertices and that point and use the dot product to calculate the
* magnitude for that vector but projected onto the normal of the
* polygon. This way you don't just get the distance from the point to
* the edge of the polygon you get the distance from the point to the
* nearest part of the polygon.
*
* If you don't use a unit length normal in the above example
* then you would then also have to divide the result by the magnitude
* of the normal
*
* The dot product is calculated as:
*
* ```
* (a->x * b->x + a->y * b->y + a->z * b->z)
* ```
*
*
* For reference, the dot product can also be calculated from the
* angle between two vectors as:
*
* ```
* |a||b|cos𝜃
* ```
*
* @param a Your first 3 component vector
* @param b Your second 3 component vector
* @returns The dot product of two vectors.
*/
function vector3_dot_product(a: number, b: number): number;
/**
* Compares the components of two vectors and returns TRUE if they are
* the same.
*
* The comparison of the components is done with the '==' operator
* such that -0 is considered equal to 0, but otherwise there is no
* fuzziness such as an epsilon to consider vectors that are
* essentially identical except for some minor precision error
* differences due to the way they have been manipulated.
* @param v1 The first 3 component vector you want to compare
* @param v2 The second 3 component vector you want to compare
* @returns TRUE if the vectors are equal else FALSE.
*/
function vector3_equal(v1?: any | null, v2?: any | null): Bool;
/**
* Compares the components of two vectors using the given epsilon and
* returns TRUE if they are the same, using an internal epsilon for
* comparing the floats.
*
* Each component is compared against the epsilon value in this way:
*
* ```
* if (fabsf (vector0->x - vector1->x) < epsilon)
* ```
*
* @param vector0 The first 3 component vector you want to compare
* @param vector1 The second 3 component vector you want to compare
* @param epsilon The allowable difference between components to still be considered equal
* @returns TRUE if the vectors are equal else FALSE.
*/
function vector3_equal_with_epsilon(vector0: number, vector1: number, epsilon: number): Bool;
/**
* Frees a 3 component vector that was previously allocated with
* cogl_vector3_copy()
* @param vector The 3 component you want to free
*/
function vector3_free(vector: number): void;
/**
* Initializes a 3 component, single precision float vector which can
* then be manipulated with the cogl_vector convenience APIs. Vectors
* can also be used in places where a "point" is often desired.
* @param vector The 3 component vector you want to initialize
* @param x The x component
* @param y The y component
* @param z The z component
*/
function vector3_init(vector: number, x: number, y: number, z: number): void;
/**
* Initializes a 3 component, single precision float vector with zero
* for each component.
* @param vector The 3 component vector you want to initialize
*/
function vector3_init_zero(vector: number): void;
/**
* Inverts/negates all the components of the given `vector`.
* @param vector The 3 component vector you want to manipulate
*/
function vector3_invert(vector: number): void;
/**
* Calculates the scalar magnitude or length of `vector`.
* @param vector The 3 component vector you want the magnitude for
* @returns The magnitude of @vector.
*/
function vector3_magnitude(vector: number): number;
/**
* Multiplies each of the `vector` components by the given scalar.
* @param vector The 3 component vector you want to manipulate
* @param scalar The scalar you want to multiply the vector components by
*/
function vector3_multiply_scalar(vector: number, scalar: number): void;
/**
* Updates the vector so it is a "unit vector" such that the
* `vector<`!-- -->s magnitude or length is equal to 1.
*
* It's safe to use this function with the [0, 0, 0] vector, it will not
* try to divide components by 0 (its norm) and will leave the vector
* untouched.
* @param vector The 3 component vector you want to manipulate
*/
function vector3_normalize(vector: number): void;
/**
* Subtracts each of the corresponding components in vector `b` from
* `a` storing the results in `result`.
* @param result Where you want the result written
* @param a The first vector operand
* @param b The second vector operand
*/
function vector3_subtract(result: number, a: number, b: number): void;
/**
* Informs Cogl of a compositor's Wayland display pointer. This
* enables Cogl to register private wayland extensions required to
* pass buffers between the clients and compositor.
* @param display a #CoglDisplay
* @param wayland_display A compositor's Wayland display pointer
*/
function wayland_display_set_compositor_display(display: Display, wayland_display?: any | null): void;
function wayland_onscreen_get_shell_surface(onscreen: Onscreen): any | null;
function wayland_onscreen_get_surface(onscreen: Onscreen): any | null;
/**
* Resizes the backbuffer of the given `onscreen` framebuffer to the
* given size. Since a buffer is usually conceptually scaled with a
* center point the `offset_x` and `offset_y` arguments allow the newly
* allocated buffer to be positioned relative to the old buffer size.
*
* For example a buffer that is being resized by moving the bottom right
* corner, and the top left corner is remaining static would use x and y
* offsets of (0, 0) since the top-left of the new buffer should have the same
* position as the old buffer. If the center of the old buffer is being zoomed
* into then all the corners of the new buffer move out from the center and the x
* and y offsets would be (-half_x_size_increase, -half_y_size_increase) where
* x/y_size_increase is how many pixels bigger the buffer is on the x and y
* axis.
*
* Note that if some drawing commands have been applied to the
* framebuffer since the last swap buffers then the resize will be
* queued and will only take effect in the next swap buffers.
*
* If multiple calls to cogl_wayland_onscreen_resize() get queued
* before the next swap buffers request then the relative x and y
* offsets accumulate instead of being replaced. The `width` and
* `height` values superseed the old values.
* @param onscreen A #CoglOnscreen framebuffer
* @param width The desired width of the framebuffer
* @param height The desired height of the framebuffer
* @param offset_x A relative x offset for the new framebuffer
* @param offset_y A relative y offset for the new framebuffer
*/
function wayland_onscreen_resize(
onscreen: Onscreen,
width: number,
height: number,
offset_x: number,
offset_y: number,
): void;
/**
* Allows you to explicitly notify Cogl of an existing Wayland surface to use,
* which prevents Cogl from allocating a surface and shell surface for the
* `onscreen`. An allocated surface will not be destroyed when the `onscreen` is
* freed.
*
* This function must be called before `onscreen` is allocated.
* @param onscreen An unallocated framebuffer. @surface A Wayland surface to associate with the @onscreen.
* @param surface
*/
function wayland_onscreen_set_foreign_surface(onscreen: Onscreen, surface?: any | null): void;
/**
* Retrieves the Wayland display that Cogl is using. If a foreign
* display has been specified using
* cogl_wayland_renderer_set_foreign_display() then that display will
* be returned. If no foreign display has been specified then the
* display that Cogl creates internally will be returned unless the
* renderer has not yet been connected (either implicitly or explicitly by
* calling cogl_renderer_connect()) in which case %NULL is returned.
* @param renderer A #CoglRenderer
* @returns The wayland display currently associated with @renderer, or %NULL if the renderer hasn't yet been connected and no foreign display has been specified.
*/
function wayland_renderer_get_display(renderer: Renderer): any | null;
/**
* Sets whether Cogl should handle calling wl_display_dispatch() and
* wl_display_flush() as part of its main loop integration via
* cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch().
* The default value is %TRUE. When it is enabled the application can
* register listeners for Wayland interfaces and the callbacks will be
* invoked during cogl_poll_renderer_dispatch(). If the application
* wants to integrate with its own code that is already handling
* reading from the Wayland display socket, it should disable this to
* avoid having competing code read from the socket.
* @param renderer A #CoglRenderer
* @param enable The new value
*/
function wayland_renderer_set_event_dispatch_enabled(renderer: Renderer, enable: Bool): void;
/**
* Allows you to explicitly control what Wayland display you want Cogl
* to work with instead of leaving Cogl to automatically connect to a
* wayland compositor.
* @param renderer A #CoglRenderer
* @param display A Wayland display
*/
function wayland_renderer_set_foreign_display(renderer: Renderer, display?: any | null): void;
/**
* Sets the pixels in a rectangular subregion of `texture` from a
* Wayland SHM buffer. Generally this would be used in response to
* wl_surface.damage event in a compositor in order to update the
* texture with the damaged region. This is just a convenience wrapper
* around getting the SHM buffer pointer and calling
* cogl_texture_set_region(). See that function for a description of
* the level parameter.
*
* Since the storage for a #CoglTexture is allocated lazily then
* if the given `texture` has not previously been allocated then this
* api can return %FALSE and throw an exceptional `error` if there is
* not enough memory to allocate storage for `texture`.
* @param texture a #CoglTexture
* @param src_x The X offset within the source bufer to copy from
* @param src_y The Y offset within the source bufer to copy from
* @param width The width of the region to copy
* @param height The height of the region to copy
* @param shm_buffer The source buffer
* @param dst_x The X offset within the texture to copy to
* @param dst_y The Y offset within the texture to copy to
* @param level The mipmap level of the texture to copy to
* @returns %TRUE if the subregion upload was successful, and %FALSE otherwise
*/
function wayland_texture_set_region_from_shm_buffer(
texture: Texture,
src_x: number,
src_y: number,
width: number,
height: number,
shm_buffer: any | null,
dst_x: number,
dst_y: number,
level: number,
): Bool;
function x11_onscreen_get_visual_xid(onscreen: Onscreen): number;
/**
* Assuming you know the given `onscreen` framebuffer is based on an x11 window
* this queries the XID of that window. If
* cogl_x11_onscreen_set_foreign_window_xid() was previously called then it
* will return that same XID otherwise it will be the XID of a window Cogl
* created internally. If the window has not been allocated yet and a foreign
* xid has not been set then it's undefined what value will be returned.
*
* It's undefined what this function does if called when not using an x11 based
* renderer.
* @param onscreen A #CoglOnscreen framebuffer
*/
function x11_onscreen_get_window_xid(onscreen: Onscreen): number;
interface DebugObjectForeachTypeCallback {
(info: DebugObjectTypeInfo): void;
}
interface FeatureCallback {
(feature: FeatureID): void;
}
interface FenceCallback {
(fence: Fence): void;
}
interface FrameCallback {
(onscreen: Onscreen, event: FrameEvent, info: FrameInfo): void;
}
interface FuncPtr {
(): void;
}
interface MetaTextureCallback {
(sub_texture: Texture, sub_texture_coords: number, meta_coords: number): void;
}
interface OnscreenDirtyCallback {
(onscreen: Onscreen, info: OnscreenDirtyInfo): void;
}
interface OnscreenResizeCallback {
(onscreen: Onscreen, width: number, height: number): void;
}
interface OnscreenX11MaskCallback {
(onscreen: Onscreen, event_mask: number): void;
}
interface OutputCallback {
(output: Output): void;
}
interface PipelineLayerCallback {
(pipeline: Pipeline, layer_index: number): Bool;
}
interface PrimitiveAttributeCallback {
(primitive: Primitive, attribute: Attribute): Bool;
}
interface SwapBuffersNotify {
(framebuffer: Framebuffer): void;
}
/**
* The access hints for cogl_buffer_set_update_hint()
*/
/**
* The access hints for cogl_buffer_set_update_hint()
*/
export namespace BufferAccess {
export const $gtype: GObject.GType;
}
enum BufferAccess {
/**
* the buffer will be read
*/
READ,
/**
* the buffer will written to
*/
WRITE,
/**
* the buffer will be used for both reading and
* writing
*/
READ_WRITE,
}
/**
* Types of auxiliary buffers
*/
/**
* Types of auxiliary buffers
*/
export namespace BufferBit {
export const $gtype: GObject.GType;
}
enum BufferBit {
/**
* Selects the primary color buffer
*/
COLOR,
/**
* Selects the depth buffer
*/
DEPTH,
/**
* Selects the stencil buffer
*/
STENCIL,
}
/**
* Hints to Cogl about how you are planning to modify the data once it
* is mapped.
*/
/**
* Hints to Cogl about how you are planning to modify the data once it
* is mapped.
*/
export namespace BufferMapHint {
export const $gtype: GObject.GType;
}
enum BufferMapHint {
/**
* Tells Cogl that you plan to replace
* all the buffer's contents. When this flag is used to map a
* buffer, the entire contents of the buffer become undefined, even
* if only a subregion of the buffer is mapped.
*/
'',
/**
* Tells Cogl that you plan to
* replace all the contents of the mapped region. The contents of
* the region specified are undefined after this flag is used to
* map a buffer.
*/
_RANGE,
}
/**
* Target flags for FBOs.
*/
/**
* Target flags for FBOs.
*/
export namespace BufferTarget {
export const $gtype: GObject.GType;
}
enum BufferTarget {
/**
* FIXME
*/
WINDOW_BUFFER,
/**
* FIXME
*/
OFFSCREEN_BUFFER,
}
/**
* Defines a bit mask of color channels. This can be used with
* cogl_pipeline_set_color_mask() for example to define which color
* channels should be written to the current framebuffer when
* drawing something.
*/
/**
* Defines a bit mask of color channels. This can be used with
* cogl_pipeline_set_color_mask() for example to define which color
* channels should be written to the current framebuffer when
* drawing something.
*/
export namespace ColorMask {
export const $gtype: GObject.GType;
}
enum ColorMask {
/**
* None of the color channels are masked
*/
NONE,
/**
* Masks the red color channel
*/
RED,
/**
* Masks the green color channel
*/
GREEN,
/**
* Masks the blue color channel
*/
BLUE,
/**
* Masks the alpha color channel
*/
ALPHA,
/**
* All of the color channels are masked
*/
ALL,
}
/**
* Flags for the supported features.
*/
/**
* Flags for the supported features.
*/
export namespace FeatureFlags {
export const $gtype: GObject.GType;
}
enum FeatureFlags {
/**
* ARB_texture_rectangle support
*/
TEXTURE_RECTANGLE,
/**
* Non power of two textures are supported
* by the hardware. This is a equivalent to the
* %COGL_FEATURE_TEXTURE_NPOT_BASIC, %COGL_FEATURE_TEXTURE_NPOT_MIPMAP
* and %COGL_FEATURE_TEXTURE_NPOT_REPEAT features combined.
*/
TEXTURE_NPOT,
/**
* ycbcr conversion support
*/
TEXTURE_YUV,
/**
* glReadPixels() support
*/
TEXTURE_READ_PIXELS,
/**
* GLSL support
*/
SHADERS_GLSL,
/**
* FBO support
*/
OFFSCREEN,
/**
* Multisample support on FBOs
*/
OFFSCREEN_MULTISAMPLE,
/**
* Blit support on FBOs
*/
OFFSCREEN_BLIT,
/**
* At least 4 clip planes available
*/
FOUR_CLIP_PLANES,
/**
* Stencil buffer support
*/
STENCIL_BUFFER,
/**
* VBO support
*/
VBOS,
/**
* PBO support
*/
PBOS,
/**
* Set if
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
* cogl_vertex_buffer_indices_new().
*/
UNSIGNED_INT_INDICES,
/**
* cogl_material_set_depth_range() support
*/
DEPTH_RANGE,
/**
* The hardware supports non power
* of two textures, but you also need to check the
* %COGL_FEATURE_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_TEXTURE_NPOT_REPEAT
* features to know if the hardware supports npot texture mipmaps
* or repeat modes other than
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
*/
TEXTURE_NPOT_BASIC,
/**
* Mipmapping is supported in
* conjuntion with non power of two textures.
*/
TEXTURE_NPOT_MIPMAP,
/**
* Repeat modes other than
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the
* hardware.
*/
TEXTURE_NPOT_REPEAT,
/**
* Whether
* cogl_material_set_layer_point_sprite_coords_enabled() is supported.
*/
POINT_SPRITE,
/**
* 3D texture support
*/
TEXTURE_3D,
/**
* ARBFP support
*/
SHADERS_ARBFP,
/**
* Whether cogl_buffer_map() is
* supported with CoglBufferAccess including read support.
*/
MAP_BUFFER_FOR_READ,
/**
* Whether cogl_buffer_map() is
* supported with CoglBufferAccess including write support.
*/
MAP_BUFFER_FOR_WRITE,
ONSCREEN_MULTIPLE,
/**
* Whether #CoglFramebuffer support rendering the
* depth buffer to a texture.
*/
DEPTH_TEXTURE,
}
/**
* Flags for cogl_framebuffer_read_pixels_into_bitmap()
*/
/**
* Flags for cogl_framebuffer_read_pixels_into_bitmap()
*/
export namespace ReadPixelsFlags {
export const $gtype: GObject.GType;
}
enum ReadPixelsFlags {
/**
* Read from the color buffer
*/
COLOR_BUFFER,
}
/**
* These constraint flags are hard-coded features of the different renderer
* backends. Sometimes a platform may support multiple rendering options which
* Cogl will usually choose from automatically. Some of these features are
* important to higher level applications and frameworks though, such as
* whether a renderer is X11 based because an application might only support
* X11 based input handling. An application might also need to ensure EGL is
* used internally too if they depend on access to an EGLDisplay for some
* purpose.
*
* Applications should ideally minimize how many of these constraints
* they depend on to ensure maximum portability.
*/
/**
* These constraint flags are hard-coded features of the different renderer
* backends. Sometimes a platform may support multiple rendering options which
* Cogl will usually choose from automatically. Some of these features are
* important to higher level applications and frameworks though, such as
* whether a renderer is X11 based because an application might only support
* X11 based input handling. An application might also need to ensure EGL is
* used internally too if they depend on access to an EGLDisplay for some
* purpose.
*
* Applications should ideally minimize how many of these constraints
* they depend on to ensure maximum portability.
*/
export namespace RendererConstraint {
export const $gtype: GObject.GType;
}
enum RendererConstraint {
/**
* Require the renderer to be X11 based
*/
USES_X11,
/**
* Require the renderer to be X11
* based and use Xlib
*/
USES_XLIB,
/**
* Require the renderer to be EGL based
*/
USES_EGL,
/**
* Require that the
* renderer supports creating a #CoglGLES2Context via
* cogl_gles2_context_new(). This can be used to integrate GLES 2.0
* code into Cogl based applications.
*/
SUPPORTS_COGL_GLES2,
}
/**
* Flags to pass to the cogl_texture_new_* family of functions.
*/
/**
* Flags to pass to the cogl_texture_new_* family of functions.
*/
export namespace TextureFlags {
export const $gtype: GObject.GType;
}
enum TextureFlags {
/**
* No flags specified
*/
NONE,
/**
* Disables the automatic generation of
* the mipmap pyramid from the base level image whenever it is
* updated. The mipmaps are only generated when the texture is
* rendered with a mipmap filter so it should be free to leave out
* this flag when using other filtering modes
*/
NO_AUTO_MIPMAP,
/**
* Disables the slicing of the texture
*/
NO_SLICING,
/**
* Disables the insertion of the texture inside
* the texture atlas used by Cogl
*/
NO_ATLAS,
}
class AtlasTexture extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static new_from_bitmap(bmp: Bitmap): AtlasTexture;
static new_from_data(
ctx: Context,
width: number,
height: number,
format: PixelFormat,
rowstride: number,
data: number,
): AtlasTexture;
static new_from_file(ctx: Context, filename: string): AtlasTexture;
static new_with_size(ctx: Context, width: number, height: number): AtlasTexture;
}
class Attribute extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](
attribute_buffer: AttributeBuffer,
name: string,
stride: number,
offset: number,
components: number,
type: AttributeType,
): Attribute;
static new_const_1f(context: Context, name: string, value: number): Attribute;
static new_const_2f(context: Context, name: string, component0: number, component1: number): Attribute;
static new_const_2fv(context: Context, name: string, value: number): Attribute;
static new_const_2x2fv(context: Context, name: string, matrix2x2: number, transpose: Bool): Attribute;
static new_const_3f(
context: Context,
name: string,
component0: number,
component1: number,
component2: number,
): Attribute;
static new_const_3fv(context: Context, name: string, value: number): Attribute;
static new_const_3x3fv(context: Context, name: string, matrix3x3: number, transpose: Bool): Attribute;
static new_const_4f(
context: Context,
name: string,
component0: number,
component1: number,
component2: number,
component3: number,
): Attribute;
static new_const_4fv(context: Context, name: string, value: number): Attribute;
static new_const_4x4fv(context: Context, name: string, matrix4x4: number, transpose: Bool): Attribute;
// Methods
get_buffer(): AttributeBuffer;
get_normalized(): Bool;
/**
* Sets a new #CoglAttributeBuffer for the attribute.
* @param attribute_buffer A #CoglAttributeBuffer
*/
set_buffer(attribute_buffer: AttributeBuffer): void;
/**
* Sets whether fixed point attribute types are mapped to the range
* 0→1. For example when this property is TRUE and a
* %COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE type is used then the value 255
* will be mapped to 1.0.
*
* The default value of this property depends on the name of the
* attribute. For the builtin properties cogl_color_in and
* cogl_normal_in it will default to TRUE and for all other names it
* will default to FALSE.
* @param normalized The new value for the normalized property.
*/
set_normalized(normalized: Bool): void;
}
class AttributeBuffer extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static new_with_size(context: Context, bytes: number): AttributeBuffer;
}
class Bitmap extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static new_for_data(
context: Context,
width: number,
height: number,
format: PixelFormat,
rowstride: number,
data: number,
): Bitmap;
static new_from_buffer(
buffer: Buffer,
format: PixelFormat,
width: number,
height: number,
rowstride: number,
offset: number,
): Bitmap;
static new_from_file(filename: string): Bitmap;
static new_with_size(context: Context, width: number, height: number, format: PixelFormat): Bitmap;
// Static methods
/**
* Parses an image file enough to extract the width and height
* of the bitmap.
* @param filename the file to check
*/
static get_size_from_file(filename: string): [Bool, number, number];
// Methods
get_buffer(): PixelBuffer;
get_format(): PixelFormat;
get_height(): number;
get_rowstride(): number;
get_width(): number;
}
class Context extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](display?: Display | null): Context;
// Methods
/**
* Retrieves the #CoglDisplay that is internally associated with the
* given `context`. This will return the same #CoglDisplay that was
* passed to cogl_context_new() or if %NULL was passed to
* cogl_context_new() then this function returns a pointer to the
* display that was automatically setup internally.
* @returns The #CoglDisplay associated with the given @context.
*/
get_display(): Display;
/**
* Retrieves the #CoglRenderer that is internally associated with the
* given `context`. This will return the same #CoglRenderer that was
* passed to cogl_display_new() or if %NULL was passed to
* cogl_display_new() or cogl_context_new() then this function returns
* a pointer to the renderer that was automatically connected
* internally.
* @returns The #CoglRenderer associated with the given @context.
*/
get_renderer(): Renderer;
}
class Display extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](renderer: Renderer, onscreen_template: OnscreenTemplate): Display;
// Methods
/**
* Queries the #CoglRenderer associated with the given `display`.
* @returns The associated #CoglRenderer
*/
get_renderer(): Renderer;
/**
* Specifies a template for creating #CoglOnscreen framebuffers.
*
* Depending on the system, the constraints for creating #CoglOnscreen
* framebuffers need to be known before setting up a #CoglDisplay because the
* final setup of the display may constrain how onscreen framebuffers may be
* allocated. If Cogl knows how an application wants to allocate onscreen
* framebuffers then it can try to make sure to setup the display accordingly.
* @param onscreen_template A template for creating #CoglOnscreen framebuffers
*/
set_onscreen_template(onscreen_template: OnscreenTemplate): void;
/**
* Explicitly sets up the given `display` object. Use of this api is
* optional since Cogl will internally setup the display if not done
* explicitly.
*
* When a display is first allocated via cogl_display_new() it is in a
* mutable configuration mode. This allows us to extend the apis
* available for configuring a display without requiring huge numbers
* of constructor arguments.
*
* Its possible to request a configuration that might not be
* supportable on the current system and so this api provides a means
* to apply the configuration explicitly but if it fails then an
* exception will be returned so you can handle the error gracefully
* and perhaps fall back to an alternative configuration.
*
* If you instead rely on Cogl implicitly calling cogl_display_setup()
* for you then if there is an error with the configuration you won't
* get an opportunity to handle that and the application may abort
* with a message. For simple applications that don't have any
* fallback options this behaviour may be fine.
* @returns Returns %TRUE if there was no error, else it returns %FALSE and returns an exception via @error.
*/
setup(): Bool;
}
/**
* Fixed point number using a (16.16) notation.
*/
class Fixed {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
}
class FrameInfo extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
// Methods
/**
* Gets the frame counter for the #CoglOnscreen that corresponds
* to this frame.
* @returns The frame counter value
*/
get_frame_counter(): number;
/**
* Gets the #CoglOutput that the swapped frame was presented to.
* @returns The #CoglOutput that the frame was presented to, or %NULL if this could not be determined.
*/
get_output(): Output;
/**
* Gets the presentation time for the frame. This is the time at which
* the frame became visible to the user.
*
* The presentation time measured in nanoseconds is based on a
* monotonic time source. The time source is not necessarily
* correlated with system/wall clock time and may represent the time
* elapsed since some undefined system event such as when the system
* last booted.
*
* Linux kernel version less that 3.8 can result in
* non-monotonic timestamps being reported when using a drm based
* OpenGL driver. Also some buggy Mesa drivers up to 9.0.1 may also
* incorrectly report non-monotonic timestamps.
* @returns the presentation time for the frame
*/
get_presentation_time(): number;
/**
* Gets the refresh rate in Hertz for the output that the frame was on
* at the time the frame was presented.
*
* Some platforms can't associate a #CoglOutput with a
* #CoglFrameInfo object but are able to report a refresh rate via
* this api. Therefore if you need this information then this api is
* more reliable than using cogl_frame_info_get_output() followed by
* cogl_output_get_refresh_rate().
* @returns the refresh rate in Hertz
*/
get_refresh_rate(): number;
}
/**
* Represents an OpenGLES 2.0 api context used as a sandbox for
* OpenGLES 2.0 state. This is comparable to an EGLContext for those
* who have used OpenGLES 2.0 with EGL before.
*/
class GLES2Context extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](ctx: Context): GLES2Context;
// Methods
/**
* Queries the OpenGLES 2.0 api function pointers that should be
* used for rendering with the given `gles2`_ctx.
*
* You should not try to directly link to and use the symbols
* provided by any system OpenGLES 2.0 driver.
* @returns A pointer to a #CoglGLES2Vtable providing pointers to functions for the full OpenGLES 2.0 api.
*/
get_vtable(): GLES2Vtable;
}
class IndexBuffer extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](context: Context, bytes: number): IndexBuffer;
}
class Indices extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](context: Context, type: IndicesType, indices_data: any | null, n_indices: number): Indices;
static new_for_buffer(type: IndicesType, buffer: IndexBuffer, offset: number): Indices;
// Methods
get_offset(): number;
get_type(): IndicesType;
set_offset(offset: number): void;
}
/**
* Tracks your current position within a hierarchy and lets you build
* up a graph of transformations as you traverse through a hierarchy
* such as a scenegraph.
*
* A #CoglMatrixStack always maintains a reference to a single
* transformation at any point in time, representing the
* transformation at the current position in the hierarchy. You can
* get a reference to the current transformation by calling
* cogl_matrix_stack_get_entry().
*
* When a #CoglMatrixStack is first created with
* cogl_matrix_stack_new() then it is conceptually positioned at the
* root of your hierarchy and the current transformation simply
* represents an identity transformation.
*
* As you traverse your object hierarchy (your scenegraph) then you
* should call cogl_matrix_stack_push() whenever you move down one
* level and call cogl_matrix_stack_pop() whenever you move back up
* one level towards the root.
*
* At any time you can apply a set of operations, such as "rotate",
* "scale", "translate" on top of the current transformation of a
* #CoglMatrixStack using functions such as
* cogl_matrix_stack_rotate(), cogl_matrix_stack_scale() and
* cogl_matrix_stack_translate(). These operations will derive a new
* current transformation and will never affect a transformation
* that you have referenced using cogl_matrix_stack_get_entry().
*
* Internally applying operations to a #CoglMatrixStack builds up a
* graph of #CoglMatrixEntry structures which each represent a single
* immutable transform.
*/
class MatrixStack extends Object {
static $gtype: GObject.GType;
// Constructors
_init(...args: any[]): void;
static ['new'](ctx: Context): MatrixStack;
// Methods
/**
* Replaces the current matrix with a perspective matrix for a given
* viewing frustum defined by 4 side clip planes that all cross
* through the origin and 2 near and far clip planes.
* @param left X position of the left clipping plane where it intersects the near clipping plane
* @param right X position of the right clipping plane where it intersects the near clipping plane
* @param bottom Y position of the bottom clipping plane where it intersects the near clipping plane
* @param top Y position of the top clipping plane where it intersects the near clipping plane
* @param z_near The distance to the near clipping plane (Must be positive)
* @param z_far The distance to the far clipping plane (Must be positive)
*/
frustum(left: number, right: number, bottom: number, top: number, z_near: number, z_far: number): void;
/**
* Resolves the current `stack` transform into a #CoglMatrix by
* combining the operations that have been applied to build up the
* current transform.
*
* There are two possible ways that this function may return its
* result depending on whether the stack is able to directly point
* to an internal #CoglMatrix or whether the result needs to be
* composed of multiple operations.
*
* If an internal matrix contains the required result then this
* function will directly return a pointer to that matrix, otherwise
* if the function returns %NULL then `matrix` will be initialized
* to match the current transform of `stack`.
*
* `matrix` will be left untouched if a direct pointer is
* returned.
* @returns A direct pointer to the current transform or %NULL and in that case @matrix will be initialized with the value of the current transform.
*/
get(): [Matrix, Matrix];
/**
* Gets a reference to the current transform represented by a
* #CoglMatrixEntry pointer.
*
* The transform represented by a #CoglMatrixEntry is
* immutable.
*
* #CoglMatrixEntrys are reference counted using
* cogl_matrix_entry_ref() and cogl_matrix_entry_unref() and you
* should call cogl_matrix_entry_unref() when you are finished with
* and entry you get via cogl_matrix_stack_get_entry().
* @returns A pointer to the #CoglMatrixEntry representing the current matrix stack transform.
*/
get_entry(): MatrixEntry;
/**
* Gets the inverse transform of the current matrix and uses it to
* initialize a new #CoglMatrix.
* @returns %TRUE if the inverse was successfully calculated or %FALSE for degenerate transformations that can't be inverted (in this case the @inverse matrix will simply be initialized with the identity matrix)
*/
get_inverse(): [Bool, Matrix];
/**
* Resets the current matrix to the identity matrix.
*/
load_identity(): void;
/**
* Multiplies the current matrix by the given matrix.
* @param matrix the matrix to multiply with the current model-view
*/
multiply(matrix: Matrix): void;
/**
* Replaces the current matrix with an orthographic projection matrix.
* @param x_1 The x coordinate for the first vertical clipping plane
* @param y_1 The y coordinate for the first horizontal clipping plane
* @param x_2 The x coordinate for the second vertical clipping plane
* @param y_2 The y coordinate for the second horizontal clipping plane
* @param near The distance to the near clipping plane (will be negative if the plane is behind the viewer)
* @param far The distance to the far clipping plane (will be negative if the plane is behind the viewer)
*/
orthographic(x_1: number, y_1: number, x_2: number, y_2: number, near: number, far: number): void;
/**
* Replaces the current matrix with a perspective matrix based on the
* provided values.
*
* You should be careful not to have too great a `z_far` / `z_near`
* ratio since that will reduce the effectiveness of depth testing
* since there wont be enough precision to identify the depth of
* objects near to each other.
* @param fov_y Vertical field of view angle in degrees.
* @param aspect The (width over height) aspect ratio for display
* @param z_near The distance to the near clipping plane (Must be positive, and must not be 0)
* @param z_far The distance to the far clipping plane (Must be positive)
*/
perspective(fov_y: number, aspect: number, z_near: number, z_far: number): void;
/**
* Restores the previous transform that was last saved by calling
* cogl_matrix_stack_push().
*
* This is usually called while traversing a scenegraph whenever you
* return up one level in the graph towards the root node.
*/
pop(): void;
/**
* Saves the current transform and starts a new transform that derives
* from the current transform.
*
* This is usually called while traversing a scenegraph whenever you
* traverse one level deeper. cogl_matrix_stack_pop() can then be
* called when going back up one layer to restore the previous
* transform of an ancestor.
*/
push(): void;
/**
* Multiplies the current matrix by one that rotates the around the
* axis-vector specified by `x,` `y` and `z`. The rotation follows the
* right-hand thumb rule so for example rotating by 10 degrees about
* the axis-vector (0, 0, 1) causes a small counter-clockwise
* rotation.
* @param angle Angle in degrees to rotate.
* @param x X-component of vertex to rotate around.
* @param y Y-component of vertex to rotate around.
* @param z Z-component of vertex to rotate around.
*/
rotate(angle: number, x: number, y: number, z: number): void;
/**
* Multiplies the current matrix by one that rotates according to the
* rotation described by `euler`.
* @param euler A #CoglEuler
*/
rotate_euler(euler: Euler): void;
/**
* Multiplies the current matrix by one that rotates according to the
* rotation described by `quaternion`.
* @param quaternion A #CoglQuaternion
*/
rotate_quaternion(quaternion: Quaternion): void;
/**
* Multiplies the current matrix by one that scales the x, y and z
* axes by the given values.
* @param x Amount to scale along the x-axis
* @param y Amount to scale along the y-axis
* @param z Amount to scale along the z-axis
*/
scale(x: number, y: number, z: number): void;
/**
* Replaces the current `stack` matrix value with the value of `matrix`.
* This effectively discards any other operations that were applied
* since the last time cogl_matrix_stack_push() was called or since
* the stack was initialized.
* @param matrix A #CoglMatrix replace the current matrix value with
*/
set(matrix: Matrix): void;
/**
* Multiplies the current matrix by one that translates along all
* three axes according to the given values.
* @param x Distance to translate along the x-axis
* @param y Distance to translate along the y-axis
* @param z Distance to translate along the z-axis
*/
translate(x: number, y: number, z: number): void;
}
abstract class Object {
static $gtype: GObject.GType