[cairo-commit] cairo-demo/cairo_snippets ChangeLog, 1.33, 1.34 cairo_snippets_png.c, 1.9, 1.10 cairo_snippets_ps.c, 1.4, 1.5 cairo_snippets_win32.c, 1.2, 1.3 prepare_snippets.c, 1.8, 1.9 snippets.h, 1.5, 1.6

Owen Taylor commit at pdx.freedesktop.org
Wed May 11 14:15:33 PDT 2005


Committed by: otaylor

Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory gabe:/tmp/cvs-serv1278

Modified Files:
	ChangeLog cairo_snippets_png.c cairo_snippets_ps.c 
	cairo_snippets_win32.c prepare_snippets.c snippets.h 
Log Message:
2005-05-11  Owen Taylor  <otaylor at redhat.com>

	* cairo_snippets_png.c cairo_snippets_ps.c cairo_snippets_win32.c
	snippets/*.cairo: Cairo API updates.

	* snippets.h: Remove a stray png-io.h include.

	* snippets/pattern_fill.cairo: Remove some unused extern 

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ChangeLog	3 May 2005 02:22:48 -0000	1.33
+++ ChangeLog	11 May 2005 21:15:31 -0000	1.34
@@ -1,3 +1,13 @@
+2005-05-11  Owen Taylor  <otaylor at redhat.com>
+
+	* cairo_snippets_png.c cairo_snippets_ps.c cairo_snippets_win32.c
+	snippets/*.cairo: Cairo API updates.
+
+	* snippets.h: Remove a stray png-io.h include.
+
+	* snippets/pattern_fill.cairo: Remove some unused extern 
+	prototypes that were breaking compilation.
+
 2005-05-02  Kristian Høgsberg  <krh at redhat.com>
 
 	* png_io.c:

Index: cairo_snippets_png.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_png.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cairo_snippets_png.c	3 May 2005 02:22:48 -0000	1.9
+++ cairo_snippets_png.c	11 May 2005 21:15:31 -0000	1.10
@@ -3,6 +3,7 @@
  */
 
 #include "snippets.h"
+#include <cairo-png.h>
 
 #define IMAGE_WIDTH  256
 #define IMAGE_HEIGHT 256
@@ -36,23 +37,24 @@
 snippet_do_png (int no)
 {
         cairo_t *cr;
+	cairo_surface_t *surface;
         char filename[1024];
 
         fprintf (stdout, "processing %s", snippet_name[no]);
 
-        cr = cairo_create ();
-
-        cairo_set_target_image_no_data (cr, CAIRO_FORMAT_ARGB32,
-					IMAGE_WIDTH, IMAGE_HEIGHT);
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+					      IMAGE_WIDTH, IMAGE_HEIGHT);
+        cr = cairo_create (surface);
 
         cairo_save (cr);
           snippet_do (cr, no, IMAGE_WIDTH, IMAGE_HEIGHT);
         cairo_restore (cr);
 
         sprintf (filename, "%s.png", snippet_name [no]);
-	cairo_surface_write_to_png (cairo_get_target_surface (cr), filename);
+	cairo_surface_write_to_png (surface, filename);
 
         fprintf (stdout, "\n");
 
+	cairo_surface_destroy (surface);
         cairo_destroy (cr);
 }

Index: cairo_snippets_ps.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_ps.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo_snippets_ps.c	21 Apr 2005 21:01:37 -0000	1.4
+++ cairo_snippets_ps.c	11 May 2005 21:15:31 -0000	1.5
@@ -23,17 +23,20 @@
 {
         int i;
         FILE *file;
+	cairo_surface_t *surface;
         cairo_t *cr;
 
         file = fopen ("snippets.ps", "w");
-        cr = cairo_create ();
-
-        cairo_set_target_ps (cr, file, X_INCHES, Y_INCHES, X_PPI, Y_PPI);
-
+	surface = cairo_ps_surface_create (file,
+					   X_INCHES, Y_INCHES,
+					   X_PPI, Y_PPI);
+	cr = cairo_create (surface);
+	
         for (i=0;i<snippet_count;i++)
              write_page (cr, i);
 
         cairo_destroy (cr);
+	cairo_surface_destroy (surface);
         fclose (file);
 
         return 0;

Index: cairo_snippets_win32.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_win32.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo_snippets_win32.c	2 Feb 2005 05:57:10 -0000	1.2
+++ cairo_snippets_win32.c	11 May 2005 21:15:31 -0000	1.3
@@ -18,13 +18,15 @@
 static void 
 on_paint (HDC hdc)
 {
-    cairo_t *cr = cairo_create ();
+    cairo_surface_t *surface;
+    cairo_t *cr;
     double line_width;
     cairo_font_extents_t font_extents;
 
-    cairo_set_target_win32 (cr, hdc);
+    surface = cairo_win32_surface_create (hdc);
+    cr = cairo_create (surface);
 
-    line_width = cairo_current_line_width (cr);
+    line_width = cairo_get_line_width (cr);
 
     /* Draw a box bordering the snippet */
     cairo_rectangle (cr,
@@ -33,8 +35,8 @@
     cairo_stroke (cr);
 
     /* And the name of the snippet */
-    cairo_scale_font (cr, FONT_SIZE);
-    cairo_current_font_extents (cr, &font_extents);
+    cairo_set_font_size (cr, FONT_SIZE);
+    cairo_font_extents (cr, &font_extents);
 
     cairo_move_to (cr,
 		   BORDER_WIDTH,
@@ -53,6 +55,7 @@
     cairo_restore (cr);
 
     cairo_destroy (cr);
+    cairo_surface_destroy (surface);
 }
 
 static void 

Index: prepare_snippets.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/prepare_snippets.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- prepare_snippets.c	3 May 2005 02:22:48 -0000	1.8
+++ prepare_snippets.c	11 May 2005 21:15:31 -0000	1.9
@@ -143,8 +143,8 @@
 "   h = cairo_image_surface_get_height (image);\n"
 "   cairo_save (cr);\n"
 "       cairo_scale (cr, 1.0/w, 1.0/h);\n"
-"       cairo_move_to (cr, 0,0);\n"
-"       cairo_show_surface (cr, image,w,h);\n"
+"       cairo_set_source_surface (cr, image, 0, 0);\n"
+"       cairo_paint (cr);\n"
 "   cairo_restore (cr);\n"
 "   cairo_surface_destroy (image);\n"
 "}\n"

Index: snippets.h
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/snippets.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- snippets.h	1 Feb 2005 22:58:09 -0000	1.5
+++ snippets.h	11 May 2005 21:15:31 -0000	1.6
@@ -10,7 +10,6 @@
 
 /* header files available for snippet usage */
 
-#include "png_io.h"
 #include <svg-cairo.h>
 #include <math.h>
 




More information about the cairo-commit mailing list