[cairo-commit]
cairo-demo/path_paint ChangeLog, 1.6, 1.7 README.txt,
1.2, 1.3 path_paint.c, 1.6, 1.7
Oeyvind Kolaas
commit at pdx.freedesktop.org
Sun Aug 7 16:59:50 PDT 2005
- Previous message: [cairo-commit] gtkcairo/tests demo.c,1.9,1.10
- Next message: [cairo-commit] cairo-demo/gtkcairo_slide ChangeLog, 1.9,
1.10 Makefile, 1.2, 1.3 gtkcairo_slide.c, 1.4, 1.5 puzzle.c,
1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: pippin
Update of /cvs/cairo/cairo-demo/path_paint
In directory gabe:/tmp/cvs-serv2068
Modified Files:
ChangeLog README.txt path_paint.c
Log Message:
update to work with cairo after api shakeup
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/path_paint/ChangeLog,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ChangeLog 15 Apr 2005 18:49:55 -0000 1.6
+++ ChangeLog 7 Aug 2005 23:59:48 -0000 1.7
@@ -1,3 +1,7 @@
+2005-08-09 Ãyvind KolÃ¥s <pippin at freedesktop.org>
+
+ * path_paint.c: update to work with current cairo api.
+
2005-04-15 Ãyvind KolÃ¥s <pippin at freedesktop.org>
* path_paint.c: use cairo_set_source_rgb?
Index: README.txt
===================================================================
RCS file: /cvs/cairo/cairo-demo/path_paint/README.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README.txt 29 May 2004 16:39:03 -0000 1.2
+++ README.txt 7 Aug 2005 23:59:48 -0000 1.3
@@ -27,6 +27,7 @@
Features this app would need, in approximate order of increments
to become a useful application.
+ - using gtk+ 's native cairo handling
- setting color
- load/save of png
- setting line width
Index: path_paint.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/path_paint/path_paint.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- path_paint.c 15 Apr 2005 18:49:55 -0000 1.6
+++ path_paint.c 7 Aug 2005 23:59:48 -0000 1.7
@@ -29,7 +29,8 @@
guchar buffer [WIDTH*HEIGHT*4];
guchar temp_buffer [WIDTH*HEIGHT*4];
-cairo_surface_t *backbuffer = NULL;
+cairo_surface_t *back_surface = NULL;
+cairo_surface_t *temp_surface = NULL;
cairo_t *cr_save = NULL;
gboolean pen_is_down = FALSE;
@@ -57,8 +58,7 @@
void
-drawapp_render (cairo_t *cr,
- guchar *buffer)
+drawapp_render (cairo_t *cr)
{
cairo_save (cr);
@@ -66,8 +66,9 @@
cairo_set_source_rgb (cr, 1,1,1);
cairo_fill (cr);
- cairo_move_to (cr, 0,0);
- cairo_show_surface (cr, backbuffer, WIDTH, HEIGHT);
+ cairo_set_source_surface (cr, back_surface, 0, 0);
+ cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
+ cairo_fill (cr);
cairo_set_line_width (cr, pen_radius*2);
cairo_set_source_rgba (cr, 1,1,1, 0.5);
@@ -93,7 +94,7 @@
void
apply_coords (guchar *buffer)
{
- drawapp_render (cr_save, buffer);
+ drawapp_render (cr_save);
memcpy (buffer, temp_buffer, HEIGHT*STRIDE);
}
@@ -120,7 +121,7 @@
cairo_t *cr,
gpointer data)
{
- drawapp_render (cr, buffer);
+ drawapp_render (cr);
}
void
@@ -159,15 +160,17 @@
init (void)
{
coords_clear ();
- cr_save = cairo_create ();
+
memset (buffer, 0, sizeof(buffer));
+ back_surface = cairo_image_surface_create_for_data (buffer,
+ CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT, STRIDE);
+
+ temp_surface = cairo_image_surface_create_for_data (temp_buffer,
+ CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT, STRIDE);
memset (temp_buffer, 0, sizeof(temp_buffer));
- cairo_set_target_image (cr_save, temp_buffer,
- CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT, STRIDE);
+ cr_save = cairo_create (temp_surface);
- backbuffer = cairo_surface_create_for_image (buffer,
- CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT, STRIDE);
}
/* just wrapping the gtk events */
- Previous message: [cairo-commit] gtkcairo/tests demo.c,1.9,1.10
- Next message: [cairo-commit] cairo-demo/gtkcairo_slide ChangeLog, 1.9,
1.10 Makefile, 1.2, 1.3 gtkcairo_slide.c, 1.4, 1.5 puzzle.c,
1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list