[cairo-commit] cairo-demo/cairo_snippets operator_add.cairo, NONE,
1.1 operator_atop.cairo, NONE, 1.1 operator_atop_reverse.cairo,
NONE, 1.1 operator_in.cairo, NONE,
1.1 operator_in_reverse.cairo, NONE, 1.1 operator_out.cairo,
NONE, 1.1 operator_out_reverse.cairo, NONE,
1.1 operator_over.cairo, NONE, 1.1 operator_over_reverse.cairo,
NONE, 1.1 operator_saturate.cairo, NONE,
1.1 operator_xor.cairo, NONE, 1.1 .cvsignore, 1.2,
1.3 ChangeLog, 1.11, 1.12 prepare_snippets.c, 1.1,
1.2 snippets.h, 1.1, 1.2
OEyvind Kolaas
commit at pdx.freedesktop.org
Wed May 19 11:11:36 PDT 2004
Committed by: pippin
Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory pdx:/tmp/cvs-serv25724
Modified Files:
.cvsignore ChangeLog prepare_snippets.c snippets.h
Added Files:
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
Log Message:
added operator tests, and snipepts.ps, snippets.pdf to .cvsignore
--- NEW FILE: operator_add.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_atop.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_ATOP);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_atop_reverse.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_ATOP_REVERSE);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_in.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_IN);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_in_reverse.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_IN_REVERSE);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_out.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_OUT);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_out_reverse.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_OUT_REVERSE);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_over.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_over_reverse.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_OVER_REVERSE);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_saturate.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_SATURATE);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
--- NEW FILE: operator_xor.cairo ---
snippet_set_bg_png (cr, "data/romedalen.png");
cairo_set_operator (cr, CAIRO_OPERATOR_XOR);
cairo_set_rgb_color (cr, 1,0,0);
cairo_rectangle (cr, 0.2,0.2, 0.5,0.5);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,1,0);
cairo_rectangle (cr, 0.4,0.4, 0.4,0.4);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0,0,1);
cairo_rectangle (cr, 0.6,0.6, 0.3,0.3);
cairo_fill (cr);
Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/.cvsignore 19 May 2004 15:17:09 -0000 1.2
--- b/.cvsignore 19 May 2004 18:11:24 -0000 1.3
***************
*** 1,3 ****
--- 1,6 ----
+ *.eps
*.png
+ snippets.ps
+ snippets.pdf
cairo_snippets_gtk
cairo_snippets_html
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** a/ChangeLog 19 May 2004 15:17:09 -0000 1.11
--- b/ChangeLog 19 May 2004 18:11:24 -0000 1.12
***************
*** 1,2 ****
--- 1,7 ----
+ 2004-05-19 OEyvind Kolaas <pippin at freedesktop.org>
+
+ * operator_*.cairo: added tests for compositing modes.
+ * .cvsignore: added snippets.ps and snippets.pdf
+
2004-05-19 Carl Worth <cworth at isi.edu>
Index: prepare_snippets.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/prepare_snippets.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/prepare_snippets.c 16 May 2004 19:09:50 -0000 1.1
--- b/prepare_snippets.c 19 May 2004 18:11:24 -0000 1.2
***************
*** 127,130 ****
--- 127,151 ----
" return -1;\n"
"}\n");
+
+
+ fprintf (out,
+ "void\n"
+ "snippet_set_bg_png (cairo_t *cr, const char *file)\n"
+ "{\n"
+ " int w,h,stride;\n"
+ " char *buffer;\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"
+ " 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"
+ );
+
}
Index: snippets.h
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/snippets.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/snippets.h 16 May 2004 19:09:50 -0000 1.1
--- b/snippets.h 19 May 2004 18:11:24 -0000 1.2
***************
*** 30,32 ****
--- 30,35 ----
snippet_name2no (const char *name);
+ void
+ snippet_set_bg_png (cairo_t *cr, const char *file);
+
#endif /* SNIPPETS_H */
More information about the cairo-commit
mailing list