[cairo-commit] cairo-5c/examples animate.5c, 1.7, 1.8 draw.5c, 1.4,
1.5 fob.5c, 1.2, 1.3 metrics.5c, 1.1, 1.2 sin.5c, 1.4,
1.5 spin.5c, 1.2, 1.3 spinman.5c, 1.2, 1.3 test.5c, 1.4, 1.5
Keith Packard
commit at pdx.freedesktop.org
Tue May 17 23:21:18 PDT 2005
- Previous message: [cairo-commit] pycairo/cairo pycairo-font.c,1.19,1.20
- Next message: [cairo-commit] cairo-5c ChangeLog, 1.20, 1.21 cairo-5c.h, 1.13,
1.14 cairo.5c, 1.10, 1.11 cairo.c, 1.4, 1.5 draw.c, 1.6,
1.7 event.c, 1.4, 1.5 gstate.c, 1.8, 1.9 gtk.c, 1.8,
1.9 init.c, 1.13, 1.14 pattern.c, 1.5, 1.6 surface.c, 1.11,
1.12 text.c, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /cvs/cairo/cairo-5c/examples
In directory gabe:/tmp/cvs-serv17181/examples
Modified Files:
animate.5c draw.5c fob.5c metrics.5c sin.5c spin.5c spinman.5c
test.5c
Log Message:
2005-05-17 Keith Packard <keithp at keithp.com>
* cairo-5c.h:
* cairo.5c:
* cairo.c: (cairo_5c_get), (do_Cairo_create), (cairo_5c_dirty),
(cairo_5c_enable), (cairo_5c_disable), (do_Cairo_get_target):
* draw.c: (do_Cairo_paint), (do_Cairo_paint_with_alpha),
(do_Cairo_mask), (do_Cairo_mask_surface), (do_Cairo_fill_preserve),
(do_Cairo_stroke_preserve), (path_elt_new), (path_array),
(do_Cairo_copy_path), (do_Cairo_copy_path_flat),
(do_Cairo_append_path):
* event.c: (do_Cairo_Surface_open_event):
* examples/animate.5c:
* examples/draw.5c:
* examples/fob.5c:
* examples/metrics.5c:
* examples/sin.5c:
* examples/spin.5c:
* examples/spinman.5c:
* examples/test.5c:
* gstate.c: (do_Cairo_set_source_surface),
(do_Cairo_identity_matrix), (do_Cairo_transform),
(do_Cairo_user_to_device), (do_Cairo_user_to_device_distance),
(do_Cairo_device_to_user), (do_Cairo_device_to_user_distance),
(do_Cairo_reset_clip), (do_Cairo_clip_preserve):
* gtk.c: (create_gtk_global):
* init.c: (init_types), (nickle_init):
* pattern.c: (do_Cairo_Pattern_create_for_surface),
(do_Cairo_Pattern_add_color_stop_rgba),
(do_Cairo_Pattern_add_color_stop_rgb):
* surface.c: (cairo_5c_surface_get), (cairo_5c_surface_mark),
(cairo_5c_surface_destroy), (do_Cairo_Surface_write_to_png),
(do_Cairo_Surface_write_to_png_file),
(do_Cairo_Surface_set_device_offset),
(do_Cairo_Surface_create_similar), (do_Cairo_Surface_finish),
(do_Cairo_Surface_destroy), (do_Cairo_Surface_width),
(do_Cairo_Surface_height), (do_Cairo_Image_surface_create),
(do_Cairo_Image_surface_create_from_png),
(do_Cairo_Image_surface_create_from_png_file),
(do_Cairo_Pdf_surface_create):
* text.c: (do_Cairo_select_font_face), (do_Cairo_get_font_matrix):
Another round of API changes for cairo 0.5, the putative
final API structure.
Index: animate.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/animate.5c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- animate.5c 14 Mar 2005 21:52:22 -0000 1.7
+++ animate.5c 18 May 2005 06:21:16 -0000 1.8
@@ -39,7 +39,7 @@
void clear (cairo_t cr) {
save (cr);
identity_matrix (cr);
- set_rgb_color (cr, 1, 1, 1);
+ set_source_rgb (cr, 1, 1, 1);
int w = width (cr);
int h = height (cr);
move_to (cr, 0, 0);
@@ -62,11 +62,10 @@
void picture (cairo_t cr)
{
save (cr);
- set_rgb_color (cr, 0.6, .6, 1);
+ set_source_rgb (cr, 0.6, .6, 1);
move_to (cr, -10, 18);
show_text (cr, "nickle");
- set_rgb_color (cr, 0, 0, 0);
- set_alpha (cr, 0.5);
+ set_source_rgba (cr, 0, 0, 0, 0.5);
rotate (cr, pi/2);
move_to (cr, -10, -5);
show_text (cr, "cairo");
@@ -88,7 +87,7 @@
disable (cr);
save (cr);
translate (cr, n * 100, m * 100);
- set_rgb_color (cr, 1, 1, 1);
+ set_source_rgb (cr, 1, 1, 1);
rectangle (cr, 0, 0, 100, 100);
fill (cr);
transform (cr, t);
Index: draw.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/draw.5c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- draw.5c 2 May 2005 20:24:39 -0000 1.4
+++ draw.5c 18 May 2005 06:21:16 -0000 1.5
@@ -47,7 +47,7 @@
void transform_inplace (&real x, &real y)
{
- point_t a = inverse_transform_point (cr, (point_t) { x = x, y = y });
+ point_t a = device_to_user (cr, (point_t) { x = x, y = y });
x = a.x;
y = a.y;
}
Index: fob.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/fob.5c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fob.5c 2 May 2005 20:24:39 -0000 1.2
+++ fob.5c 18 May 2005 06:21:16 -0000 1.3
@@ -53,7 +53,7 @@
Pattern::add_color_stop (pat, 0, 1, 1, 1, 1);
Pattern::add_color_stop (pat, 1, 1, .8, .6, 1);
set_source (cr, pat);
- fill (cr);
+ fill_preserve (cr);
restore (cr);
scale (cr, 1/3.5, 1/4);
stroke (cr);
@@ -148,7 +148,7 @@
void letters (cairo_t cr)
{
save (cr);
- select_font (cr, "sans", font_slant_t.NORMAL, font_weight_t.NORMAL);
+ select_font_face (cr, "sans", font_slant_t.NORMAL, font_weight_t.NORMAL);
set_font_size (cr, 40);
rotate (cr, 90 * pi / 180);
translate (cr, 12, -20);
Index: metrics.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/metrics.5c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- metrics.5c 14 Mar 2005 21:52:22 -0000 1.1
+++ metrics.5c 18 May 2005 06:21:16 -0000 1.2
@@ -36,7 +36,7 @@
autoimport Cairo;
cairo_t cr = new ();
-scale_font (cr, 12);
+set_font_size (cr, 12);
for (t = 0; t <= 2 * pi; t += .1)
#t = -45 * pi / 180;
#t = 0;
Index: sin.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/sin.5c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sin.5c 2 May 2005 20:24:39 -0000 1.4
+++ sin.5c 18 May 2005 06:21:16 -0000 1.5
@@ -35,22 +35,7 @@
autoimport Cairo;
-void clear (foreign cr) {
- save (cr);
- identity_matrix (cr);
- set_source_rgb (cr, 1, 1, 1);
- int w = width (cr);
- int h = height (cr);
- move_to (cr, 0, 0);
- line_to (cr, w, 0);
- line_to (cr, w, h);
- line_to (cr, 0, h);
- fill (cr);
- restore (cr);
-}
-
void draw_sin (foreign cr) {
- clear (cr);
set_line_width (cr, sqrt (width(cr)**2 + height(cr)**2) * 0.01);
save (cr);
translate (cr, width(cr)/2, height(cr)/2);
Index: spin.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/spin.5c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- spin.5c 2 May 2005 20:24:39 -0000 1.2
+++ spin.5c 18 May 2005 06:21:16 -0000 1.3
@@ -78,10 +78,6 @@
void animate (cairo_t cr)
{
- cairo_t crl = create ();
- set_target_surface (crl, get_target_surface (cr));
- set_font (crl, "sans-12");
- set_source_rgb (crl, 0, 0, 0);
real t = 0;
for (;;)
{
@@ -90,8 +86,12 @@
translate (cr, 100, 100);
set_source_rgb (cr, 1, 1, 1);
clear (cr);
- move_to (crl, 3, 20);
- show_text (crl, sprintf ("%5.2f", t));
+ save (cr);
+ set_font (cr, "sans-12");
+ move_to (cr, 3, 20);
+ set_source_rgb (cr, 0, 0, 0);
+ show_text (cr, sprintf ("%5.2f", t));
+ restore (cr);
transform (cr, t);
picture (cr);
restore (cr);
Index: spinman.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/spinman.5c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- spinman.5c 2 May 2005 20:24:39 -0000 1.2
+++ spinman.5c 18 May 2005 06:21:16 -0000 1.3
@@ -95,7 +95,7 @@
void transform_inplace (&real x, &real y)
{
- point_t a = inverse_transform_point (cr, (point_t) { x = x, y = y });
+ point_t a = device_to_user (cr, (point_t) { x = x, y = y });
x = a.x;
y = a.y;
}
@@ -125,10 +125,6 @@
void animate (cairo_t cr)
{
- cairo_t crl = create ();
- set_target_surface (crl, get_target_surface (cr));
- set_font (crl, "sans-12");
- set_source_rgb (crl, 0, 0, 0);
translate (cr, 150, 150);
real t = 0;
bool down = false;
@@ -155,8 +151,12 @@
disable (cr);
save (cr);
clear (cr);
- move_to (crl, 3, 20);
- show_text (crl, sprintf ("%5.2f", t));
+ save (cr);
+ set_font (cr, "sans-12");
+ set_source_rgb (cr, 0, 0, 0);
+ move_to (cr, 3, 20);
+ show_text (cr, sprintf ("%5.2f", t));
+ restore (cr);
rotate (cr, t);
picture (cr);
restore (cr);
Index: test.5c
===================================================================
RCS file: /cvs/cairo/cairo-5c/examples/test.5c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test.5c 2 May 2005 20:24:39 -0000 1.4
+++ test.5c 18 May 2005 06:21:16 -0000 1.5
@@ -41,8 +41,7 @@
line_to (cr, 100, 100);
stroke (cr);
move_to (cr, 50, 50);
-set_source_rgb (cr, 0.8, 0, 0.5);
-set_alpha (cr, 0.5);
-scale_font (cr, 12);
+set_source_rgba (cr, 0.8, 0, 0.5, 0.5);
+set_font_size (cr, 12);
show_text (cr, "Hello, cairo");
sleep (100000);
- Previous message: [cairo-commit] pycairo/cairo pycairo-font.c,1.19,1.20
- Next message: [cairo-commit] cairo-5c ChangeLog, 1.20, 1.21 cairo-5c.h, 1.13,
1.14 cairo.5c, 1.10, 1.11 cairo.c, 1.4, 1.5 draw.c, 1.6,
1.7 event.c, 1.4, 1.5 gstate.c, 1.8, 1.9 gtk.c, 1.8,
1.9 init.c, 1.13, 1.14 pattern.c, 1.5, 1.6 surface.c, 1.11,
1.12 text.c, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list