[cairo-commit]
cairo-demo/X11 ChangeLog, 1.6, 1.7 cairo-demo.c, 1.7,
1.8 cairo-spline.c, 1.7, 1.8
OEyvind Kolaas
commit at pdx.freedesktop.org
Tue May 11 07:45:35 PDT 2004
- Previous message: [cairo-commit] cairo BUGS,1.12,1.13 ChangeLog,1.191,1.192
- Next message: [cairo-commit] cairo-demo/gtkcairo_slide ChangeLog, 1.3,
1.4 cairo_custom.c, 1.2, 1.3 cairo_custom.h, 1.2, 1.3 puzzle.c,
1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: pippin
Update of /cvs/cairo/cairo-demo/X11
In directory pdx:/tmp/cvs-serv17375
Modified Files:
ChangeLog cairo-demo.c cairo-spline.c
Log Message:
replacing ct with cr
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/X11/ChangeLog,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** a/ChangeLog 6 Apr 2004 20:08:20 -0000 1.6
--- b/ChangeLog 11 May 2004 14:45:32 -0000 1.7
***************
*** 1,2 ****
--- 1,6 ----
+ 2004-05-11 Ãyvind KolÃ¥s <oeyvindk at hig.no>
+
+ * *.[ch] : replace ct with cr
+
2004-04-06 David Reveman <c99drn at cs.umu.se>
Index: cairo-demo.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/X11/cairo-demo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/cairo-demo.c 17 Mar 2004 17:44:26 -0000 1.7
--- b/cairo-demo.c 11 May 2004 14:45:32 -0000 1.8
***************
*** 33,39 ****
} win_t;
! static void triangle(cairo_t *ct);
! static void square(cairo_t *ct);
! static void bowtie(cairo_t *ct);
static void win_init(win_t *win);
static void win_deinit(win_t *win);
--- 33,39 ----
} win_t;
! static void triangle(cairo_t *cr);
! static void square(cairo_t *cr);
! static void bowtie(cairo_t *cr);
static void win_init(win_t *win);
static void win_deinit(win_t *win);
***************
*** 76,214 ****
#define SIZE 20
static void
! triangle(cairo_t *ct)
{
! cairo_move_to(ct, SIZE, 0);
! cairo_rel_line_to(ct, SIZE, 2*SIZE);
! cairo_rel_line_to(ct, -2*SIZE, 0);
! cairo_close_path(ct);
}
static void
! square(cairo_t *ct)
{
! cairo_move_to(ct, 0, 0);
! cairo_rel_line_to(ct, 2*SIZE, 0);
! cairo_rel_line_to(ct, 0, 2*SIZE);
! cairo_rel_line_to(ct, -2*SIZE, 0);
! cairo_close_path(ct);
}
static void
! bowtie(cairo_t *ct)
{
! cairo_move_to(ct, 0, 0);
! cairo_rel_line_to(ct, 2*SIZE, 2*SIZE);
! cairo_rel_line_to(ct, -2*SIZE, 0);
! cairo_rel_line_to(ct, 2*SIZE, -2*SIZE);
! cairo_close_path(ct);
}
static void
! inf(cairo_t *ct)
{
! cairo_move_to(ct, 0, SIZE);
! cairo_rel_curve_to(ct,
0, SIZE,
SIZE, SIZE,
2*SIZE, 0);
! cairo_rel_curve_to(ct,
SIZE, -SIZE,
2*SIZE, -SIZE,
2*SIZE, 0);
! cairo_rel_curve_to(ct,
0, SIZE,
-SIZE, SIZE,
-2*SIZE, 0);
! cairo_rel_curve_to(ct,
-SIZE, -SIZE,
-2*SIZE, -SIZE,
-2*SIZE, 0);
! cairo_close_path(ct);
}
static void
! draw_shapes(cairo_t *ct, int x, int y, int fill)
{
! cairo_save(ct);
! cairo_new_path(ct);
! cairo_translate(ct, x+SIZE, y+SIZE);
! bowtie(ct);
if (fill)
! cairo_fill(ct);
else
! cairo_stroke(ct);
! cairo_new_path(ct);
! cairo_translate(ct, 4*SIZE, 0);
! square(ct);
if (fill)
! cairo_fill(ct);
else
! cairo_stroke(ct);
! cairo_new_path(ct);
! cairo_translate(ct, 4*SIZE, 0);
! triangle(ct);
if (fill)
! cairo_fill(ct);
else
! cairo_stroke(ct);
! cairo_new_path(ct);
! cairo_translate(ct, 4*SIZE, 0);
! inf(ct);
if (fill)
! cairo_fill(ct);
else
! cairo_stroke(ct);
! cairo_restore(ct);
}
static void
! fill_shapes(cairo_t *ct, int x, int y)
{
! draw_shapes(ct, x, y, 1);
}
static void
! stroke_shapes(cairo_t *ct, int x, int y)
{
! draw_shapes(ct, x, y, 0);
}
/*
static void
! draw_broken_shapes(cairo_t *ct)
{
! cairo_save(ct);
! cairo_set_line_width(ct, 1);
! cairo_set_line_join(ct, CAIRO_LINE_JOIN_BEVEL);
! cairo_set_rgb_color(ct, 1, 1, 1);
! cairo_move_to(ct, 19.153717041015625, 144.93951416015625);
! cairo_line_to(ct, 412.987396240234375, 99.407318115234375);
! cairo_line_to(ct, 412.99383544921875, 99.4071807861328125);
! cairo_line_to(ct, 413.15008544921875, 99.5634307861328125);
! cairo_line_to(ct, 413.082489013671875, 99.6920928955078125);
! cairo_line_to(ct, 413.000274658203125, 99.71954345703125);
! cairo_line_to(ct, 273.852630615234375, 138.1925201416015625);
! cairo_line_to(ct, 273.934844970703125, 138.165069580078125);
! cairo_line_to(ct, 16.463653564453125, 274.753662109375);
! cairo_line_to(ct, 16.286346435546875, 274.496337890625);
! cairo_line_to(ct, 273.757537841796875, 137.907745361328125);
! cairo_line_to(ct, 273.839752197265625, 137.8802947998046875);
! cairo_line_to(ct, 412.987396240234375, 99.407318115234375);
! cairo_line_to(ct, 412.99383544921875, 99.4071807861328125);
! cairo_line_to(ct, 413.15008544921875, 99.5634307861328125);
! cairo_line_to(ct, 413.082489013671875, 99.6920928955078125);
! cairo_line_to(ct, 413.000274658203125, 99.71954345703125);
! cairo_line_to(ct, 19.166595458984375, 145.251739501953125);
! cairo_fill(ct);
! cairo_restore(ct);
}
*/
--- 76,214 ----
#define SIZE 20
static void
! triangle(cairo_t *cr)
{
! cairo_move_to(cr, SIZE, 0);
! cairo_rel_line_to(cr, SIZE, 2*SIZE);
! cairo_rel_line_to(cr, -2*SIZE, 0);
! cairo_close_path(cr);
}
static void
! square(cairo_t *cr)
{
! cairo_move_to(cr, 0, 0);
! cairo_rel_line_to(cr, 2*SIZE, 0);
! cairo_rel_line_to(cr, 0, 2*SIZE);
! cairo_rel_line_to(cr, -2*SIZE, 0);
! cairo_close_path(cr);
}
static void
! bowtie(cairo_t *cr)
{
! cairo_move_to(cr, 0, 0);
! cairo_rel_line_to(cr, 2*SIZE, 2*SIZE);
! cairo_rel_line_to(cr, -2*SIZE, 0);
! cairo_rel_line_to(cr, 2*SIZE, -2*SIZE);
! cairo_close_path(cr);
}
static void
! inf(cairo_t *cr)
{
! cairo_move_to(cr, 0, SIZE);
! cairo_rel_curve_to(cr,
0, SIZE,
SIZE, SIZE,
2*SIZE, 0);
! cairo_rel_curve_to(cr,
SIZE, -SIZE,
2*SIZE, -SIZE,
2*SIZE, 0);
! cairo_rel_curve_to(cr,
0, SIZE,
-SIZE, SIZE,
-2*SIZE, 0);
! cairo_rel_curve_to(cr,
-SIZE, -SIZE,
-2*SIZE, -SIZE,
-2*SIZE, 0);
! cairo_close_path(cr);
}
static void
! draw_shapes(cairo_t *cr, int x, int y, int fill)
{
! cairo_save(cr);
! cairo_new_path(cr);
! cairo_translate(cr, x+SIZE, y+SIZE);
! bowtie(cr);
if (fill)
! cairo_fill(cr);
else
! cairo_stroke(cr);
! cairo_new_path(cr);
! cairo_translate(cr, 4*SIZE, 0);
! square(cr);
if (fill)
! cairo_fill(cr);
else
! cairo_stroke(cr);
! cairo_new_path(cr);
! cairo_translate(cr, 4*SIZE, 0);
! triangle(cr);
if (fill)
! cairo_fill(cr);
else
! cairo_stroke(cr);
! cairo_new_path(cr);
! cairo_translate(cr, 4*SIZE, 0);
! inf(cr);
if (fill)
! cairo_fill(cr);
else
! cairo_stroke(cr);
! cairo_restore(cr);
}
static void
! fill_shapes(cairo_t *cr, int x, int y)
{
! draw_shapes(cr, x, y, 1);
}
static void
! stroke_shapes(cairo_t *cr, int x, int y)
{
! draw_shapes(cr, x, y, 0);
}
/*
static void
! draw_broken_shapes(cairo_t *cr)
{
! cairo_save(cr);
! cairo_set_line_width(cr, 1);
! cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL);
! cairo_set_rgb_color(cr, 1, 1, 1);
! cairo_move_to(cr, 19.153717041015625, 144.93951416015625);
! cairo_line_to(cr, 412.987396240234375, 99.407318115234375);
! cairo_line_to(cr, 412.99383544921875, 99.4071807861328125);
! cairo_line_to(cr, 413.15008544921875, 99.5634307861328125);
! cairo_line_to(cr, 413.082489013671875, 99.6920928955078125);
! cairo_line_to(cr, 413.000274658203125, 99.71954345703125);
! cairo_line_to(cr, 273.852630615234375, 138.1925201416015625);
! cairo_line_to(cr, 273.934844970703125, 138.165069580078125);
! cairo_line_to(cr, 16.463653564453125, 274.753662109375);
! cairo_line_to(cr, 16.286346435546875, 274.496337890625);
! cairo_line_to(cr, 273.757537841796875, 137.907745361328125);
! cairo_line_to(cr, 273.839752197265625, 137.8802947998046875);
! cairo_line_to(cr, 412.987396240234375, 99.407318115234375);
! cairo_line_to(cr, 412.99383544921875, 99.4071807861328125);
! cairo_line_to(cr, 413.15008544921875, 99.5634307861328125);
! cairo_line_to(cr, 413.082489013671875, 99.6920928955078125);
! cairo_line_to(cr, 413.000274658203125, 99.71954345703125);
! cairo_line_to(cr, 19.166595458984375, 145.251739501953125);
! cairo_fill(cr);
! cairo_restore(cr);
}
*/
***************
*** 219,223 ****
#define NUM_DASH 2
static double dash[NUM_DASH] = {SIZE/4.0, SIZE/4.0};
! cairo_t *ct;
#ifndef CAIRO_HAS_XCB_SURFACE
Drawable drawable = win->win;
--- 219,223 ----
#define NUM_DASH 2
static double dash[NUM_DASH] = {SIZE/4.0, SIZE/4.0};
! cairo_t *cr;
#ifndef CAIRO_HAS_XCB_SURFACE
Drawable drawable = win->win;
***************
*** 233,306 ****
#endif /* CAIRO_HAS_XCB_SURFACE */
! ct = cairo_create();
#ifndef CAIRO_HAS_XCB_SURFACE
! cairo_set_target_drawable (ct, win->dpy, drawable);
#else /* CAIRO_HAS_XCB_SURFACE */
! cairo_set_target_xcb (ct, win->dpy, drawable, win->visual, 0);
#endif /* CAIRO_HAS_XCB_SURFACE */
! cairo_set_rgb_color(ct, 1, 1, 1);
! cairo_save(ct);
! cairo_scale_font (ct, 20);
! cairo_move_to (ct, 10, 10);
! cairo_rotate(ct, PI / 2);
! cairo_show_text (ct, "Hello World.");
! cairo_restore(ct);
/*
! cairo_scale(ct, 5, 5);
! inf(ct);
! cairo_translate(ct, 0, 2 * SIZE);
! inf(ct);
! cairo_translate(ct, 0, - 2 * SIZE);
! cairo_clip(ct);
! cairo_scale(ct, 1/5.0, 1/5.0);
*/
/* This is handy for examining problems more closely */
! /* cairo_scale(ct, 4, 4); */
! cairo_set_line_width(ct, SIZE / 4);
! cairo_set_tolerance(ct, .1);
! cairo_set_line_join(ct, CAIRO_LINE_JOIN_ROUND);
! cairo_set_dash(ct, dash, NUM_DASH, 0);
! stroke_shapes(ct, 0, 0);
! cairo_translate(ct, 0, 4*SIZE);
! cairo_set_dash(ct, NULL, 0, 0);
! stroke_shapes(ct, 0, 0);
! cairo_translate(ct, 0, 4*SIZE);
! cairo_set_line_join(ct, CAIRO_LINE_JOIN_BEVEL);
! stroke_shapes(ct, 0, 0);
! cairo_translate(ct, 0, 4*SIZE);
! cairo_set_line_join(ct, CAIRO_LINE_JOIN_MITER);
! stroke_shapes(ct, 0, 0);
! cairo_translate(ct, 0, 4*SIZE);
! fill_shapes(ct, 0, 0);
! cairo_translate(ct, 0, 4*SIZE);
! cairo_set_line_join(ct, CAIRO_LINE_JOIN_BEVEL);
! fill_shapes(ct, 0, 0);
! cairo_set_rgb_color(ct, 1, 0, 0);
! stroke_shapes(ct, 0, 0);
/*
! draw_broken_shapes(ct);
*/
! if (cairo_status(ct)) {
! printf("Cairo is unhappy: %s\n", cairo_status_string(ct));
exit(0);
}
! cairo_destroy(ct);
}
--- 233,306 ----
#endif /* CAIRO_HAS_XCB_SURFACE */
! cr = cairo_create();
#ifndef CAIRO_HAS_XCB_SURFACE
! cairo_set_target_drawable (cr, win->dpy, drawable);
#else /* CAIRO_HAS_XCB_SURFACE */
! cairo_set_target_xcb (cr, win->dpy, drawable, win->visual, 0);
#endif /* CAIRO_HAS_XCB_SURFACE */
! cairo_set_rgb_color(cr, 1, 1, 1);
! cairo_save(cr);
! cairo_scale_font (cr, 20);
! cairo_move_to (cr, 10, 10);
! cairo_rotate(cr, PI / 2);
! cairo_show_text (cr, "Hello World.");
! cairo_restore(cr);
/*
! cairo_scale(cr, 5, 5);
! inf(cr);
! cairo_translate(cr, 0, 2 * SIZE);
! inf(cr);
! cairo_translate(cr, 0, - 2 * SIZE);
! cairo_clip(cr);
! cairo_scale(cr, 1/5.0, 1/5.0);
*/
/* This is handy for examining problems more closely */
! /* cairo_scale(cr, 4, 4); */
! cairo_set_line_width(cr, SIZE / 4);
! cairo_set_tolerance(cr, .1);
! cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
! cairo_set_dash(cr, dash, NUM_DASH, 0);
! stroke_shapes(cr, 0, 0);
! cairo_translate(cr, 0, 4*SIZE);
! cairo_set_dash(cr, NULL, 0, 0);
! stroke_shapes(cr, 0, 0);
! cairo_translate(cr, 0, 4*SIZE);
! cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL);
! stroke_shapes(cr, 0, 0);
! cairo_translate(cr, 0, 4*SIZE);
! cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER);
! stroke_shapes(cr, 0, 0);
! cairo_translate(cr, 0, 4*SIZE);
! fill_shapes(cr, 0, 0);
! cairo_translate(cr, 0, 4*SIZE);
! cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL);
! fill_shapes(cr, 0, 0);
! cairo_set_rgb_color(cr, 1, 0, 0);
! stroke_shapes(cr, 0, 0);
/*
! draw_broken_shapes(cr);
*/
! if (cairo_status(cr)) {
! printf("Cairo is unhappy: %s\n", cairo_status_string(cr));
exit(0);
}
! cairo_destroy(cr);
}
Index: cairo-spline.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/X11/cairo-spline.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/cairo-spline.c 8 Dec 2003 20:58:41 -0000 1.7
--- b/cairo-spline.c 11 May 2004 14:45:32 -0000 1.8
***************
*** 161,180 ****
static void
! draw_control_line(cairo_t *ct, pt_t *a, pt_t *b, double width)
{
! cairo_save(ct);
! cairo_set_rgb_color(ct, 0, 0, 1);
! cairo_set_line_width(ct, width);
! cairo_move_to(ct, a->x, a->y);
! cairo_line_to(ct, b->x, b->y);
! cairo_stroke(ct);
! cairo_restore(ct);
}
static void
! draw_spline(cairo_t *ct, win_t *win)
{
spline_t *spline = &win->spline;
--- 161,180 ----
static void
! draw_control_line(cairo_t *cr, pt_t *a, pt_t *b, double width)
{
! cairo_save(cr);
! cairo_set_rgb_color(cr, 0, 0, 1);
! cairo_set_line_width(cr, width);
! cairo_move_to(cr, a->x, a->y);
! cairo_line_to(cr, b->x, b->y);
! cairo_stroke(cr);
! cairo_restore(cr);
}
static void
! draw_spline(cairo_t *cr, win_t *win)
{
spline_t *spline = &win->spline;
***************
*** 185,228 ****
int i;
! cairo_inverse_transform_point (ct, &drag_user_x, &drag_user_y);
! cairo_save(ct);
! cairo_move_to(ct, spline->pt[0].x, spline->pt[0].y);
! cairo_curve_to(ct,
spline->pt[1].x, spline->pt[1].y,
spline->pt[2].x, spline->pt[2].y,
spline->pt[3].x, spline->pt[3].y);
! if (win->click && cairo_in_stroke (ct, drag_user_x, drag_user_y)) {
win->active = 0xf;
}
! cairo_stroke(ct);
! draw_control_line(ct, &spline->pt[0], &spline->pt[1], 2.0 / zoom);
! draw_control_line(ct, &spline->pt[3], &spline->pt[2], 2.0 / zoom);
for (i=0; i < 4; i++) {
! cairo_save(ct);
! cairo_set_rgb_color(ct, 1, 0, 0);
! cairo_set_alpha (ct, 0.5);
! cairo_new_path (ct);
! cairo_arc (ct,
spline->pt[i].x, spline->pt[i].y,
win->line_width / 1.25, 0, 2 * M_PI);
! if (win->click && cairo_in_fill (ct, drag_user_x, drag_user_y)) {
win->active = (1<<i);
win->click = 0;
}
! cairo_fill (ct);
! cairo_restore(ct);
}
! cairo_restore(ct);
}
--- 185,228 ----
int i;
! cairo_inverse_transform_point (cr, &drag_user_x, &drag_user_y);
! cairo_save(cr);
! cairo_move_to(cr, spline->pt[0].x, spline->pt[0].y);
! cairo_curve_to(cr,
spline->pt[1].x, spline->pt[1].y,
spline->pt[2].x, spline->pt[2].y,
spline->pt[3].x, spline->pt[3].y);
! if (win->click && cairo_in_stroke (cr, drag_user_x, drag_user_y)) {
win->active = 0xf;
}
! cairo_stroke(cr);
! draw_control_line(cr, &spline->pt[0], &spline->pt[1], 2.0 / zoom);
! draw_control_line(cr, &spline->pt[3], &spline->pt[2], 2.0 / zoom);
for (i=0; i < 4; i++) {
! cairo_save(cr);
! cairo_set_rgb_color(cr, 1, 0, 0);
! cairo_set_alpha (cr, 0.5);
! cairo_new_path (cr);
! cairo_arc (cr,
spline->pt[i].x, spline->pt[i].y,
win->line_width / 1.25, 0, 2 * M_PI);
! if (win->click && cairo_in_fill (cr, drag_user_x, drag_user_y)) {
win->active = (1<<i);
win->click = 0;
}
! cairo_fill (cr);
! cairo_restore(cr);
}
! cairo_restore(cr);
}
***************
*** 232,236 ****
Display *dpy = win->dpy;
! cairo_t *ct;
cairo_status_t status;
Drawable drawable = win->pix;
--- 232,236 ----
Display *dpy = win->dpy;
! cairo_t *cr;
cairo_status_t status;
Drawable drawable = win->pix;
***************
*** 238,261 ****
XFillRectangle(dpy, win->pix, win->gc, 0, 0, win->width, win->height);
! ct = cairo_create();
! cairo_set_target_drawable (ct, dpy, drawable);
! cairo_set_rgb_color(ct, 0, 0, 0);
! cairo_set_line_width(ct, win->line_width);
! cairo_set_line_cap(ct, win->line_cap);
! cairo_translate(ct, win->xtrans, win->ytrans);
! cairo_scale(ct, win->zoom, win->zoom);
! cairo_set_tolerance(ct, win->tolerance);
! draw_spline(ct, win);
! status = cairo_status(ct);
if (status) {
! fprintf(stderr, "Cairo is unhappy: %s\n", cairo_status_string(ct));
}
! cairo_destroy(ct);
XCopyArea(win->dpy, win->pix, win->win, win->gc,
--- 238,261 ----
XFillRectangle(dpy, win->pix, win->gc, 0, 0, win->width, win->height);
! cr = cairo_create();
! cairo_set_target_drawable (cr, dpy, drawable);
! cairo_set_rgb_color(cr, 0, 0, 0);
! cairo_set_line_width(cr, win->line_width);
! cairo_set_line_cap(cr, win->line_cap);
! cairo_translate(cr, win->xtrans, win->ytrans);
! cairo_scale(cr, win->zoom, win->zoom);
! cairo_set_tolerance(cr, win->tolerance);
! draw_spline(cr, win);
! status = cairo_status(cr);
if (status) {
! fprintf(stderr, "Cairo is unhappy: %s\n", cairo_status_string(cr));
}
! cairo_destroy(cr);
XCopyArea(win->dpy, win->pix, win->win, win->gc,
- Previous message: [cairo-commit] cairo BUGS,1.12,1.13 ChangeLog,1.191,1.192
- Next message: [cairo-commit] cairo-demo/gtkcairo_slide ChangeLog, 1.3,
1.4 cairo_custom.c, 1.2, 1.3 cairo_custom.h, 1.2, 1.3 puzzle.c,
1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list