[cairo-commit] cairo-5c/examples animate.5c, 1.1.1.1, 1.2 pie.5c,
1.2, 1.3 rottext.5c, 1.1.1.1, 1.2 sin.5c, 1.1.1.1, 1.2 test.5c,
1.1.1.1, 1.2
Keith Packard
commit at pdx.freedesktop.org
Tue Dec 14 00:34:29 PST 2004
- Previous message: [cairo-commit] cairo-5c .cvsignore, NONE, 1.1 ChangeLog, 1.3,
1.4 Makefile.am, 1.1.1.1, 1.2 cairo-5c.h, 1.1.1.1,
1.2 configure.in, 1.1.1.1, 1.2 draw.c, 1.1.1.1, 1.2 gstate.c,
1.1.1.1, 1.2 gtk.c, NONE, 1.1 init.c, 1.2, 1.3 surface.c,
1.1.1.1, 1.2 text.c, 1.1.1.1, 1.2
- Next message: [cairo-commit] cairo-5c ChangeLog, 1.4, 1.5 cairo-5c.h, 1.2,
1.3 gtk.c, 1.1, 1.2 init.c, 1.3, 1.4 surface.c, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /cvs/cairo/cairo-5c/examples
In directory gabe:/tmp/cvs-serv8842/examples
Modified Files:
animate.5c pie.5c rottext.5c sin.5c test.5c
Log Message:
2004-12-14 Keith Packard <keithp at keithp.com>
* .cvsignore:
* Makefile.am:
* cairo-5c.h:
* configure.in:
* draw.c: (do_Cairo_fill), (do_Cairo_stroke):
* gtk.c: (configure_event), (expose_event), (cairo_5c_window_new),
(repaint_x), (gtk_repaint_timeout), (gtk_thread_main), (start_x),
(dirty_x):
* init.c: (nickle_init):
* surface.c: (get_cairo_5c), (free_cairo_5c), (dirty_cairo_5c),
(do_Cairo_new):
* text.c: (do_Cairo_show_text):
Replace lame Xlib-based output with more capable gtk+ based output,
including backing storage and resize handling. Input still
isn't hooked up.
* gstate.c: (do_Cairo_current_matrix), (do_Cairo_set_matrix):
Add current_matrix and set_matrix functions; these only do affine
matrices.
* examples/animate.5c:
* examples/pie.5c:
* examples/rottext.5c:
* examples/sin.5c:
* examples/test.5c:
Update examples to use installed library
Index: animate.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/animate.5c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- animate.5c 11 Dec 2004 06:26:52 -0000 1.1.1.1
+++ animate.5c 14 Dec 2004 08:34:27 -0000 1.2
@@ -1,5 +1,5 @@
if (!Command::valid_name ((string[]) { "Cairo" }))
- Foreign::load (".libs/libcairo-5c.so");
+ Foreign::load ("libcairo-5c.so");
import Cairo;
@@ -66,15 +66,20 @@
}
}
-cr = new ();
-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);
-Thread::join (t);
+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);
+ Thread::join (t);
+}
+if (dim(argv) > 0) main ();
Index: pie.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/pie.5c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pie.5c 11 Dec 2004 08:28:11 -0000 1.2
+++ pie.5c 14 Dec 2004 08:34:27 -0000 1.3
@@ -172,3 +172,8 @@
scale_font (cr, 10);
spiral_text (cr, sprintf ("%.-g", pi_value (bits)));
}
+
+if (dim(argv) > 0) {
+ pie (8192);
+ while (true) sleep (1000);
+}
Index: rottext.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/rottext.5c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- rottext.5c 11 Dec 2004 06:26:52 -0000 1.1.1.1
+++ rottext.5c 14 Dec 2004 08:34:27 -0000 1.2
@@ -1,5 +1,5 @@
if (!Command::valid_name ((string[]) { "Cairo" }))
- Foreign::load (".libs/libcairo-5c.so");
+ Foreign::load ("libcairo-5c.so");
import Cairo;
Index: sin.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/sin.5c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- sin.5c 11 Dec 2004 06:26:52 -0000 1.1.1.1
+++ sin.5c 14 Dec 2004 08:34:27 -0000 1.2
@@ -1,3 +1,8 @@
+if (!Command::valid_name ((string[]) { "Cairo" }))
+ Foreign::load ("libcairo-5c.so");
+
+import Cairo;
+
void clear (foreign cr) {
save (cr);
identity_matrix (cr);
@@ -13,9 +18,19 @@
}
void draw_sin (foreign cr) {
- move_to (cr, 0, 0);
- for (real a = 0; a <= 2 * pi; a += pi/100) {
+ set_line_width (cr, sqrt (width(cr)**2 + height(cr)**2) * 0.01);
+ real[3,2] m = current_matrix (cr);
+ translate (cr, width(cr)/2, height(cr)/2);
+ scale (cr, .95 * width(cr) / (2 * pi), .95 * height(cr) / 2);
+ move_to (cr, -pi, 0);
+ for (real a = -pi; a <= pi; a += pi/100) {
line_to (cr, a, sin(a));
}
+ set_matrix (cr, m);
+ clear (cr);
stroke (cr);
}
+
+foreign cr = new ();
+draw_sin (cr);
+while (true) sleep (1000);
Index: test.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/test.5c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- test.5c 11 Dec 2004 06:26:52 -0000 1.1.1.1
+++ test.5c 14 Dec 2004 08:34:27 -0000 1.2
@@ -1,5 +1,10 @@
-#Foreign::load(".libs/libcairo-5c.so");
-#import Cairo;
+if (!Command::valid_name ((string[]) { "Cairo" }))
+ Foreign::load ("libcairo-5c.so");
+
+import Cairo;
+
+typedef foreign cairo_t;
+
cr = new ();
set_rgb_color (cr,0,0,0);
move_to (cr, 10, 10);
- Previous message: [cairo-commit] cairo-5c .cvsignore, NONE, 1.1 ChangeLog, 1.3,
1.4 Makefile.am, 1.1.1.1, 1.2 cairo-5c.h, 1.1.1.1,
1.2 configure.in, 1.1.1.1, 1.2 draw.c, 1.1.1.1, 1.2 gstate.c,
1.1.1.1, 1.2 gtk.c, NONE, 1.1 init.c, 1.2, 1.3 surface.c,
1.1.1.1, 1.2 text.c, 1.1.1.1, 1.2
- Next message: [cairo-commit] cairo-5c ChangeLog, 1.4, 1.5 cairo-5c.h, 1.2,
1.3 gtk.c, 1.1, 1.2 init.c, 1.3, 1.4 surface.c, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list