[cairo-commit] cairo-demo/cairo_snippets ChangeLog, 1.32, 1.33 Makefile.am, 1.3, 1.4 cairo_snippets_png.c, 1.8, 1.9 png_io.c, 1.2, NONE png_io.h, 1.2, NONE prepare_snippets.c, 1.7, 1.8

Kristian Hogsberg commit at pdx.freedesktop.org
Mon May 2 19:22:50 PDT 2005


Committed by: krh

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

Modified Files:
	ChangeLog Makefile.am cairo_snippets_png.c prepare_snippets.c 
Removed Files:
	png_io.c png_io.h 
Log Message:
2005-05-02  Kristian Høgsberg  <krh at redhat.com>

        * png_io.c:
        * png_io.h:
        * cairo_snippets_png.c:
        * Makefile.am: Drop custom PNG IO functions and use cairo's new
        PNG functions.

        * prepare_snippets.c:
        * snippets/clip_image.cairo:
        * snippets/curve_rectangle.cairo:
        * snippets/fill_and_stroke.cairo:
        * snippets/fill_and_stroke2.cairo:
        * snippets/image.cairo:
        * snippets/imagepattern.cairo:
        * snippets/libsvg.cairo:
        * snippets/text.cairo: Port to cairos new group semantics by using
        cairo_fill_preserve() instead of cairo_save()/cairo_restore() to
        keep the current path after filling it.  Use
        cairo_image_surface_create_from_png() to load png files.  Fix
        pointer signedness in a couple of places.



Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- ChangeLog	21 Apr 2005 21:01:37 -0000	1.32
+++ ChangeLog	3 May 2005 02:22:48 -0000	1.33
@@ -1,3 +1,25 @@
+2005-05-02  Kristian Høgsberg  <krh at redhat.com>
+
+	* png_io.c:
+	* png_io.h:
+	* cairo_snippets_png.c:
+	* Makefile.am: Drop custom PNG IO functions and use cairo's new
+	PNG functions.
+	
+	* prepare_snippets.c:
+	* snippets/clip_image.cairo:
+	* snippets/curve_rectangle.cairo:
+	* snippets/fill_and_stroke.cairo:
+	* snippets/fill_and_stroke2.cairo:
+	* snippets/image.cairo:
+	* snippets/imagepattern.cairo:
+	* snippets/libsvg.cairo:
+	* snippets/text.cairo: Port to cairos new group semantics by using
+	cairo_fill_preserve() instead of cairo_save()/cairo_restore() to
+	keep the current path after filling it.  Use
+	cairo_image_surface_create_from_png() to load png files.  Fix
+	pointer signedness in a couple of places.
+
 2005-04-22  Carl Worth  <cworth at cworth.org>
 
 	* cairo_snippets_pdf.c:

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.am	24 Feb 2005 16:21:01 -0000	1.3
+++ Makefile.am	3 May 2005 02:22:48 -0000	1.4
@@ -20,7 +20,7 @@
 noinst_PROGRAMS =				\
 	prepare_snippets
 
-common_sources = png_io.c snippets.c
+common_sources = snippets.c
 
 cairo_snippets_gtk_SOURCES = $(common_sources) cairo_snippets_gtk.c
 cairo_snippets_gtk_LDADD=@SNIPPETS_LIBS@ @GTKCAIRO_LIBS@

Index: cairo_snippets_png.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_png.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo_snippets_png.c	2 Apr 2005 02:03:59 -0000	1.8
+++ cairo_snippets_png.c	3 May 2005 02:22:48 -0000	1.9
@@ -36,15 +36,10 @@
 snippet_do_png (int no)
 {
         cairo_t *cr;
-        FILE *file;
-        char pngfile[1024];
+        char filename[1024];
 
         fprintf (stdout, "processing %s", snippet_name[no]);
 
-        sprintf (pngfile, "%s.png", snippet_name [no]);
-
-        file = fopen (pngfile, "wb");
-
         cr = cairo_create ();
 
         cairo_set_target_image_no_data (cr, CAIRO_FORMAT_ARGB32,
@@ -54,10 +49,10 @@
           snippet_do (cr, no, IMAGE_WIDTH, IMAGE_HEIGHT);
         cairo_restore (cr);
 
-	cairo_surface_write_png (cairo_get_target_surface (cr), file);
+        sprintf (filename, "%s.png", snippet_name [no]);
+	cairo_surface_write_to_png (cairo_get_target_surface (cr), filename);
 
         fprintf (stdout, "\n");
 
         cairo_destroy (cr);
-        fclose (file);
 }

--- png_io.c DELETED ---

--- png_io.h DELETED ---

Index: prepare_snippets.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/prepare_snippets.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- prepare_snippets.c	21 Apr 2005 21:01:37 -0000	1.7
+++ prepare_snippets.c	3 May 2005 02:22:48 -0000	1.8
@@ -136,18 +136,17 @@
 "void\n"
 "snippet_set_bg_png (cairo_t *cr, const char *file)\n"
 "{\n"
-"   int w,h,stride;\n"
-"   unsigned char *buffer;\n"
+"   int w,h;\n"
 "   cairo_surface_t *image;\n"
-"   buffer = read_png_argb32 (file, &w,&h, &stride);\n"
-"   image = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_ARGB32,w,h,stride);\n"
+"   image = cairo_image_surface_create_from_png (file);\n"
+"   w = cairo_image_surface_get_width (image);\n"
+"   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_restore (cr);\n"
 "   cairo_surface_destroy (image);\n"
-"   free (buffer);\n"
 "}\n"
 );
 
@@ -155,7 +154,7 @@
 "void\n"
 "snippet_set_bg_svg (cairo_t *cr, const char *file)\n"
 "{\n"
-"   int width,height;\n"
+"   unsigned int width,height;\n"
 "   svg_cairo_t *svgc;\n"
 "   svg_cairo_create (&svgc);\n"
 "   svg_cairo_parse (svgc, file);\n"




More information about the cairo-commit mailing list