[cairo-commit] cairo-demo/cairo_snippets ChangeLog, 1.20,
1.21 Makefile, 1.11, 1.12 arc.cairo, 1.2,
1.3 arc_negative.cairo, 1.1, 1.2 cairo_snippets_gtk.c, 1.3,
1.4 cairo_snippets_pdf.c, 1.3, 1.4 cairo_snippets_png.c, 1.5,
1.6 cairo_snippets_ps.c, 1.1, 1.2 clip.cairo, 1.1,
1.2 clip_image.cairo, 1.1, 1.2 curve_rectangle.cairo, 1.1,
1.2 curve_to.cairo, 1.1, 1.2 fill_and_stroke.cairo, 1.1,
1.2 fill_and_stroke2.cairo, 1.1, 1.2 gradient.cairo, 1.2,
1.3 image.cairo, 1.1, 1.2 imagepattern.cairo, 1.1,
1.2 index.html_template, 1.1, 1.2 libsvg.cairo, 1.1,
1.2 operator_add.cairo, 1.3, 1.4 operator_atop.cairo, 1.3,
1.4 operator_atop_reverse.cairo, 1.3, 1.4 operator_in.cairo,
1.3, 1.4 operator_in_reverse.cairo, 1.3,
1.4 operator_out.cairo, 1.3, 1.4 operator_out_reverse.cairo,
1.3, 1.4 operator_over.cairo, 1.3,
1.4 operator_over_reverse.cairo, 1.3,
1.4 operator_saturate.cairo, 1.3, 1.4 operator_xor.cairo, 1.3,
1.4 path.cairo, 1.1, 1.2 prepare_snippets.c, 1.5,
1.6 set_line_cap.cairo, 1.1, 1.2 set_line_join.cairo, 1.1,
1.2 snippets.h, 1.3, 1.4 text.cairo, 1.2,
1.3 text_align_center.cairo, 1.1, 1.2 text_extents.cairo, 1.1,
1.2 xxx_clip_rectangle.cairo, 1.1, 1.2 xxx_dash.cairo, 1.2,
1.3 xxx_long_lines.cairo, 1.1,
1.2 xxx_multi_segment_caps.cairo, 1.1,
1.2 xxx_self_intersect.cairo, 1.2, 1.3
Oeyvind Kolaas
commit at pdx.freedesktop.org
Tue Jan 11 14:38:05 PST 2005
Committed by: pippin
Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory gabe:/tmp/cvs-serv29827
Modified Files:
ChangeLog Makefile arc.cairo arc_negative.cairo
cairo_snippets_gtk.c cairo_snippets_pdf.c cairo_snippets_png.c
cairo_snippets_ps.c clip.cairo clip_image.cairo
curve_rectangle.cairo curve_to.cairo fill_and_stroke.cairo
fill_and_stroke2.cairo gradient.cairo image.cairo
imagepattern.cairo index.html_template libsvg.cairo
operator_add.cairo operator_atop.cairo
operator_atop_reverse.cairo operator_in.cairo
operator_in_reverse.cairo operator_out.cairo
operator_out_reverse.cairo operator_over.cairo
operator_over_reverse.cairo operator_saturate.cairo
operator_xor.cairo path.cairo prepare_snippets.c
set_line_cap.cairo set_line_join.cairo snippets.h text.cairo
text_align_center.cairo text_extents.cairo
xxx_clip_rectangle.cairo xxx_dash.cairo xxx_long_lines.cairo
xxx_multi_segment_caps.cairo xxx_self_intersect.cairo
Log Message:
added normalization function, and removed then redundant initialization code from snippets
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ChangeLog 5 Jan 2005 22:32:30 -0000 1.20
+++ ChangeLog 11 Jan 2005 22:38:03 -0000 1.21
@@ -1,3 +1,15 @@
+2005-01-11 Ãyvind KolÃ¥s <pippin at freedesktop.org>
+
+ * prepare_snippets.c
+ * snippets.h: Added snippets_normalize () function.
+ * *.cairo: Added snippets_normalize (cr, width, height) before
+ drawing to all snippets.
+ * cairo_snippets_*.c: Removed common initialization.
+ * cairo_snippets_pdf.c:
+ * cairo_snippets_ps.c: Changed to use a 2x2 in test area.
+ * Makefile: Changed destination folder for publishing of snippets
+ on the web.
+
2005-01-05 Kristian Høgsberg <krh at redhat.com>
* Makefile (COMPILE_PROGS): Reenable PDF snippets.
Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/Makefile,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile 5 Jan 2005 22:32:30 -0000 1.11
+++ Makefile 11 Jan 2005 22:38:03 -0000 1.12
@@ -59,7 +59,7 @@
./cairo_snippets_html
scp: html
- scp *.png *.html *.css freedesktop.org:/home/www/cairo/samples/
+ scp *.png *.html *.css freedesktop.org:/srv/cairo.freedesktop.org/www/samples/
pngs: cairo_snippets_png
./cairo_snippets_png
Index: arc.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/arc.cairo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- arc.cairo 20 May 2004 14:33:23 -0000 1.2
+++ arc.cairo 11 Jan 2005 22:38:03 -0000 1.3
@@ -4,6 +4,8 @@
double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */
double angle2 = 180.0 * (M_PI/180.0); /* in radians */
+snippet_normalize (cr, width, height);
+
cairo_arc (cr, xc, yc, radius, angle1, angle2);
cairo_stroke (cr);
Index: arc_negative.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/arc_negative.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- arc_negative.cairo 20 May 2004 14:33:23 -0000 1.1
+++ arc_negative.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -4,6 +4,8 @@
double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */
double angle2 = 180.0 * (M_PI/180.0); /* in radians */
+snippet_normalize (cr, width, height);
+
cairo_arc_negative (cr, xc, yc, radius, angle1, angle2);
cairo_stroke (cr);
Index: cairo_snippets_gtk.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_gtk.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_snippets_gtk.c 29 Jun 2004 08:21:56 -0000 1.3
+++ cairo_snippets_gtk.c 11 Jan 2005 22:38:03 -0000 1.4
@@ -7,14 +7,9 @@
#include <gtk/gtk.h>
#include <stdio.h>
-#define WIDTH 1.0
-#define HEIGHT 1.0
-
-#define LINE_WIDTH 0.04
-
static GtkWidget *gtkcairo;
static GtkTextBuffer *source_buffer;
-int current_snippet=0;
+int current_snippet=0;
static void
paint (GtkWidget *widget,
@@ -25,20 +20,8 @@
gint height = widget->allocation.height;
cairo_save (cr);
- cairo_scale (cr, width/WIDTH, height/HEIGHT);
- cairo_rectangle (cr, 0,0, WIDTH, HEIGHT);
- cairo_set_rgb_color (cr, 1,1,1);
- cairo_fill (cr);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
- cairo_set_line_width (cr, LINE_WIDTH);
-
- snippet_do (cr, current_snippet);
+ snippet_do (cr, current_snippet, width, height);
cairo_restore (cr);
-
- cairo_set_line_width (cr, 2);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
- cairo_rectangle (cr, 0,0, width, height);
- cairo_stroke (cr);
}
static void
Index: cairo_snippets_pdf.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_pdf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_snippets_pdf.c 5 Jan 2005 22:32:30 -0000 1.3
+++ cairo_snippets_pdf.c 11 Jan 2005 22:38:03 -0000 1.4
@@ -4,15 +4,13 @@
#include "snippets.h"
-#define WIDTH 256
-#define HEIGHT 256
-
-#define X_INCHES (WIDTH / 96.0)
-#define Y_INCHES (HEIGHT / 96.0)
+#define X_INCHES 2
+#define Y_INCHES 2
#define X_PPI 300.0
#define Y_PPI 300.0
-#define LINE_WIDTH 0.04
+#define WIDTH X_INCHES * 96.0
+#define HEIGHT Y_INCHES * 96.0
/* add a page with the specified snippet to the output pdf file */
static void
@@ -53,21 +51,9 @@
fprintf (stdout, "processing %s", snippet_name[no]);
cairo_save (cr);
- cairo_scale (cr, WIDTH/1.0, HEIGHT/1.0);
- cairo_rectangle (cr, 0,0, 1.0, 1.0);
- cairo_set_rgb_color (cr, 1,1,1);
- cairo_fill (cr);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
-
- cairo_set_line_width (cr, LINE_WIDTH);
- snippet_do (cr, no);
+ snippet_do (cr, no, WIDTH, HEIGHT);
+ cairo_show_page (cr);
cairo_restore (cr);
- cairo_set_line_width (cr, 2);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
- cairo_rectangle (cr, 0,0, WIDTH, HEIGHT);
- cairo_stroke (cr);
-
- cairo_show_page (cr);
fprintf (stdout, "\n");
}
Index: cairo_snippets_png.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_png.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo_snippets_png.c 13 Oct 2004 18:24:11 -0000 1.5
+++ cairo_snippets_png.c 11 Jan 2005 22:38:03 -0000 1.6
@@ -50,21 +50,9 @@
cairo_set_target_png (cr, file, CAIRO_FORMAT_ARGB32, IMAGE_WIDTH, IMAGE_HEIGHT);
cairo_save (cr);
- cairo_scale (cr, IMAGE_WIDTH/1.0, IMAGE_HEIGHT/1.0);
- cairo_rectangle (cr, 0,0, 1.0, 1.0);
- cairo_set_rgb_color (cr, 1,1,1);
- cairo_fill (cr);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
-
- cairo_set_line_width (cr, LINE_WIDTH);
- snippet_do (cr, no);
+ snippet_do (cr, no, IMAGE_WIDTH, IMAGE_HEIGHT);
cairo_restore (cr);
- cairo_set_line_width (cr, 2);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
- cairo_rectangle (cr, 0,0, IMAGE_WIDTH, IMAGE_HEIGHT);
- cairo_stroke (cr);
-
cairo_show_page (cr);
fprintf (stdout, "\n");
Index: cairo_snippets_ps.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_ps.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo_snippets_ps.c 18 May 2004 15:22:50 -0000 1.1
+++ cairo_snippets_ps.c 11 Jan 2005 22:38:03 -0000 1.2
@@ -4,17 +4,15 @@
#include "snippets.h"
-#define WIDTH 256
-#define HEIGHT 256
-
-#define X_INCHES (WIDTH / 96.0)
-#define Y_INCHES (HEIGHT / 96.0)
+#define X_INCHES 2
+#define Y_INCHES 2
#define X_PPI 300.0
#define Y_PPI 300.0
-#define LINE_WIDTH 0.04
+#define WIDTH X_INCHES * 96.0
+#define HEIGHT Y_INCHES * 96.0
-/* add a page with the specified snippet to the output pdf file */
+/* add a page with the specified snippet to the output ps file */
static void
write_page (cairo_t *cr,
int no);
@@ -47,21 +45,9 @@
fprintf (stdout, "processing %s", snippet_name[no]);
cairo_save (cr);
- cairo_scale (cr, WIDTH/1.0, HEIGHT/1.0);
- cairo_rectangle (cr, 0,0, 1.0, 1.0);
- cairo_set_rgb_color (cr, 1,1,1);
- cairo_fill (cr);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
-
- cairo_set_line_width (cr, LINE_WIDTH);
- snippet_do (cr, no);
+ snippet_do (cr, no, WIDTH, HEIGHT);
+ cairo_show_page (cr);
cairo_restore (cr);
- cairo_set_line_width (cr, 2);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
- cairo_rectangle (cr, 0,0, WIDTH, HEIGHT);
- cairo_stroke (cr);
-
- cairo_show_page (cr);
fprintf (stdout, "\n");
}
Index: clip.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/clip.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- clip.cairo 29 May 2004 15:47:37 -0000 1.1
+++ clip.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,5 @@
+snippet_normalize (cr, width, height);
+
cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2 * M_PI);
cairo_clip (cr);
Index: clip_image.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/clip_image.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- clip_image.cairo 29 May 2004 15:47:37 -0000 1.1
+++ clip_image.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -2,6 +2,8 @@
char *buffer;
cairo_surface_t *image;
+snippet_normalize (cr, width, height);
+
cairo_arc (cr, 0.5, 0.5, 0.3, 0, 2*M_PI);
cairo_clip (cr);
cairo_new_path (cr); /* path not consumed by clip()*/
Index: curve_rectangle.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/curve_rectangle.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- curve_rectangle.cairo 19 May 2004 09:39:00 -0000 1.1
+++ curve_rectangle.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -7,6 +7,8 @@
double x1,y1;
+snippet_normalize (cr, width, height);
+
x1=x0+width;
y1=y0+height;
if (!width || !height)
Index: curve_to.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/curve_to.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- curve_to.cairo 20 May 2004 14:33:23 -0000 1.1
+++ curve_to.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -3,6 +3,8 @@
x2=0.6, y2=0.1,
x3=0.9, y3=0.5;
+snippet_normalize (cr, width, height);
+
cairo_move_to (cr, x, y);
cairo_curve_to (cr, x1, y1, x2, y2, x3, y3);
Index: fill_and_stroke.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/fill_and_stroke.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fill_and_stroke.cairo 16 May 2004 19:09:50 -0000 1.1
+++ fill_and_stroke.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,5 @@
+snippet_normalize (cr, width, height);
+
cairo_move_to (cr, 0.5, 0.1);
cairo_line_to (cr, 0.9, 0.9);
cairo_rel_line_to (cr, -0.4, 0.0);
Index: fill_and_stroke2.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/fill_and_stroke2.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fill_and_stroke2.cairo 16 May 2004 19:09:50 -0000 1.1
+++ fill_and_stroke2.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,5 @@
+snippet_normalize (cr, width, height);
+
cairo_move_to (cr, 0.5, 0.1);
cairo_line_to (cr, 0.9, 0.9);
cairo_rel_line_to (cr, -0.4, 0.0);
Index: gradient.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/gradient.cairo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gradient.cairo 18 May 2004 02:34:16 -0000 1.2
+++ gradient.cairo 11 Jan 2005 22:38:03 -0000 1.3
@@ -1,4 +1,7 @@
cairo_pattern_t *pat;
+
+snippet_normalize (cr, width, height);
+
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 1.0);
cairo_pattern_add_color_stop (pat, 1, 0, 0, 0, 1);
cairo_pattern_add_color_stop (pat, 0, 1, 1, 1, 1);
Index: image.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/image.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- image.cairo 16 May 2004 19:09:50 -0000 1.1
+++ image.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -2,6 +2,8 @@
char *buffer;
cairo_surface_t *image;
+snippet_normalize (cr, width, height);
+
buffer = read_png_argb32 (
"data/romedalen.png", &w,&h, &stride);
image = cairo_surface_create_for_image (
Index: imagepattern.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/imagepattern.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- imagepattern.cairo 13 Oct 2004 18:24:11 -0000 1.1
+++ imagepattern.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -4,6 +4,8 @@
cairo_pattern_t *pattern;
cairo_matrix_t *matrix;
+snippet_normalize (cr, width, height);
+
buffer = read_png_argb32 (
"data/romedalen.png", &w,&h, &stride);
image = cairo_surface_create_for_image (
Index: index.html_template
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/index.html_template,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- index.html_template 26 May 2004 21:06:45 -0000 1.1
+++ index.html_template 11 Jan 2005 22:38:03 -0000 1.2
@@ -4,7 +4,9 @@
</p>
<p>
- The <em>user space</em> is the unit square ( (0,0) - (1, 1) ).
+ The <em>user space</em> is the unit square ( (0,0) - (1, 1) ),
+ this user space is initialized byt the snippet_normalize function,
+ which also sets a line_width of 0.04.
The snippets are meant to be short, and easy to understand
</p>
Index: libsvg.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/libsvg.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- libsvg.cairo 16 May 2004 19:09:50 -0000 1.1
+++ libsvg.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,12 +1,13 @@
svg_cairo_t *svgc;
-int width,
- height;
+int w, h;
+
+snippet_normalize (cr, width, height);
svg_cairo_create (&svgc);
svg_cairo_parse (svgc, "data/home.svg");
-svg_cairo_get_size (svgc, &width, &height);
-cairo_scale (cr, 1.0/width, 1.0/height);
+svg_cairo_get_size (svgc, &w, &h);
+cairo_scale (cr, 1.0/w, 1.0/h);
svg_cairo_render (svgc, cr);
svg_cairo_destroy (svgc);
Index: operator_add.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_add.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_add.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_add.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,5 @@
+snippet_normalize (cr, width, height);
+
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
cairo_set_alpha (cr, 0.5);
Index: operator_atop.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_atop.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_atop.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_atop.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,5 @@
+snippet_normalize (cr, width, height);
+
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_ATOP);
cairo_set_alpha (cr, 0.5);
Index: operator_atop_reverse.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_atop_reverse.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_atop_reverse.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_atop_reverse.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_ATOP_REVERSE);
cairo_set_alpha (cr, 0.5);
Index: operator_in.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_in.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_in.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_in.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_IN);
cairo_set_alpha (cr, 0.5);
Index: operator_in_reverse.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_in_reverse.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_in_reverse.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_in_reverse.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_IN_REVERSE);
cairo_set_alpha (cr, 0.5);
Index: operator_out.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_out.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_out.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_out.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_OUT);
cairo_set_alpha (cr, 0.5);
Index: operator_out_reverse.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_out_reverse.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_out_reverse.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_out_reverse.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_OUT_REVERSE);
cairo_set_alpha (cr, 0.5);
Index: operator_over.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_over.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_over.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_over.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_alpha (cr, 0.5);
Index: operator_over_reverse.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_over_reverse.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_over_reverse.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_over_reverse.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_OVER_REVERSE);
cairo_set_alpha (cr, 0.5);
Index: operator_saturate.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_saturate.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_saturate.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_saturate.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_SATURATE);
cairo_set_alpha (cr, 0.5);
Index: operator_xor.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/operator_xor.cairo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- operator_xor.cairo 4 Jun 2004 15:37:27 -0000 1.3
+++ operator_xor.cairo 11 Jan 2005 22:38:03 -0000 1.4
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
snippet_set_bg_svg (cr, "data/freedesktop.svg");
cairo_set_operator (cr, CAIRO_OPERATOR_XOR);
cairo_set_alpha (cr, 0.5);
Index: path.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/path.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- path.cairo 16 May 2004 19:09:50 -0000 1.1
+++ path.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
cairo_move_to (cr, 0.5, 0.1);
cairo_line_to (cr, 0.9, 0.9);
cairo_rel_line_to (cr, -0.4, 0.0);
Index: prepare_snippets.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/prepare_snippets.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- prepare_snippets.c 13 Oct 2004 18:24:11 -0000 1.5
+++ prepare_snippets.c 11 Jan 2005 22:38:03 -0000 1.6
@@ -42,7 +42,7 @@
int i;
fprintf (out, "\n\nvoid\n"
- "snippet_do (cairo_t *cr, int snippet_no)\n"
+ "snippet_do (cairo_t *cr, int snippet_no, int width, int height)\n"
"{\n"
" switch (snippet_no) {\n");
@@ -168,6 +168,16 @@
"}\n"
);
+ fprintf (out,
+"void\n"
+"snippet_normalize (cairo_t *cr, double width, double height)\n"
+"{\n"
+" cairo_scale (cr, width, height);\n"
+" cairo_set_line_width (cr, 0.04);\n"
+"}\n"
+);
+
+
}
int
Index: set_line_cap.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/set_line_cap.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- set_line_cap.cairo 29 May 2004 15:47:37 -0000 1.1
+++ set_line_cap.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
cairo_set_line_width (cr, 0.12);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT); /* default */
cairo_move_to (cr, 0.25, 0.2); cairo_line_to (cr, 0.25, 0.8);
Index: set_line_join.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/set_line_join.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- set_line_join.cairo 29 May 2004 15:47:37 -0000 1.1
+++ set_line_join.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
cairo_set_line_width (cr, 0.16);
cairo_move_to (cr, 0.3, 0.33);
cairo_rel_line_to (cr, 0.2, -0.2);
Index: snippets.h
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/snippets.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- snippets.h 20 May 2004 13:17:20 -0000 1.3
+++ snippets.h 11 Jan 2005 22:38:03 -0000 1.4
@@ -23,12 +23,23 @@
/* run a snippet */
void
-snippet_do (cairo_t *cr, int snippet_no);
+snippet_do (cairo_t *cr,
+ int snippet_no,
+ int width,
+ int height);
/* utility function mapping a snippet name to a snippet number */
int
snippet_name2no (const char *name);
+/* normalize the coordinate system of the cairo drawable to a unit square,
+ * also sets the line width to 0.04
+ */
+void
+snippet_normalize (cairo_t *cr,
+ double width,
+ double height);
+
void
snippet_set_bg_png (cairo_t *cr, const char *file);
Index: text.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/text.cairo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- text.cairo 20 May 2004 14:33:23 -0000 1.2
+++ text.cairo 11 Jan 2005 22:38:03 -0000 1.3
@@ -1,3 +1,4 @@
+snippet_normalize (cr, width, height);
cairo_select_font (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_scale_font (cr, 0.35);
Index: text_align_center.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/text_align_center.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- text_align_center.cairo 26 May 2004 21:04:18 -0000 1.1
+++ text_align_center.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -3,6 +3,8 @@
const char *utf8 = "cairo";
double x,y;
+snippet_normalize (cr, width, height);
+
cairo_select_font (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
Index: text_extents.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/text_extents.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- text_extents.cairo 26 May 2004 21:04:18 -0000 1.1
+++ text_extents.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -3,6 +3,8 @@
const char *utf8 = "cairo";
double x,y;
+snippet_normalize (cr, width, height);
+
cairo_select_font (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
Index: xxx_clip_rectangle.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/xxx_clip_rectangle.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xxx_clip_rectangle.cairo 3 Aug 2004 18:44:59 -0000 1.1
+++ xxx_clip_rectangle.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -6,6 +6,9 @@
* When that works again, and is re-enabled, this test can be renamed
* without the xxx_.
*/
+
+snippet_normalize (cr, width, height);
+
cairo_new_path (cr);
cairo_move_to (cr, .25, .25);
cairo_line_to (cr, .25, .75);
Index: xxx_dash.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/xxx_dash.cairo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xxx_dash.cairo 20 May 2004 15:17:34 -0000 1.2
+++ xxx_dash.cairo 11 Jan 2005 22:38:03 -0000 1.3
@@ -11,8 +11,9 @@
int ndash = sizeof (dashes)/sizeof(dashes[0]);
double offset = -0.2;
-cairo_set_dash (cr, dashes, ndash, offset);
+snippet_normalize (cr, width, height);
+cairo_set_dash (cr, dashes, ndash, offset);
cairo_move_to (cr, 0.5, 0.1);
cairo_line_to (cr, 0.9, 0.9);
Index: xxx_long_lines.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/xxx_long_lines.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xxx_long_lines.cairo 16 May 2004 19:09:50 -0000 1.1
+++ xxx_long_lines.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,3 +1,5 @@
+snippet_normalize (cr, width, height);
+
cairo_move_to (cr, 0.1, -50);
cairo_line_to (cr, 0.1, 50);
cairo_set_rgb_color (cr, 1, 0 ,0);
Index: xxx_multi_segment_caps.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/xxx_multi_segment_caps.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xxx_multi_segment_caps.cairo 16 May 2004 19:09:50 -0000 1.1
+++ xxx_multi_segment_caps.cairo 11 Jan 2005 22:38:03 -0000 1.2
@@ -1,4 +1,5 @@
/* BUG: Caps are added only to the last subpath in a complex path */
+snippet_normalize (cr, width, height);
cairo_move_to (cr, 0.2, 0.3);
cairo_line_to (cr, 0.8, 0.3);
Index: xxx_self_intersect.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/xxx_self_intersect.cairo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xxx_self_intersect.cairo 18 May 2004 12:17:33 -0000 1.2
+++ xxx_self_intersect.cairo 11 Jan 2005 22:38:03 -0000 1.3
@@ -1,6 +1,8 @@
/* the minimally different shade of the right part of the bar
is an artifact of the self intersect bug described in BUGS */
+snippet_normalize (cr, width, height);
+
cairo_move_to (cr, 0.3, 0.3);
cairo_line_to (cr, 0.7, 0.3);
More information about the cairo-commit
mailing list