[cairo-commit] cairo-5c/examples animate.5c, 1.4, 1.5 draw.5c, 1.1,
1.2 pie.5c, 1.4, 1.5 rottext.5c, 1.3, 1.4
Keith Packard
commit at pdx.freedesktop.org
Sat Dec 18 00:16:31 PST 2004
- Previous message: [cairo-commit] cairo-5c ChangeLog, 1.9, 1.10 Makefile.am, 1.3,
1.4 cairo-5c.h, 1.5, 1.6 cairo.5c, 1.3, 1.4 gstate.c, 1.3,
1.4 init.c, 1.6, 1.7 matrix.c, NONE, 1.1 pattern.c, NONE, 1.1
- Next message: [cairo-commit] cairo-5c ChangeLog, 1.10, 1.11 Makefile.am, 1.4,
1.5 cairo-5c.h, 1.6, 1.7 cairo.5c, 1.4, 1.5 gstate.c, 1.4,
1.5 init.c, 1.7, 1.8 pattern.c, 1.1, 1.2 surface.c, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /cvs/cairo/cairo-5c/examples
In directory gabe:/tmp/cvs-serv20227/examples
Modified Files:
animate.5c draw.5c pie.5c rottext.5c
Log Message:
2004-12-18 Keith Packard <keithp at keithp.com>
* Makefile.am:
* cairo.5c:
* examples/animate.5c:
* examples/draw.5c:
* examples/pie.5c:
* examples/rottext.5c:
Fix examples to match API changes
* gstate.c: (do_Cairo_transform_point),
(do_Cairo_transform_distance), (do_Cairo_inverse_transform_point),
(do_Cairo_inverse_transform_distance):
transforms take point_t, return point_t
* cairo-5c.h:
* init.c: (nickle_init):
* pattern.c: (do_Cairo_Pattern_create_for_surface),
(premultiply_data), (create_surface_from_png),
(do_Cairo_Pattern_create_png):
* surface.c: (get_cairo_5c), (free_cairo_5c), (dirty_cairo_5c),
(enable_cairo_5c), (disable_cairo_5c), (do_Cairo_new_png),
(do_Cairo_new_scratch), (do_Cairo_dup), (do_Cairo_status):
Add png loading, scratch surfaces and surface patterns
Index: animate.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/animate.5c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- animate.5c 17 Dec 2004 02:09:46 -0000 1.4
+++ animate.5c 18 Dec 2004 08:16:28 -0000 1.5
@@ -35,7 +35,7 @@
autoimport Cairo;
-void clear (foreign cr) {
+void clear (cairo_t cr) {
save (cr);
identity_matrix (cr);
set_rgb_color (cr, 1, 1, 1);
@@ -49,7 +49,7 @@
restore (cr);
}
-void rectangle (foreign cr, real x, real y, real w, real h)
+void rectangle (cairo_t cr, real x, real y, real w, real h)
{
move_to (cr, x, y);
rel_line_to (cr, w, 0);
@@ -58,7 +58,7 @@
close_path (cr);
}
-void picture (foreign cr)
+void picture (cairo_t cr)
{
save (cr);
set_rgb_color (cr, 0.6, .6, 1);
@@ -72,18 +72,20 @@
restore (cr);
}
-void transform (foreign cr, real t)
+void transform (cairo_t cr, real t)
{
translate (cr, 50, 50);
rotate (cr, t * pi / 60);
}
-void animate (foreign cr, mutex l, int n, int m)
+void animate (cairo_t cr, int n, int m)
{
+ cr = dup (cr);
+ select_font (cr, "Gadget", font_slant_t.NORMAL, font_weight_t.NORMAL);
+ scale_font (cr, 20);
real t = 0;
for (;;)
{
- Mutex::acquire (l);
disable (cr);
save (cr);
translate (cr, n * 100, m * 100);
@@ -94,7 +96,6 @@
picture (cr);
restore (cr);
enable (cr);
- Mutex::release (l);
sleep (100);
t += n + m + 1;
}
@@ -102,17 +103,14 @@
void main ()
{
- foreign cr = new ();
- mutex m;
- select_font (cr, "Gadget", 0, 0);
- scale_font (cr, 20);
- m = Mutex::new();
- fork animate (cr, m, 0, 0);
- fork animate (cr, m, 1, 0);
- fork animate (cr, m, 2, 0);
- fork animate (cr, m, 0, 1);
- fork animate (cr, m, 1, 1);
- thread t = fork animate (cr, m, 2, 1);
+ cairo_t cr = new ();
+
+ fork animate (cr, 0, 0);
+ fork animate (cr, 1, 0);
+ fork animate (cr, 2, 0);
+ fork animate (cr, 0, 1);
+ fork animate (cr, 1, 1);
+ thread t = fork animate (cr, 2, 1);
Thread::join (t);
}
Index: draw.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/draw.5c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- draw.5c 17 Dec 2004 02:09:46 -0000 1.1
+++ draw.5c 18 Dec 2004 08:16:28 -0000 1.2
@@ -47,9 +47,9 @@
void transform_inplace (&real x, &real y)
{
- real[2] a = inverse_transform_point (cr, (real[2]) { x, y });
- x = a[0];
- y = a[1];
+ point_t a = inverse_transform_point (cr, (point_t) { x = x, y = y });
+ x = a.x;
+ y = a.y;
}
while (!File::end (f))
Index: pie.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/pie.5c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pie.5c 17 Dec 2004 02:09:46 -0000 1.4
+++ pie.5c 18 Dec 2004 08:16:28 -0000 1.5
@@ -163,7 +163,7 @@
{
cairo_t cr = new (700, 700);
sleep (100);
- select_font (cr, "sans-serif", 0, 0);
+ select_font (cr, "sans-serif", font_slant_t.NORMAL, font_weight_t.NORMAL);
scale_font (cr, 10);
spiral_text (cr, sprintf ("%.-g", pi_value (bits)));
}
Index: rottext.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/rottext.5c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rottext.5c 17 Dec 2004 02:09:46 -0000 1.3
+++ rottext.5c 18 Dec 2004 08:16:28 -0000 1.4
@@ -38,7 +38,7 @@
void rottext () {
cairo_t cr = new ();
- select_font (cr, "sans-serif", SLANT_NORMAL, WEIGHT_NORMAL);
+ select_font (cr, "sans-serif", font_slant_t.NORMAL, font_weight_t.NORMAL);
scale_font (cr, 20);
set_rgb_color (cr, 0, 0, 0);
- Previous message: [cairo-commit] cairo-5c ChangeLog, 1.9, 1.10 Makefile.am, 1.3,
1.4 cairo-5c.h, 1.5, 1.6 cairo.5c, 1.3, 1.4 gstate.c, 1.3,
1.4 init.c, 1.6, 1.7 matrix.c, NONE, 1.1 pattern.c, NONE, 1.1
- Next message: [cairo-commit] cairo-5c ChangeLog, 1.10, 1.11 Makefile.am, 1.4,
1.5 cairo-5c.h, 1.6, 1.7 cairo.5c, 1.4, 1.5 gstate.c, 1.4,
1.5 init.c, 1.7, 1.8 pattern.c, 1.1, 1.2 surface.c, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list