summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-04-18 15:11:01 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-04-18 15:11:01 +0000
commit9725c8d752fff8989a5496d58ef090a6858d476f (patch)
treec27e52445f1e421102e2b0a6ed956609c0716fb8 /tests
parent9bd53c868336b97bfa3e9c79450bd0e4ce668c21 (diff)
downloadgdk-pixbuf-9725c8d752fff8989a5496d58ef090a6858d476f.tar.gz
gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c Update to
2005-04-18 Owen Taylor <otaylor@redhat.com> * gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c * gdk/gdkcolor.c gdk/gdkwindow.c gdk/gdkpixbuf-render.c gdk/gdkpango.c tests/testcairo.c: Update to new Cairo API for setting color and opacity. (#301066, Vincent Noel)
Diffstat (limited to 'tests')
-rw-r--r--tests/testcairo.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/testcairo.c b/tests/testcairo.c
index 2e6eb7264..47abeb460 100644
--- a/tests/testcairo.c
+++ b/tests/testcairo.c
@@ -68,7 +68,7 @@ fill_checks (cairo_t *cr,
#define CHECK_SIZE 32
cairo_rectangle (cr, x, y, width, height);
- cairo_set_rgb_color (cr, 0.4, 0.4, 0.4);
+ cairo_set_source_rgb (cr, 0.4, 0.4, 0.4);
cairo_fill (cr);
/* Only works for CHECK_SIZE a power of 2 */
@@ -82,7 +82,7 @@ fill_checks (cairo_t *cr,
cairo_rectangle (cr, i, j, CHECK_SIZE, CHECK_SIZE);
}
- cairo_set_rgb_color (cr, 0.7, 0.7, 0.7);
+ cairo_set_source_rgb (cr, 0.7, 0.7, 0.7);
cairo_fill (cr);
}
@@ -92,25 +92,26 @@ fill_checks (cairo_t *cr,
static void
draw_3circles (cairo_t *cr,
double xc, double yc,
- double radius)
+ double radius,
+ double alpha)
{
double subradius = radius * (2 / 3. - 0.1);
- cairo_set_rgb_color (cr, 1., 0., 0.);
+ cairo_set_source_rgba (cr, 1., 0., 0., alpha);
oval_path (cr,
xc + radius / 3. * cos (G_PI * (0.5)),
yc - radius / 3. * sin (G_PI * (0.5)),
subradius, subradius);
cairo_fill (cr);
- cairo_set_rgb_color (cr, 0., 1., 0.);
+ cairo_set_source_rgba (cr, 0., 1., 0., alpha);
oval_path (cr,
xc + radius / 3. * cos (G_PI * (0.5 + 2/.3)),
yc - radius / 3. * sin (G_PI * (0.5 + 2/.3)),
subradius, subradius);
cairo_fill (cr);
- cairo_set_rgb_color (cr, 0., 0., 1.);
+ cairo_set_source_rgba (cr, 0., 0., 1., alpha);
oval_path (cr,
xc + radius / 3. * cos (G_PI * (0.5 + 4/.3)),
yc - radius / 3. * sin (G_PI * (0.5 + 4/.3)),
@@ -156,7 +157,7 @@ draw (cairo_t *cr,
/* Draw a black circle on the overlay
*/
- cairo_set_rgb_color (cr, 0., 0., 0.);
+ cairo_set_source_rgb (cr, 0., 0., 0.);
oval_path (cr, xc, yc, radius, radius);
cairo_fill (cr);
@@ -166,7 +167,7 @@ draw (cairo_t *cr,
/* Draw 3 circles to the punch surface, then cut
* that out of the main circle in the overlay
*/
- draw_3circles (cr, xc, yc, radius);
+ draw_3circles (cr, xc, yc, radius, 1.0);
cairo_restore (cr);
@@ -180,9 +181,8 @@ draw (cairo_t *cr,
cairo_save (cr);
cairo_set_target_surface (cr, circles);
- cairo_set_alpha (cr, 0.5);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- draw_3circles (cr, xc, yc, radius);
+ draw_3circles (cr, xc, yc, radius, 0.5);
cairo_restore (cr);