![]() |
![]() |
![]() |
Clutter Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
struct ClutterCairoTexture; struct ClutterCairoTextureClass; ClutterActor * clutter_cairo_texture_new (guint width
,guint height
); void clutter_cairo_texture_set_surface_size (ClutterCairoTexture *self
,guint width
,guint height
); void clutter_cairo_texture_get_surface_size (ClutterCairoTexture *self
,guint *width
,guint *height
); cairo_t * clutter_cairo_texture_create (ClutterCairoTexture *self
); cairo_t * clutter_cairo_texture_create_region (ClutterCairoTexture *self
,gint x_offset
,gint y_offset
,gint width
,gint height
); void clutter_cairo_texture_clear (ClutterCairoTexture *self
); void clutter_cairo_set_source_color (cairo_t *cr
,const ClutterColor *color
);
GObject +----GInitiallyUnowned +----ClutterActor +----ClutterTexture +----ClutterCairoTexture
ClutterCairoTexture implements ClutterScriptable, ClutterAnimatable and AtkImplementorIface.
ClutterCairoTexture is a ClutterTexture that displays the contents of a Cairo context. The ClutterCairoTexture actor will create a Cairo image surface which will then be uploaded to a GL texture when needed.
ClutterCairoTexture will provide a cairo_t context by using the
clutter_cairo_texture_create()
and clutter_cairo_texture_create_region()
functions; you can use the Cairo API to draw on the context and then
call cairo_destroy()
when done.
As soon as the context is destroyed with cairo_destroy()
, the contents
of the surface will be uploaded into the ClutterCairoTexture actor:
1 2 3 4 5 6 7 |
cairo_t *cr; cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (texture)); /* draw on the context */ cairo_destroy (cr); |
Although a new cairo_t is created each time you call
clutter_cairo_texture_create()
or
clutter_cairo_texture_create_region()
, it uses the same
cairo_surface_t each time. You can call
clutter_cairo_texture_clear()
to erase the contents between calls.
Note that you should never use the code above inside the "paint" or "pick" virtual functions or signal handlers because it will lead to performance degradation.
Since ClutterCairoTexture uses a Cairo image surface internally all the drawing operations will be performed in software and not using hardware acceleration. This can lead to performance degradation if the contents of the texture change frequently.
ClutterCairoTexture is available since Clutter 1.0.
struct ClutterCairoTexture;
The ClutterCairoTexture struct contains only private data.
Since 1.0
struct ClutterCairoTextureClass { };
The ClutterCairoTextureClass struct contains only private data.
Since 1.0
ClutterActor * clutter_cairo_texture_new (guint width
,guint height
);
Creates a new ClutterCairoTexture actor, with a surface of width
by
height
pixels.
|
the width of the surface |
|
the height of the surface |
Returns : |
the newly created ClutterCairoTexture actor |
Since 1.0
void clutter_cairo_texture_set_surface_size (ClutterCairoTexture *self
,guint width
,guint height
);
Resizes the Cairo surface used by self
to width
and height
.
|
a ClutterCairoTexture |
|
the new width of the surface |
|
the new height of the surface |
Since 1.0
void clutter_cairo_texture_get_surface_size (ClutterCairoTexture *self
,guint *width
,guint *height
);
Retrieves the surface width and height for self
.
|
a ClutterCairoTexture |
|
return location for the surface width, or NULL . [out]
|
|
return location for the surface height, or NULL . [out]
|
Since 1.0
cairo_t * clutter_cairo_texture_create (ClutterCairoTexture *self
);
Creates a new Cairo context for the cairo
texture. It is
similar to using clutter_cairo_texture_create_region()
with x_offset
and y_offset
of 0, width
equal to the cairo
texture surface width
and height
equal to the cairo
texture surface height.
Do not call this function within the paint virtual function or from a callback to the "paint" signal.
|
a ClutterCairoTexture |
Returns : |
a newly created Cairo context. Use cairo_destroy()
to upload the contents of the context when done drawing
|
Since 1.0
cairo_t * clutter_cairo_texture_create_region (ClutterCairoTexture *self
,gint x_offset
,gint y_offset
,gint width
,gint height
);
Creates a new Cairo context that will updat the region defined
by x_offset
, y_offset
, width
and height
.
Do not call this function within the paint virtual function or from a callback to the "paint" signal.
|
a ClutterCairoTexture |
|
offset of the region on the X axis |
|
offset of the region on the Y axis |
|
width of the region, or -1 for the full surface width |
|
height of the region, or -1 for the full surface height |
Returns : |
a newly created Cairo context. Use cairo_destroy()
to upload the contents of the context when done drawing
|
Since 1.0
void clutter_cairo_texture_clear (ClutterCairoTexture *self
);
Clears self
's internal drawing surface, so that the next upload
will replace the previous contents of the ClutterCairoTexture
rather than adding to it.
|
a ClutterCairoTexture |
Since 1.0
void clutter_cairo_set_source_color (cairo_t *cr
,const ClutterColor *color
);
Utility function for setting the source color of cr
using
a ClutterColor.
|
a Cairo context |
|
a ClutterColor |
Since 1.0
"surface-height"
property "surface-height" guint : Read / Write
The height of the Cairo surface used by the ClutterCairoTexture actor, in pixels.
Default value: 0
Since 1.0
"surface-width"
property "surface-width" guint : Read / Write
The width of the Cairo surface used by the ClutterCairoTexture actor, in pixels.
Default value: 0
Since 1.0