mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1210 - Add CoglColor API * clutter/cogl/cogl-color.h: * clutter/cogl/cogl.h.in: * clutter/cogl/common/Makefile.am: * clutter/cogl/common/cogl-color.c: * clutter/cogl/gl/Makefile.am: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/Makefile.am: * clutter/cogl/gles/cogl-texture.c: * clutter/cogl/gles/cogl.c: Add a new color-type, to be used by COGL. CoglColor is optimized to allow the minimum amount of conversions possible for both GL and GLES implementations. * clutter/clutter-actor.c: * clutter/clutter-clone-texture.c: * clutter/clutter-entry.c: * clutter/clutter-main.c: * clutter/clutter-rectangle.c: * clutter/clutter-stage.c: * clutter/clutter-texture.c: Use CoglColor when needed. * clutter/pango/pangoclutter-render.c: Use CoglColor when needed. * doc/reference/cogl/cogl-docs.sgml: * doc/reference/cogl/cogl-sections.txt: Update the documentation. * tests/test-cogl-offscreen.c: * tests/test-cogl-primitives.c: * tests/test-cogl-tex-convert.c: * tests/test-cogl-tex-foreign.c: * tests/test-cogl-tex-getset.c: * tests/test-cogl-tex-polygon.c: * tests/test-cogl-tex-tile.c: * tests/test-paint-wrapper.c: Update the tests. * README: Update release notes.
This commit is contained in:
parent
911b395c8a
commit
a547cdbc4d
40
ChangeLog
40
ChangeLog
@ -1,3 +1,43 @@
|
|||||||
|
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
|
|
||||||
|
Bug 1210 - Add CoglColor API
|
||||||
|
|
||||||
|
* clutter/cogl/cogl-color.h:
|
||||||
|
* clutter/cogl/cogl.h.in:
|
||||||
|
* clutter/cogl/common/Makefile.am:
|
||||||
|
* clutter/cogl/common/cogl-color.c:
|
||||||
|
* clutter/cogl/gl/Makefile.am:
|
||||||
|
* clutter/cogl/gl/cogl.c:
|
||||||
|
* clutter/cogl/gles/Makefile.am:
|
||||||
|
* clutter/cogl/gles/cogl-texture.c:
|
||||||
|
* clutter/cogl/gles/cogl.c: Add a new color-type, to be used by
|
||||||
|
COGL. CoglColor is optimized to allow the minimum amount of
|
||||||
|
conversions possible for both GL and GLES implementations.
|
||||||
|
|
||||||
|
* clutter/clutter-actor.c:
|
||||||
|
* clutter/clutter-clone-texture.c:
|
||||||
|
* clutter/clutter-entry.c:
|
||||||
|
* clutter/clutter-main.c:
|
||||||
|
* clutter/clutter-rectangle.c:
|
||||||
|
* clutter/clutter-stage.c:
|
||||||
|
* clutter/clutter-texture.c: Use CoglColor when needed.
|
||||||
|
|
||||||
|
* clutter/pango/pangoclutter-render.c: Use CoglColor when needed.
|
||||||
|
|
||||||
|
* doc/reference/cogl/cogl-docs.sgml:
|
||||||
|
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
|
||||||
|
|
||||||
|
* tests/test-cogl-offscreen.c:
|
||||||
|
* tests/test-cogl-primitives.c:
|
||||||
|
* tests/test-cogl-tex-convert.c:
|
||||||
|
* tests/test-cogl-tex-foreign.c:
|
||||||
|
* tests/test-cogl-tex-getset.c:
|
||||||
|
* tests/test-cogl-tex-polygon.c:
|
||||||
|
* tests/test-cogl-tex-tile.c:
|
||||||
|
* tests/test-paint-wrapper.c: Update the tests.
|
||||||
|
|
||||||
|
* README: Update release notes.
|
||||||
|
|
||||||
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
|
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
|
|
||||||
Bug 1209 - Move fixed point API in COGL
|
Bug 1209 - Move fixed point API in COGL
|
||||||
|
5
README
5
README
@ -170,6 +170,11 @@ wanting to port to newer releases (See NEWS for general new feature info).
|
|||||||
Release Notes for Clutter 1.0
|
Release Notes for Clutter 1.0
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
* COGL has an internal Color type, used to store a color definition
|
||||||
|
that can be efficiently used with the least amount of conversions
|
||||||
|
by both the GL and GLES implementations. The COGL API has been
|
||||||
|
changed to drop the usage of ClutterColor in favour of CoglColor.
|
||||||
|
|
||||||
* The fixed point API implementation Clutter uses internally has been
|
* The fixed point API implementation Clutter uses internally has been
|
||||||
moved from the Clutter namespace to the COGL one. The ClutterFixed
|
moved from the Clutter namespace to the COGL one. The ClutterFixed
|
||||||
type and relative API is just a wrapper around CoglFixed and its
|
type and relative API is just a wrapper around CoglFixed and its
|
||||||
|
@ -608,7 +608,14 @@ clutter_actor_real_pick (ClutterActor *self,
|
|||||||
*/
|
*/
|
||||||
if (clutter_actor_should_pick_paint (self))
|
if (clutter_actor_should_pick_paint (self))
|
||||||
{
|
{
|
||||||
cogl_color (color);
|
CoglColor c;
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&c,
|
||||||
|
color->red,
|
||||||
|
color->green,
|
||||||
|
color->blue,
|
||||||
|
color->alpha);
|
||||||
|
cogl_color (&c);
|
||||||
cogl_rectangle (0, 0,
|
cogl_rectangle (0, 0,
|
||||||
clutter_actor_get_width (self),
|
clutter_actor_get_width (self),
|
||||||
clutter_actor_get_height (self));
|
clutter_actor_get_height (self));
|
||||||
|
@ -142,7 +142,7 @@ clutter_clone_texture_paint (ClutterActor *self)
|
|||||||
ClutterCloneTexturePrivate *priv;
|
ClutterCloneTexturePrivate *priv;
|
||||||
ClutterActor *parent_texture;
|
ClutterActor *parent_texture;
|
||||||
gint x_1, y_1, x_2, y_2;
|
gint x_1, y_1, x_2, y_2;
|
||||||
ClutterColor col = { 0xff, 0xff, 0xff, 0xff };
|
CoglColor col;
|
||||||
CoglHandle cogl_texture;
|
CoglHandle cogl_texture;
|
||||||
ClutterFixed t_w, t_h;
|
ClutterFixed t_w, t_h;
|
||||||
guint tex_width, tex_height;
|
guint tex_width, tex_height;
|
||||||
@ -165,7 +165,8 @@ clutter_clone_texture_paint (ClutterActor *self)
|
|||||||
if (!CLUTTER_ACTOR_IS_REALIZED (parent_texture))
|
if (!CLUTTER_ACTOR_IS_REALIZED (parent_texture))
|
||||||
clutter_actor_realize (parent_texture);
|
clutter_actor_realize (parent_texture);
|
||||||
|
|
||||||
col.alpha = clutter_actor_get_paint_opacity (self);
|
cogl_color_set_from_4ub (&col, 255, 255, 255,
|
||||||
|
clutter_actor_get_paint_opacity (self));
|
||||||
cogl_color (&col);
|
cogl_color (&col);
|
||||||
|
|
||||||
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
||||||
|
@ -410,7 +410,14 @@ clutter_entry_paint_cursor (ClutterEntry *entry)
|
|||||||
|
|
||||||
if (priv->show_cursor)
|
if (priv->show_cursor)
|
||||||
{
|
{
|
||||||
cogl_color (&priv->fgcol);
|
CoglColor cursor_color;
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cursor_color,
|
||||||
|
priv->fgcol.red,
|
||||||
|
priv->fgcol.green,
|
||||||
|
priv->fgcol.blue,
|
||||||
|
priv->fgcol.alpha);
|
||||||
|
cogl_color (&cursor_color);
|
||||||
cogl_rectangle (priv->cursor_pos.x,
|
cogl_rectangle (priv->cursor_pos.x,
|
||||||
priv->cursor_pos.y,
|
priv->cursor_pos.y,
|
||||||
priv->cursor_pos.width,
|
priv->cursor_pos.width,
|
||||||
|
@ -351,7 +351,7 @@ _clutter_do_pick (ClutterStage *stage,
|
|||||||
ClutterMainContext *context;
|
ClutterMainContext *context;
|
||||||
guchar pixel[4];
|
guchar pixel[4];
|
||||||
GLint viewport[4];
|
GLint viewport[4];
|
||||||
ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
|
CoglColor white;
|
||||||
guint32 id;
|
guint32 id;
|
||||||
GLboolean dither_was_on;
|
GLboolean dither_was_on;
|
||||||
|
|
||||||
@ -362,6 +362,7 @@ _clutter_do_pick (ClutterStage *stage,
|
|||||||
/* needed for when a context switch happens */
|
/* needed for when a context switch happens */
|
||||||
_clutter_stage_maybe_setup_viewport (stage);
|
_clutter_stage_maybe_setup_viewport (stage);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
|
||||||
cogl_paint_init (&white);
|
cogl_paint_init (&white);
|
||||||
|
|
||||||
/* Disable dithering (if any) when doing the painting in pick mode */
|
/* Disable dithering (if any) when doing the painting in pick mode */
|
||||||
|
@ -73,7 +73,8 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(self);
|
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(self);
|
||||||
ClutterRectanglePrivate *priv;
|
ClutterRectanglePrivate *priv;
|
||||||
ClutterGeometry geom;
|
ClutterGeometry geom;
|
||||||
ClutterColor tmp_col;
|
CoglColor tmp_col;
|
||||||
|
guint8 tmp_alpha;
|
||||||
|
|
||||||
rectangle = CLUTTER_RECTANGLE(self);
|
rectangle = CLUTTER_RECTANGLE(self);
|
||||||
priv = rectangle->priv;
|
priv = rectangle->priv;
|
||||||
@ -84,18 +85,24 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
: "unknown");
|
: "unknown");
|
||||||
clutter_actor_get_allocation_geometry (self, &geom);
|
clutter_actor_get_allocation_geometry (self, &geom);
|
||||||
|
|
||||||
|
/* compute the composited opacity of the actor taking into
|
||||||
|
* account the opacity of the color set by the user
|
||||||
|
*/
|
||||||
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||||
|
* priv->border_color.alpha
|
||||||
|
/ 255;
|
||||||
|
|
||||||
/* parent paint call will have translated us into position so
|
/* parent paint call will have translated us into position so
|
||||||
* paint from 0, 0
|
* paint from 0, 0
|
||||||
*/
|
*/
|
||||||
if (priv->has_border)
|
if (priv->has_border)
|
||||||
{
|
{
|
||||||
tmp_col.red = priv->border_color.red;
|
/* paint the border */
|
||||||
tmp_col.green = priv->border_color.green;
|
cogl_color_set_from_4ub (&tmp_col,
|
||||||
tmp_col.blue = priv->border_color.blue;
|
priv->border_color.red,
|
||||||
tmp_col.alpha = clutter_actor_get_paint_opacity (self)
|
priv->border_color.green,
|
||||||
* priv->border_color.alpha
|
priv->border_color.blue,
|
||||||
/ 255;
|
tmp_alpha);
|
||||||
|
|
||||||
cogl_color (&tmp_col);
|
cogl_color (&tmp_col);
|
||||||
|
|
||||||
/* this sucks, but it's the only way to make a border */
|
/* this sucks, but it's the only way to make a border */
|
||||||
@ -116,13 +123,12 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
priv->border_width,
|
priv->border_width,
|
||||||
geom.height - priv->border_width);
|
geom.height - priv->border_width);
|
||||||
|
|
||||||
tmp_col.red = priv->color.red;
|
/* now paint the rectangle */
|
||||||
tmp_col.green = priv->color.green;
|
cogl_color_set_from_4ub (&tmp_col,
|
||||||
tmp_col.blue = priv->color.blue;
|
priv->color.red,
|
||||||
tmp_col.alpha = clutter_actor_get_paint_opacity (self)
|
priv->color.green,
|
||||||
* priv->color.alpha
|
priv->color.blue,
|
||||||
/ 255;
|
tmp_alpha);
|
||||||
|
|
||||||
cogl_color (&tmp_col);
|
cogl_color (&tmp_col);
|
||||||
|
|
||||||
cogl_rectangle (priv->border_width, priv->border_width,
|
cogl_rectangle (priv->border_width, priv->border_width,
|
||||||
@ -131,13 +137,11 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp_col.red = priv->color.red;
|
cogl_color_set_from_4ub (&tmp_col,
|
||||||
tmp_col.green = priv->color.green;
|
priv->color.red,
|
||||||
tmp_col.blue = priv->color.blue;
|
priv->color.green,
|
||||||
tmp_col.alpha = clutter_actor_get_paint_opacity (self)
|
priv->color.blue,
|
||||||
* priv->color.alpha
|
tmp_alpha);
|
||||||
/ 255;
|
|
||||||
|
|
||||||
cogl_color (&tmp_col);
|
cogl_color (&tmp_col);
|
||||||
|
|
||||||
cogl_rectangle (0, 0, geom.width, geom.height);
|
cogl_rectangle (0, 0, geom.width, geom.height);
|
||||||
|
@ -209,16 +209,22 @@ static void
|
|||||||
clutter_stage_paint (ClutterActor *self)
|
clutter_stage_paint (ClutterActor *self)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||||
|
CoglColor stage_color;
|
||||||
|
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT);
|
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT);
|
||||||
|
|
||||||
CLUTTER_NOTE (PAINT, "Initializing stage paint");
|
CLUTTER_NOTE (PAINT, "Initializing stage paint");
|
||||||
|
|
||||||
cogl_paint_init (&priv->color);
|
cogl_color_set_from_4ub (&stage_color,
|
||||||
|
priv->color.red,
|
||||||
|
priv->color.green,
|
||||||
|
priv->color.blue,
|
||||||
|
priv->color.alpha);
|
||||||
|
cogl_paint_init (&stage_color);
|
||||||
|
|
||||||
if (priv->use_fog)
|
if (priv->use_fog)
|
||||||
{
|
{
|
||||||
cogl_fog_set (&priv->color,
|
cogl_fog_set (&stage_color,
|
||||||
priv->fog.density,
|
priv->fog.density,
|
||||||
priv->fog.z_near,
|
priv->fog.z_near,
|
||||||
priv->fog.z_far);
|
priv->fog.z_far);
|
||||||
|
@ -492,8 +492,8 @@ clutter_texture_paint (ClutterActor *self)
|
|||||||
ClutterTexture *texture = CLUTTER_TEXTURE (self);
|
ClutterTexture *texture = CLUTTER_TEXTURE (self);
|
||||||
ClutterTexturePrivate *priv = texture->priv;
|
ClutterTexturePrivate *priv = texture->priv;
|
||||||
gint x_1, y_1, x_2, y_2;
|
gint x_1, y_1, x_2, y_2;
|
||||||
ClutterColor col = { 0xff, 0xff, 0xff, 0xff };
|
CoglColor col;
|
||||||
ClutterColor transparent_col = { 0, 0, 0, 0 };
|
CoglColor transparent_col;
|
||||||
ClutterFixed t_w, t_h;
|
ClutterFixed t_w, t_h;
|
||||||
|
|
||||||
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR(texture)))
|
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR(texture)))
|
||||||
@ -547,6 +547,7 @@ clutter_texture_paint (ClutterActor *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* cogl_paint_init is called to clear the buffers */
|
/* cogl_paint_init is called to clear the buffers */
|
||||||
|
cogl_color_set_from_4ub (&transparent_col, 0, 0, 0, 0);
|
||||||
cogl_paint_init (&transparent_col);
|
cogl_paint_init (&transparent_col);
|
||||||
|
|
||||||
/* Clear the clipping stack so that if the FBO actor is being
|
/* Clear the clipping stack so that if the FBO actor is being
|
||||||
@ -575,7 +576,12 @@ clutter_texture_paint (ClutterActor *self)
|
|||||||
"painting texture '%s'",
|
"painting texture '%s'",
|
||||||
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
||||||
: "unknown");
|
: "unknown");
|
||||||
col.alpha = clutter_actor_get_paint_opacity (self);
|
|
||||||
|
cogl_color_set_from_4ub (&col,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
clutter_actor_get_paint_opacity (self));
|
||||||
cogl_color (&col);
|
cogl_color (&col);
|
||||||
|
|
||||||
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
||||||
|
223
clutter/cogl/cogl-color.h
Normal file
223
clutter/cogl/cogl-color.h
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
#ifndef __COGL_COLOR_H__
|
||||||
|
#define __COGL_COLOR_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <cogl/cogl-fixed.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _CoglColor CoglColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CoglColor:
|
||||||
|
*
|
||||||
|
* A structure for holding a color definition. The contents of
|
||||||
|
* the CoglColor structure are private and should never by accessed
|
||||||
|
* directly.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
struct _CoglColor
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
CoglFixed red;
|
||||||
|
CoglFixed green;
|
||||||
|
CoglFixed blue;
|
||||||
|
|
||||||
|
CoglFixed alpha;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_set_from_4ub:
|
||||||
|
* @dest: return location for a #CoglColor
|
||||||
|
* @red: value of the red channel, between 0 and 255
|
||||||
|
* @green: value of the green channel, between 0 and 255
|
||||||
|
* @blue: value of the blue channel, between 0 and 255
|
||||||
|
* @alpha: value of the alpha channel, between 0 and 255
|
||||||
|
*
|
||||||
|
* Sets the values of the passed channel into a #CoglColor.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
void cogl_color_set_from_4ub (CoglColor *dest,
|
||||||
|
guint8 red,
|
||||||
|
guint8 green,
|
||||||
|
guint8 blue,
|
||||||
|
guint8 alpha);
|
||||||
|
/**
|
||||||
|
* cogl_color_set_from_4ub:
|
||||||
|
* @dest: return location for a #CoglColor
|
||||||
|
* @red: value of the red channel, between 0 and 1
|
||||||
|
* @green: value of the green channel, between 0 and 1
|
||||||
|
* @blue: value of the blue channel, between 0 and 1
|
||||||
|
* @alpha: value of the alpha channel, between 0 and 1
|
||||||
|
*
|
||||||
|
* Sets the values of the passed channel into a #CoglColor.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
void cogl_color_set_from_4d (CoglColor *dest,
|
||||||
|
gdouble red,
|
||||||
|
gdouble green,
|
||||||
|
gdouble blue,
|
||||||
|
gdouble alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_red_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the red channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the red channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_red_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_green_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the green channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the green channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_green_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_blue_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the blue channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the blue channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_blue_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_alpha_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the alpha channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the alpha channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_alpha_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_red_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the red channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the red channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_red_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_green_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the green channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the green channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_green_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_blue_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the blue channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the blue channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_blue_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_alpha_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the alpha channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the alpha channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_alpha_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_red:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the red channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the red channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_red (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_green:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the green channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the green channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_green (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_blue:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the blue channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the blue channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_blue (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_alpha:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the alpha channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the alpha channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_alpha (const CoglColor *color);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __COGL_COLOR_H__ */
|
@ -43,12 +43,11 @@
|
|||||||
#define __COGL_H__
|
#define __COGL_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <clutter/clutter-color.h>
|
|
||||||
#include <clutter/clutter-feature.h>
|
#include <clutter/clutter-feature.h>
|
||||||
#include <clutter/clutter-types.h>
|
|
||||||
|
|
||||||
#include <cogl/cogl-defines-@CLUTTER_COGL@.h>
|
#include <cogl/cogl-defines-@CLUTTER_COGL@.h>
|
||||||
#include <cogl/cogl-fixed.h>
|
#include <cogl/cogl-fixed.h>
|
||||||
|
#include <cogl/cogl-color.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -212,7 +211,7 @@ struct _CoglTextureVertex
|
|||||||
{
|
{
|
||||||
CoglFixed x, y, z;
|
CoglFixed x, y, z;
|
||||||
CoglFixed tx, ty;
|
CoglFixed tx, ty;
|
||||||
ClutterColor color;
|
CoglColor color;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _CoglTextureVertex CoglTextureVertex;
|
typedef struct _CoglTextureVertex CoglTextureVertex;
|
||||||
@ -618,7 +617,7 @@ void cogl_alpha_func (COGLenum func,
|
|||||||
* with @fog_color. Fogging will remain enabled until the next call to
|
* with @fog_color. Fogging will remain enabled until the next call to
|
||||||
* cogl_paint_init().
|
* cogl_paint_init().
|
||||||
*/
|
*/
|
||||||
void cogl_fog_set (const ClutterColor *fog_color,
|
void cogl_fog_set (const CoglColor *fog_color,
|
||||||
CoglFixed density,
|
CoglFixed density,
|
||||||
CoglFixed z_near,
|
CoglFixed z_near,
|
||||||
CoglFixed z_far);
|
CoglFixed z_far);
|
||||||
@ -630,7 +629,7 @@ void cogl_fog_set (const ClutterColor *fog_color,
|
|||||||
* Clears the color buffer to @color. The depth buffer and stencil
|
* Clears the color buffer to @color. The depth buffer and stencil
|
||||||
* buffers are also cleared and fogging and lighting are disabled.
|
* buffers are also cleared and fogging and lighting are disabled.
|
||||||
*/
|
*/
|
||||||
void cogl_paint_init (const ClutterColor *color);
|
void cogl_paint_init (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:cogl-texture
|
* SECTION:cogl-texture
|
||||||
@ -1019,12 +1018,12 @@ void cogl_texture_polygon (CoglHandle handle,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color:
|
* cogl_color:
|
||||||
* @color: new current @ClutterColor.
|
* @color: new current @CoglColor.
|
||||||
*
|
*
|
||||||
* Changes the color of cogl's current paint, which is used for filling and stroking
|
* Changes the color of cogl's current paint, which is used for filling and stroking
|
||||||
* primitives.
|
* primitives.
|
||||||
*/
|
*/
|
||||||
void cogl_color (const ClutterColor *color);
|
void cogl_color (const CoglColor *color);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,4 +26,5 @@ libclutter_cogl_common_la_SOURCES = \
|
|||||||
cogl-bitmap-pixbuf.c \
|
cogl-bitmap-pixbuf.c \
|
||||||
cogl-clip-stack.h \
|
cogl-clip-stack.h \
|
||||||
cogl-clip-stack.c \
|
cogl-clip-stack.c \
|
||||||
cogl-fixed.c
|
cogl-fixed.c \
|
||||||
|
cogl-color.c
|
||||||
|
107
clutter/cogl/common/cogl-color.c
Normal file
107
clutter/cogl/common/cogl-color.c
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cogl-color.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_color_set_from_4ub (CoglColor *dest,
|
||||||
|
guint8 red,
|
||||||
|
guint8 green,
|
||||||
|
guint8 blue,
|
||||||
|
guint8 alpha)
|
||||||
|
{
|
||||||
|
g_return_if_fail (dest != NULL);
|
||||||
|
|
||||||
|
dest->red = COGL_FIXED_FROM_FLOAT ((float) red / 0xff * 1.0);
|
||||||
|
dest->green = COGL_FIXED_FROM_FLOAT ((float) green / 0xff * 1.0);
|
||||||
|
dest->blue = COGL_FIXED_FROM_FLOAT ((float) blue / 0xff * 1.0);
|
||||||
|
dest->alpha = COGL_FIXED_FROM_FLOAT ((float) alpha / 0xff * 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_color_set_from_4d (CoglColor *dest,
|
||||||
|
gdouble red,
|
||||||
|
gdouble green,
|
||||||
|
gdouble blue,
|
||||||
|
gdouble alpha)
|
||||||
|
{
|
||||||
|
g_return_if_fail (dest != NULL);
|
||||||
|
|
||||||
|
dest->red = COGL_FIXED_FROM_FLOAT (CLAMP (red, 0.0, 1.0));
|
||||||
|
dest->green = COGL_FIXED_FROM_FLOAT (CLAMP (green, 0.0, 1.0));
|
||||||
|
dest->blue = COGL_FIXED_FROM_FLOAT (CLAMP (blue, 0.0, 1.0));
|
||||||
|
dest->alpha = COGL_FIXED_FROM_FLOAT (CLAMP (alpha, 0.0, 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_red_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->red * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_red_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->red);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_red (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->red;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_green_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->green * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_green_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->green);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_green (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->green;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_blue_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->blue * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_blue_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_blue (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_alpha_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->alpha * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_alpha_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_alpha (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->alpha;
|
||||||
|
}
|
@ -2,6 +2,7 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
|||||||
libclutterinclude_HEADERS = \
|
libclutterinclude_HEADERS = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
@ -23,6 +24,7 @@ noinst_LTLIBRARIES = libclutter-cogl.la
|
|||||||
libclutter_cogl_la_SOURCES = \
|
libclutter_cogl_la_SOURCES = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||||
cogl-internal.h \
|
cogl-internal.h \
|
||||||
cogl-texture.h \
|
cogl-texture.h \
|
||||||
|
@ -169,11 +169,11 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_paint_init (const ClutterColor *color)
|
cogl_paint_init (const CoglColor *color)
|
||||||
{
|
{
|
||||||
GE( glClearColor (((float) color->red / 0xff * 1.0),
|
GE( glClearColor (cogl_color_get_red_float (color),
|
||||||
((float) color->green / 0xff * 1.0),
|
cogl_color_get_green_float (color),
|
||||||
((float) color->blue / 0xff * 1.0),
|
cogl_color_get_blue_float (color),
|
||||||
0.0) );
|
0.0) );
|
||||||
|
|
||||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
@ -380,17 +380,17 @@ cogl_enable_backface_culling (gboolean setting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_color (const ClutterColor *color)
|
cogl_color (const CoglColor *color)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
glColor4ub (color->red,
|
glColor4f (cogl_color_get_red_float (color),
|
||||||
color->green,
|
cogl_color_get_green_float (color),
|
||||||
color->blue,
|
cogl_color_get_blue_float (color),
|
||||||
color->alpha);
|
cogl_color_get_alpha_float (color));
|
||||||
|
|
||||||
/* Store alpha for proper blending enables */
|
/* Store alpha for proper blending enables */
|
||||||
ctx->color_alpha = color->alpha;
|
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1242,17 +1242,17 @@ cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_fog_set (const ClutterColor *fog_color,
|
cogl_fog_set (const CoglColor *fog_color,
|
||||||
CoglFixed density,
|
CoglFixed density,
|
||||||
CoglFixed start,
|
CoglFixed start,
|
||||||
CoglFixed stop)
|
CoglFixed stop)
|
||||||
{
|
{
|
||||||
GLfloat fogColor[4];
|
GLfloat fogColor[4];
|
||||||
|
|
||||||
fogColor[0] = ((float) fog_color->red / 0xff * 1.0);
|
fogColor[0] = cogl_color_get_red_float (fog_color);
|
||||||
fogColor[1] = ((float) fog_color->green / 0xff * 1.0);
|
fogColor[1] = cogl_color_get_green_float (fog_color);
|
||||||
fogColor[2] = ((float) fog_color->blue / 0xff * 1.0);
|
fogColor[2] = cogl_color_get_blue_float (fog_color);
|
||||||
fogColor[3] = ((float) fog_color->alpha / 0xff * 1.0);
|
fogColor[3] = cogl_color_get_alpha_float (fog_color);
|
||||||
|
|
||||||
glEnable (GL_FOG);
|
glEnable (GL_FOG);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
|||||||
libclutterinclude_HEADERS = \
|
libclutterinclude_HEADERS = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
@ -23,6 +24,7 @@ noinst_LTLIBRARIES = libclutter-cogl.la
|
|||||||
libclutter_cogl_la_SOURCES = \
|
libclutter_cogl_la_SOURCES = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||||
cogl-internal.h \
|
cogl-internal.h \
|
||||||
cogl-texture.h \
|
cogl-texture.h \
|
||||||
|
@ -338,7 +338,7 @@ _cogl_texture_upload_to_gl (CoglTexture *tex)
|
|||||||
static void
|
static void
|
||||||
_cogl_texture_draw_and_read (CoglTexture *tex,
|
_cogl_texture_draw_and_read (CoglTexture *tex,
|
||||||
CoglBitmap *target_bmp,
|
CoglBitmap *target_bmp,
|
||||||
ClutterColor *back_color,
|
CoglColor *back_color,
|
||||||
GLint *viewport)
|
GLint *viewport)
|
||||||
{
|
{
|
||||||
gint bpp;
|
gint bpp;
|
||||||
@ -462,13 +462,15 @@ _cogl_texture_download_from_gl (CoglTexture *tex,
|
|||||||
{
|
{
|
||||||
gint bpp;
|
gint bpp;
|
||||||
GLint viewport[4];
|
GLint viewport[4];
|
||||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
CoglColor cwhite;
|
||||||
CoglBitmap alpha_bmp;
|
CoglBitmap alpha_bmp;
|
||||||
COGLenum old_src_factor;
|
COGLenum old_src_factor;
|
||||||
COGLenum old_dst_factor;
|
COGLenum old_dst_factor;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||||
|
|
||||||
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
||||||
|
|
||||||
/* Viewport needs to have some size and be inside the window for this */
|
/* Viewport needs to have some size and be inside the window for this */
|
||||||
|
@ -86,16 +86,16 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_paint_init (const ClutterColor *color)
|
cogl_paint_init (const CoglColor *color)
|
||||||
{
|
{
|
||||||
#if COGL_DEBUG
|
#if COGL_DEBUG
|
||||||
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cogl_wrap_glClearColorx ((color->red << 16) / 0xff,
|
cogl_wrap_glClearColorx (cogl_color_get_red (color),
|
||||||
(color->green << 16) / 0xff,
|
cogl_color_get_green (color),
|
||||||
(color->blue << 16) / 0xff,
|
cogl_color_get_blue (color),
|
||||||
0xff);
|
0);
|
||||||
|
|
||||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
cogl_wrap_glDisable (GL_LIGHTING);
|
cogl_wrap_glDisable (GL_LIGHTING);
|
||||||
@ -291,7 +291,7 @@ cogl_enable_backface_culling (gboolean setting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_color (const ClutterColor *color)
|
cogl_color (const CoglColor *color)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
@ -315,14 +315,14 @@ cogl_color (const ClutterColor *color)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
/* conversion can cause issues with picking on some gles implementations */
|
/* conversion can cause issues with picking on some gles implementations */
|
||||||
GE( cogl_wrap_glColor4x ((color->red << 16) / 0xff,
|
GE( cogl_wrap_glColor4x (cogl_color_get_red (color),
|
||||||
(color->green << 16) / 0xff,
|
cogl_color_get_green (color),
|
||||||
(color->blue << 16) / 0xff,
|
cogl_color_get_blue (color),
|
||||||
(color->alpha << 16) / 0xff));
|
cogl_color_get_alpha (color)) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Store alpha for proper blending enables */
|
/* Store alpha for proper blending enables */
|
||||||
ctx->color_alpha = color->alpha;
|
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -898,17 +898,17 @@ cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_fog_set (const ClutterColor *fog_color,
|
cogl_fog_set (const CoglColor *fog_color,
|
||||||
CoglFixed density,
|
CoglFixed density,
|
||||||
CoglFixed z_near,
|
CoglFixed z_near,
|
||||||
CoglFixed z_far)
|
CoglFixed z_far)
|
||||||
{
|
{
|
||||||
GLfixed fogColor[4];
|
GLfixed fogColor[4];
|
||||||
|
|
||||||
fogColor[0] = (fog_color->red << 16) / 0xff;
|
fogColor[0] = cogl_color_get_red (fog_color);
|
||||||
fogColor[1] = (fog_color->green << 16) / 0xff;
|
fogColor[1] = cogl_color_get_green (fog_color);
|
||||||
fogColor[2] = (fog_color->blue << 16) / 0xff;
|
fogColor[2] = cogl_color_get_blue (fog_color);
|
||||||
fogColor[3] = (fog_color->alpha << 16) / 0xff;
|
fogColor[3] = cogl_color_get_alpha (fog_color);
|
||||||
|
|
||||||
cogl_wrap_glEnable (GL_FOG);
|
cogl_wrap_glEnable (GL_FOG);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct _PangoClutterRenderer
|
|||||||
PangoRenderer parent_instance;
|
PangoRenderer parent_instance;
|
||||||
|
|
||||||
/* The color to draw the glyphs with */
|
/* The color to draw the glyphs with */
|
||||||
ClutterColor color;
|
CoglColor color;
|
||||||
|
|
||||||
/* Two caches of glyphs as textures, one with mipmapped textures and
|
/* Two caches of glyphs as textures, one with mipmapped textures and
|
||||||
one without */
|
one without */
|
||||||
@ -143,7 +143,11 @@ pango_clutter_render_layout_subpixel (PangoLayout *layout,
|
|||||||
(PANGO_CLUTTER_FONT_MAP (font_map));
|
(PANGO_CLUTTER_FONT_MAP (font_map));
|
||||||
priv = PANGO_CLUTTER_RENDERER (renderer);
|
priv = PANGO_CLUTTER_RENDERER (renderer);
|
||||||
|
|
||||||
priv->color = *color;
|
cogl_color_set_from_4ub (&priv->color,
|
||||||
|
color->red,
|
||||||
|
color->green,
|
||||||
|
color->blue,
|
||||||
|
color->alpha);
|
||||||
|
|
||||||
pango_renderer_draw_layout (renderer, layout, x, y);
|
pango_renderer_draw_layout (renderer, layout, x, y);
|
||||||
}
|
}
|
||||||
@ -180,7 +184,11 @@ pango_clutter_render_layout_line (PangoLayoutLine *line,
|
|||||||
(PANGO_CLUTTER_FONT_MAP (font_map));
|
(PANGO_CLUTTER_FONT_MAP (font_map));
|
||||||
priv = PANGO_CLUTTER_RENDERER (renderer);
|
priv = PANGO_CLUTTER_RENDERER (renderer);
|
||||||
|
|
||||||
priv->color = *color;
|
cogl_color_set_from_4ub (&priv->color,
|
||||||
|
color->red,
|
||||||
|
color->green,
|
||||||
|
color->blue,
|
||||||
|
color->alpha);
|
||||||
|
|
||||||
pango_renderer_draw_layout_line (renderer, line, x, y);
|
pango_renderer_draw_layout_line (renderer, line, x, y);
|
||||||
}
|
}
|
||||||
@ -320,14 +328,15 @@ pango_clutter_renderer_set_color_for_part (PangoRenderer *renderer,
|
|||||||
{
|
{
|
||||||
PangoColor *pango_color = pango_renderer_get_color (renderer, part);
|
PangoColor *pango_color = pango_renderer_get_color (renderer, part);
|
||||||
PangoClutterRenderer *priv = PANGO_CLUTTER_RENDERER (renderer);
|
PangoClutterRenderer *priv = PANGO_CLUTTER_RENDERER (renderer);
|
||||||
ClutterColor clutter_color;
|
CoglColor clutter_color;
|
||||||
|
|
||||||
if (pango_color)
|
if (pango_color)
|
||||||
{
|
{
|
||||||
clutter_color.red = pango_color->red >> 8;
|
cogl_color_set_from_4ub (&clutter_color,
|
||||||
clutter_color.green = pango_color->green >> 8;
|
pango_color->red >> 8,
|
||||||
clutter_color.blue = pango_color->blue >> 8;
|
pango_color->green >> 8,
|
||||||
clutter_color.alpha = priv->color.alpha;
|
pango_color->blue >> 8,
|
||||||
|
cogl_color_get_alpha_byte (&priv->color));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
clutter_color = priv->color;
|
clutter_color = priv->color;
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<xi:include href="xml/cogl-shaders.xml"/>
|
<xi:include href="xml/cogl-shaders.xml"/>
|
||||||
<xi:include href="xml/cogl-offscreen.xml"/>
|
<xi:include href="xml/cogl-offscreen.xml"/>
|
||||||
<xi:include href="xml/cogl-fixed.xml"/>
|
<xi:include href="xml/cogl-fixed.xml"/>
|
||||||
|
<xi:include href="xml/cogl-color.xml"/>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
@ -231,3 +231,29 @@ cogl_double_to_fixed
|
|||||||
cogl_double_to_int
|
cogl_double_to_int
|
||||||
cogl_double_to_unit
|
cogl_double_to_unit
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>cogl-color</FILE>
|
||||||
|
<TITLE>Color Type</TITLE>
|
||||||
|
CoglColor
|
||||||
|
cogl_color_set_from_4ub
|
||||||
|
cogl_color_set_from_4d
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
cogl_color_get_red
|
||||||
|
cogl_color_get_green
|
||||||
|
cogl_color_get_blue
|
||||||
|
cogl_color_get_alpha
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
cogl_color_get_red_byte
|
||||||
|
cogl_color_get_green_byte
|
||||||
|
cogl_color_get_blue_byte
|
||||||
|
cogl_color_get_alpha_byte
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
cogl_color_get_red_float
|
||||||
|
cogl_color_get_green_float
|
||||||
|
cogl_color_get_blue_float
|
||||||
|
cogl_color_get_alpha_float
|
||||||
|
</SECTION>
|
||||||
|
@ -80,13 +80,7 @@ static void
|
|||||||
test_coglbox_paint(ClutterActor *self)
|
test_coglbox_paint(ClutterActor *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
CoglColor color;
|
||||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
|
||||||
ClutterColor cred = {0xFF, 0x0, 0x0, 0xFF};
|
|
||||||
ClutterColor cgreen = {0x0, 0xFF, 0x0, 0xFF};
|
|
||||||
ClutterColor cfullopaque = {0xFF, 0xFF, 0xFF, 0xFF};
|
|
||||||
ClutterColor chalfopaque = {0xFF, 0xFF, 0xFF, 0x88};
|
|
||||||
|
|
||||||
ClutterFixed texcoords[4] = {
|
ClutterFixed texcoords[4] = {
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
@ -96,10 +90,12 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
|
||||||
cogl_color (&cback);
|
cogl_color_set_from_4ub (&color, 0x66, 0x66, 0xdd, 0xff);
|
||||||
|
cogl_color (&color);
|
||||||
cogl_rectangle (0,0,400,400);
|
cogl_rectangle (0,0,400,400);
|
||||||
|
|
||||||
cogl_color (&cfullopaque);
|
cogl_color_set_from_4ub (&color, 0xff, 0xff, 0xff, 0xff);
|
||||||
|
cogl_color (&color);
|
||||||
cogl_texture_rectangle (priv->texhand_id,
|
cogl_texture_rectangle (priv->texhand_id,
|
||||||
0,0,
|
0,0,
|
||||||
CLUTTER_INT_TO_FIXED (400),
|
CLUTTER_INT_TO_FIXED (400),
|
||||||
@ -110,15 +106,18 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
|
|
||||||
cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id);
|
cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id);
|
||||||
|
|
||||||
cogl_color (&cred);
|
cogl_color_set_from_4ub (&color, 0xff, 0, 0, 0xff);
|
||||||
|
cogl_color (&color);
|
||||||
cogl_rectangle (20,20,100,100);
|
cogl_rectangle (20,20,100,100);
|
||||||
|
|
||||||
cogl_color (&cgreen);
|
cogl_color_set_from_4ub (&color, 0, 0xff, 0, 0xff);
|
||||||
|
cogl_color (&color);
|
||||||
cogl_rectangle (80,80,100,100);
|
cogl_rectangle (80,80,100,100);
|
||||||
|
|
||||||
cogl_draw_buffer (COGL_WINDOW_BUFFER, 0);
|
cogl_draw_buffer (COGL_WINDOW_BUFFER, 0);
|
||||||
|
|
||||||
cogl_color (&chalfopaque);
|
cogl_color_set_from_4ub (&color, 0xff, 0xff, 0xff, 0x88);
|
||||||
|
cogl_color (&color);
|
||||||
cogl_texture_rectangle (priv->texture_id,
|
cogl_texture_rectangle (priv->texture_id,
|
||||||
CLUTTER_INT_TO_FIXED (100),
|
CLUTTER_INT_TO_FIXED (100),
|
||||||
CLUTTER_INT_TO_FIXED (100),
|
CLUTTER_INT_TO_FIXED (100),
|
||||||
|
@ -176,9 +176,8 @@ static void
|
|||||||
test_coglbox_paint(ClutterActor *self)
|
test_coglbox_paint(ClutterActor *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
CoglColor cfill;
|
||||||
ClutterColor cfill;
|
CoglColor cstroke;
|
||||||
ClutterColor cstroke;
|
|
||||||
|
|
||||||
static GTimer *timer = NULL;
|
static GTimer *timer = NULL;
|
||||||
static gint paint_index = 0;
|
static gint paint_index = 0;
|
||||||
@ -203,15 +202,8 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
g_timer_start (timer);
|
g_timer_start (timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfill.red = 0;
|
cogl_color_set_from_4ub (&cfill, 0, 160, 0, 255);
|
||||||
cfill.green = 160;
|
cogl_color_set_from_4ub (&cstroke, 200, 0, 0, 255);
|
||||||
cfill.blue = 0;
|
|
||||||
cfill.alpha = 255;
|
|
||||||
|
|
||||||
cstroke.red = 200;
|
|
||||||
cstroke.green = 0;
|
|
||||||
cstroke.blue = 0;
|
|
||||||
cstroke.alpha = 255;
|
|
||||||
|
|
||||||
cogl_push_matrix ();
|
cogl_push_matrix ();
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ static void
|
|||||||
test_coglbox_paint(ClutterActor *self)
|
test_coglbox_paint(ClutterActor *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
CoglColor cback;
|
||||||
|
CoglColor cwhite;
|
||||||
|
|
||||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
|
||||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
|
||||||
ClutterFixed texcoords[4] = {
|
ClutterFixed texcoords[4] = {
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
@ -91,9 +91,11 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||||
cogl_color (&cback);
|
cogl_color (&cback);
|
||||||
cogl_rectangle (0,0,400,400);
|
cogl_rectangle (0,0,400,400);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||||
cogl_color (&cwhite);
|
cogl_color (&cwhite);
|
||||||
|
|
||||||
cogl_push_matrix ();
|
cogl_push_matrix ();
|
||||||
|
@ -79,9 +79,8 @@ static void
|
|||||||
test_coglbox_paint(ClutterActor *self)
|
test_coglbox_paint(ClutterActor *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
CoglColor cback;
|
||||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
CoglColor cwhite;
|
||||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
|
||||||
ClutterFixed texcoords[4] = {
|
ClutterFixed texcoords[4] = {
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||||
@ -91,9 +90,11 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||||
cogl_color (&cback);
|
cogl_color (&cback);
|
||||||
cogl_rectangle (0,0,400,400);
|
cogl_rectangle (0,0,400,400);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||||
cogl_color (&cwhite);
|
cogl_color (&cwhite);
|
||||||
|
|
||||||
cogl_push_matrix ();
|
cogl_push_matrix ();
|
||||||
|
@ -78,9 +78,8 @@ static void
|
|||||||
test_coglbox_paint(ClutterActor *self)
|
test_coglbox_paint(ClutterActor *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
CoglColor cback;
|
||||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
CoglColor cwhite;
|
||||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
|
||||||
ClutterFixed texcoords[4] = {
|
ClutterFixed texcoords[4] = {
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
@ -90,9 +89,11 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||||
cogl_color (&cback);
|
cogl_color (&cback);
|
||||||
cogl_rectangle (0,0,400,400);
|
cogl_rectangle (0,0,400,400);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||||
cogl_color (&cwhite);
|
cogl_color (&cwhite);
|
||||||
|
|
||||||
cogl_push_matrix ();
|
cogl_push_matrix ();
|
||||||
|
@ -89,8 +89,8 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
|||||||
ClutterFixed ty2)
|
ClutterFixed ty2)
|
||||||
{
|
{
|
||||||
CoglTextureVertex vertices[4];
|
CoglTextureVertex vertices[4];
|
||||||
|
CoglColor white;
|
||||||
int i;
|
int i;
|
||||||
static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
|
|
||||||
|
|
||||||
vertices[0].x = x1;
|
vertices[0].x = x1;
|
||||||
vertices[0].y = y1;
|
vertices[0].y = y1;
|
||||||
@ -115,14 +115,16 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
|||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
vertices[i].color.red = 255;
|
cogl_color_set_from_4ub (&(vertices[i].color),
|
||||||
vertices[i].color.green = 255;
|
255,
|
||||||
vertices[i].color.blue = 255;
|
255,
|
||||||
vertices[i].color.alpha = ((i ^ (i >> 1)) & 1) ? 0 : 128;
|
255,
|
||||||
|
((i ^ (i >> 1)) & 1) ? 0 : 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_texture_polygon (tex_id, 4, vertices, TRUE);
|
cogl_texture_polygon (tex_id, 4, vertices, TRUE);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
|
||||||
cogl_color (&white);
|
cogl_color (&white);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,12 +168,13 @@ static void
|
|||||||
test_coglbox_paint (ClutterActor *self)
|
test_coglbox_paint (ClutterActor *self)
|
||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
CoglHandle tex_handle = priv->use_sliced
|
CoglHandle tex_handle = priv->use_sliced ? priv->sliced_tex
|
||||||
? priv->sliced_tex : priv->not_sliced_tex;
|
: priv->not_sliced_tex;
|
||||||
|
CoglColor white;
|
||||||
int tex_width = cogl_texture_get_width (tex_handle);
|
int tex_width = cogl_texture_get_width (tex_handle);
|
||||||
int tex_height = cogl_texture_get_height (tex_handle);
|
int tex_height = cogl_texture_get_height (tex_handle);
|
||||||
static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
|
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
|
||||||
cogl_color (&white);
|
cogl_color (&white);
|
||||||
|
|
||||||
cogl_texture_set_filters (tex_handle,
|
cogl_texture_set_filters (tex_handle,
|
||||||
|
@ -80,8 +80,8 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
{
|
{
|
||||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||||
|
|
||||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
CoglColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
CoglColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
ClutterFixed texcoords[4] = {
|
ClutterFixed texcoords[4] = {
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||||
@ -116,9 +116,11 @@ test_coglbox_paint(ClutterActor *self)
|
|||||||
|
|
||||||
cogl_push_matrix ();
|
cogl_push_matrix ();
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||||
cogl_color (&cback);
|
cogl_color (&cback);
|
||||||
cogl_rectangle (0,0,400,400);
|
cogl_rectangle (0,0,400,400);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||||
cogl_color (&cwhite);
|
cogl_color (&cwhite);
|
||||||
cogl_translate (100,100,0);
|
cogl_translate (100,100,0);
|
||||||
cogl_texture_rectangle (priv->cogl_tex_id,
|
cogl_texture_rectangle (priv->cogl_tex_id,
|
||||||
|
@ -123,13 +123,14 @@ static void
|
|||||||
hand_pre_paint (ClutterActor *actor,
|
hand_pre_paint (ClutterActor *actor,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ClutterColor red = { 255, 0, 0, 128 };
|
CoglColor red;
|
||||||
guint w, h;
|
guint w, h;
|
||||||
|
|
||||||
g_assert (hand_pre_paint_guard == FALSE);
|
g_assert (hand_pre_paint_guard == FALSE);
|
||||||
|
|
||||||
clutter_actor_get_size (actor, &w, &h);
|
clutter_actor_get_size (actor, &w, &h);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&red, 255, 0, 0, 128);
|
||||||
cogl_color (&red);
|
cogl_color (&red);
|
||||||
cogl_rectangle (0, 0, w / 2, h / 2);
|
cogl_rectangle (0, 0, w / 2, h / 2);
|
||||||
|
|
||||||
@ -140,13 +141,14 @@ static void
|
|||||||
hand_post_paint (ClutterActor *actor,
|
hand_post_paint (ClutterActor *actor,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ClutterColor green = { 0, 255, 0, 128 };
|
CoglColor green;
|
||||||
guint w, h;
|
guint w, h;
|
||||||
|
|
||||||
g_assert (hand_pre_paint_guard == TRUE);
|
g_assert (hand_pre_paint_guard == TRUE);
|
||||||
|
|
||||||
clutter_actor_get_size (actor, &w, &h);
|
clutter_actor_get_size (actor, &w, &h);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&green, 0, 255, 0, 128);
|
||||||
cogl_color (&green);
|
cogl_color (&green);
|
||||||
cogl_rectangle (w / 2, h / 2, w / 2, h / 2);
|
cogl_rectangle (w / 2, h / 2, w / 2, h / 2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user