diff options
author | Owen Taylor <otaylor@redhat.com> | 2005-05-07 18:05:17 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2005-05-07 18:05:17 +0000 |
commit | e174de1f25a84cae71518bfc5ac0f82e4cda964e (patch) | |
tree | 9d28624c016a505aaac889bda493b25f08cda47f /examples/cairosimple.c | |
parent | cdc77f57773bfb4639f15b77a14736658a3d9926 (diff) | |
download | pango-e174de1f25a84cae71518bfc5ac0f82e4cda964e.tar.gz |
Update for Cairo API changes.
2005-05-07 Owen Taylor <otaylor@redhat.com>
* pango/pangocairo-fontmap.c pango/pangocairo-render.c
examples/cairosimple.c pango/pangocairo-fcfont.c
examples/cairoview.c: Update for Cairo API changes.
Diffstat (limited to 'examples/cairosimple.c')
-rw-r--r-- | examples/cairosimple.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/cairosimple.c b/examples/cairosimple.c index 5ac00b39..27aaf044 100644 --- a/examples/cairosimple.c +++ b/examples/cairosimple.c @@ -35,7 +35,7 @@ draw_text (cairo_t *cr) /* Gradient from red at angle == 60 to blue at angle == 300 */ red = (1 + cos ((angle - 60) * G_PI / 180.)) / 2; - cairo_set_rgb_color (cr, red, 0, 1.0 - red); + cairo_set_source_rgb (cr, red, 0, 1.0 - red); cairo_rotate (cr, angle * G_PI / 180.); @@ -58,6 +58,7 @@ int main (int argc, char **argv) cairo_t *cr; char *filename; cairo_status_t status; + cairo_surface_t *surface; if (argc != 2) { @@ -67,17 +68,19 @@ int main (int argc, char **argv) filename = argv[1]; - cr = cairo_create(); - cairo_set_target_image_no_data (cr, - CAIRO_FORMAT_ARGB32, - 2 * RADIUS, 2 * RADIUS); + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + 2 * RADIUS, 2 * RADIUS); + cr = cairo_create (surface); + - cairo_set_rgb_color (cr, 1.0, 1.0, 1.0); + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_rectangle (cr, 0, 0, 2 * RADIUS, 2 * RADIUS); cairo_fill (cr); draw_text (cr); + cairo_destroy (cr); - status = cairo_surface_write_to_png (cairo_get_target_surface (cr), filename); + status = cairo_surface_write_to_png (surface, filename); + cairo_surface_destroy (surface); if (status != CAIRO_STATUS_SUCCESS) { @@ -85,7 +88,5 @@ int main (int argc, char **argv) return 1; } - cairo_destroy (cr); - return 0; } |