From f135f2e7d5b7c5304ae4ba91a26f4dc0d5b0c757 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Fri, 12 Nov 2010 09:49:07 +0000 Subject: [PATCH 1/2] cookbook: Fix incorrect value for opacity Opacity is a guint, so don't use floating point numbers to set its value. --- doc/cookbook/examples/events-pointer-motion-stacked.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/cookbook/examples/events-pointer-motion-stacked.c b/doc/cookbook/examples/events-pointer-motion-stacked.c index a71293102..75bcbebaa 100644 --- a/doc/cookbook/examples/events-pointer-motion-stacked.c +++ b/doc/cookbook/examples/events-pointer-motion-stacked.c @@ -74,7 +74,7 @@ main (int argc, char *argv[]) clutter_actor_set_size (r3, 150, 150); clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.75)); clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.75)); - clutter_actor_set_opacity (r3, 125.5); + clutter_actor_set_opacity (r3, 125); clutter_actor_set_name (r3, "blue"); clutter_container_add (CLUTTER_CONTAINER (stage), r1, r2, r3, NULL); From 63721c5db1bc1c4a53ee2af536ffbd19b015fdb9 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Fri, 12 Nov 2010 09:54:12 +0000 Subject: [PATCH 2/2] cookbook: Fix opacity examples in recipe The recipe had examples where opacity was set using fractional numbers. Fixed all examples to use integers only. --- doc/cookbook/actors.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/cookbook/actors.xml b/doc/cookbook/actors.xml index 8c8a9a479..d590fce02 100644 --- a/doc/cookbook/actors.xml +++ b/doc/cookbook/actors.xml @@ -276,10 +276,10 @@ on_paint (ClutterActor *actor) /* 25% transparency */ -clutter_actor_set_opacity (actor, 191.25); +clutter_actor_set_opacity (actor, 191); /* 50% transparency */ -clutter_actor_set_opacity (actor, 122.5); +clutter_actor_set_opacity (actor, 122); /* completely transparent */ clutter_actor_set_opacity (actor, 0); @@ -325,13 +325,13 @@ clutter_actor_set_opacity (actor, 0); top-left: 255 (0% transparency) - top-right: 191.25 (25% transparency) + top-right: 191 (25% transparency) - bottom-right: 122.5 (50% transparency) + bottom-right: 122 (50% transparency) - bottom-left: 61.25 (75% transparency) + bottom-left: 61 (75% transparency) @@ -350,10 +350,10 @@ clutter_actor_set_opacity (actor, 0); If a container has its opacity set, any children of the container have their opacity combined with their parent's opacity. - For example, if a parent has an opacity of 122.5 + For example, if a parent has an opacity of 122 (50% transparent) and the child also has an opacity of - 122.5, the child's effective - opacity is 25% (opacity = 61.25, and it is + 122, the child's effective + opacity is 25% (opacity = 61, and it is 75% transparent). To demonstrate the visual effect of this, here are @@ -382,14 +382,14 @@ clutter_actor_set_opacity (actor, 0); The middle rectangle has opacity = 255 and is in a ClutterGroup with - opacity = 122.5. Notice that the parent opacity + opacity = 122. Notice that the parent opacity makes the rectangle appear darker, as the stage colour is showing through from behind. - The right-hand rectangle has opacity = 122.5 + The right-hand rectangle has opacity = 122 and is in a ClutterGroup with - opacity = 122.5. Notice that the rectangle appears + opacity = 122. Notice that the rectangle appears to be even darker, as the stage colour is showing through both the rectangle and its parent. @@ -405,12 +405,12 @@ clutter_actor_set_opacity (actor, 0);