[cairo-commit] cairo-demo/PS ChangeLog, 1.4, 1.5 Makefile, 1.5, 1.6 basket.c, 1.4, 1.5 write_png.c, 1.2, NONE

Carl Worth commit at pdx.freedesktop.org
Tue May 17 07:41:09 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo-demo/PS
In directory gabe:/tmp/cvs-serv1929

Modified Files:
	ChangeLog Makefile basket.c 
Removed Files:
	write_png.c 
Log Message:

        * Makefile:
        * basket.c: (main), (draw):
        * write_png.c: Update to latest cairo API changes.


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/PS/ChangeLog,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ChangeLog	28 Feb 2005 19:02:48 -0000	1.4
+++ ChangeLog	17 May 2005 14:41:07 -0000	1.5
@@ -1,3 +1,9 @@
+2005-05-17  Carl Worth  <cworth at cworth.org>
+
+	* Makefile:
+	* basket.c: (main), (draw):
+	* write_png.c: Update to latest cairo API changes.
+
 2005-02-28  Carl Worth  <cworth at cworth.org>
 
 	* Makefile (MYCFLAGS): Use canonical libpng12 name for pkgconfig

Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-demo/PS/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile	28 Feb 2005 19:02:48 -0000	1.5
+++ Makefile	17 May 2005 14:41:07 -0000	1.6
@@ -17,10 +17,8 @@
 %.o: %.c
 	$(CC) -c $(CFLAGS) $(CPPFLAGS) ${MYCFLAGS} $< -o $@
 
-%: %.c write_png.o
+%: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) ${MYCFLAGS} ${MYLDFLAGS} $^ -o $@
 
-write_png.o: write_png.c write_png.h
-
 clean:
 	rm -f ${EXAMPLES} *.o

Index: basket.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/PS/basket.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- basket.c	20 Jan 2005 16:32:57 -0000	1.4
+++ basket.c	17 May 2005 14:41:07 -0000	1.5
@@ -29,30 +29,20 @@
 #include <cairo-ps.h>
 #include <math.h>
 
-#include "write_png.h"
-
 void
 draw (cairo_t *cr);
 
-#define WIDTH	600
-#define HEIGHT  250
-#define STRIDE	(WIDTH*4)  
-
-#define X_INCHES	(WIDTH / 96.0)
-#define Y_INCHES	(HEIGHT / 96.0)
-#define X_PPI		300.0
-#define Y_PPI		300.0
-
-char image[STRIDE*HEIGHT];
+#define X_INCHES	8
+#define Y_INCHES	3
 
 #define FILENAME "basket.ps"
 
 int
 main (void)
 {
+    cairo_surface_t *surface;
     cairo_t *cr;
     FILE *file;
-    int i;
 
     file = fopen (FILENAME, "w");
     if (file == NULL) {
@@ -60,25 +50,14 @@
 	return 1;
     }
 
-    cr = cairo_create ();
+    surface = cairo_ps_surface_create (FILENAME,
+				       X_INCHES * 72.0,
+				       Y_INCHES * 72.0);
 
-    cairo_set_target_image (cr, image, CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT, STRIDE);
+    cr = cairo_create (surface);
 
     draw (cr);
-
-    write_png_argb32 (image, "basket.png", WIDTH, HEIGHT, STRIDE);
-
-    cairo_set_target_ps (cr, file, X_INCHES, Y_INCHES, X_PPI, Y_PPI);
-
-    for (i = 0; i <= 5 ; i++) {
-	draw (cr);
-	if (i == 0)
-	    cairo_copy_page (cr);
-	cairo_show_page (cr);
-	cairo_rotate (cr, - M_PI / 10.0);
-	cairo_translate (cr, 50, 100);
-	cairo_scale (cr, .5, .5);
-    }
+    cairo_show_page (cr);
 
     cairo_destroy (cr);
 
@@ -96,12 +75,11 @@
     cairo_close_path (cr);
 
     cairo_save (cr);
-    cairo_set_rgb_color (cr, .8, .1, .1);
-    cairo_fill (cr);
+    cairo_set_source_rgb (cr, .8, .1, .1);
+    cairo_fill_preserve (cr);
     cairo_restore (cr);
 
     cairo_set_line_width (cr, 6);
-    cairo_set_rgb_color (cr, 0., 0., 0.);
+    cairo_set_source_rgb (cr, 0., 0., 0.);
     cairo_stroke (cr);
 }
-

--- write_png.c DELETED ---




More information about the cairo-commit mailing list