head 1.17; access; symbols; locks; strict; comment @ * @; 1.17 date 2005.07.25.21.28.09; author krh; state Exp; branches; next 1.16; commitid 3ff342e559664567; 1.16 date 2005.05.17.14.50.15; author cworth; state Exp; branches; next 1.15; commitid cd9428a04a64567; 1.15 date 2005.05.13.22.33.59; author cworth; state Exp; branches; next 1.14; commitid 23ab42852b564567; 1.14 date 2005.02.21.20.41.18; author cworth; state Exp; branches; next 1.13; 1.13 date 2005.01.20.16.32.30; author cworth; state Exp; branches; next 1.12; 1.12 date 2004.04.06.20.08.20; author davidr; state Exp; branches; next 1.11; 1.11 date 2003.12.08.20.58.35; author dajobe; state Exp; branches; next 1.10; 1.10 date 2003.11.20.17.58.14; author cworth; state Exp; branches; next 1.9; 1.9 date 2003.11.20.02.21.57; author cworth; state Exp; branches; next 1.8; 1.8 date 2003.11.20.02.14.41; author cworth; state Exp; branches; next 1.7; 1.7 date 2003.10.01.02.04.48; author jamey; state Exp; branches; next 1.6; 1.6 date 2003.09.29.15.23.34; author cworth; state Exp; branches; next 1.5; 1.5 date 2003.09.29.15.20.40; author cworth; state Exp; branches; next 1.4; 1.4 date 2003.09.29.15.17.00; author cworth; state Exp; branches; next 1.3; 1.3 date 2003.09.29.15.01.03; author cworth; state Exp; branches; next 1.2; 1.2 date 2003.09.04.13.54.29; author cworth; state Exp; branches; next 1.1; 1.1 date 2003.08.18.18.11.37; author cworth; state Exp; branches; next ; desc @@ 1.17 log @2005-07-25 Kristian Høgsberg * cairo-knockout.c (fill_checks, draw): Update for cairo_content_t API changes. @ text @/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Small example demonstrating emulating knockout-groups as in PDF-1.4 * using cairo_set_operator(). * * Owen Taylor, * v0.1 30 November 2002 * v0.2 1 December 2002 - typo fixes from Keith Packard * v0.3 17 April 2003 - Tracking changes in Xr, (Removal of Xr{Push,Pop}Group) * v0.4 29 September 2003 - Use cairo_rectangle rather than private rect_path * Use cairo_arc for oval_path * Keeping log of changes in ChangeLog/CVS now. (2003-11-19) Carl Worth */ #include #include #include #include #include #include /* Create a path that is a circular oval with radii xr, yr at xc, * yc. Since we use cairo_arc here it will provide as many splines as * necessary to be extremely accurate. */ static void oval_path (cairo_t *cr, double xc, double yc, double xr, double yr) { cairo_matrix_t matrix; cairo_get_matrix (cr, &matrix); cairo_translate (cr, xc, yc); cairo_scale (cr, 1.0, yr / xr); cairo_move_to (cr, xr, 0.0); cairo_arc (cr, 0, 0, xr, 0, 2 * M_PI); cairo_close_path (cr); cairo_set_matrix (cr, &matrix); } /* Fill the given area with checks in the standard style * for showing compositing effects. */ static void fill_checks (cairo_t *cr, int x, int y, int width, int height) { cairo_surface_t *check; cairo_pattern_t *check_pattern; cairo_save (cr); #define CHECK_SIZE 32 check = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR, 2 * CHECK_SIZE, 2 * CHECK_SIZE); /* Draw the check */ { cairo_t *cr2; cr2 = cairo_create (check); cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE); cairo_set_source_rgb (cr2, 0.4, 0.4, 0.4); cairo_rectangle (cr2, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE); cairo_fill (cr2); cairo_set_source_rgb (cr2, 0.7, 0.7, 0.7); cairo_rectangle (cr2, x, y, CHECK_SIZE, CHECK_SIZE); cairo_fill (cr2); cairo_rectangle (cr2, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE); cairo_fill (cr2); cairo_destroy (cr2); } /* Fill the whole surface with the check */ check_pattern = cairo_pattern_create_for_surface (check); cairo_pattern_set_extend (check_pattern, CAIRO_EXTEND_REPEAT); cairo_set_source (cr, check_pattern); cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); cairo_pattern_destroy (check_pattern); cairo_surface_destroy (check); cairo_restore (cr); } /* Draw a red, green, and blue circle equally spaced inside * the larger circle of radius r at (xc, yc) */ static void draw_3circles (cairo_t *cr, double xc, double yc, double radius, double alpha) { double subradius = radius * (2 / 3. - 0.1); cairo_set_source_rgba (cr, 1., 0., 0., alpha); oval_path (cr, xc + radius / 3. * cos (M_PI * (0.5)), yc - radius / 3. * sin (M_PI * (0.5)), subradius, subradius); cairo_fill (cr); cairo_set_source_rgba (cr, 0., 1., 0., alpha); oval_path (cr, xc + radius / 3. * cos (M_PI * (0.5 + 2/.3)), yc - radius / 3. * sin (M_PI * (0.5 + 2/.3)), subradius, subradius); cairo_fill (cr); cairo_set_source_rgba (cr, 0., 0., 1., alpha); oval_path (cr, xc + radius / 3. * cos (M_PI * (0.5 + 4/.3)), yc - radius / 3. * sin (M_PI * (0.5 + 4/.3)), subradius, subradius); cairo_fill (cr); } static void draw (cairo_t *cr, int width, int height) { cairo_surface_t *overlay, *punch, *circles; /* Fill the background */ double radius = 0.5 * (width < height ? width : height) - 10; double xc = width / 2.; double yc = height / 2.; overlay = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, width, height); if (overlay == NULL) return; punch = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_ALPHA, width, height); if (punch == NULL) return; circles = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, width, height); if (circles == NULL) return; fill_checks (cr, 0, 0, width, height); cairo_save (cr); { cairo_t *cr_overlay; cr_overlay = cairo_create (overlay); /* Draw a black circle on the overlay */ cairo_set_source_rgb (cr_overlay, 0., 0., 0.); oval_path (cr_overlay, xc, yc, radius, radius); cairo_fill (cr_overlay); { cairo_t *cr_tmp; cr_tmp = cairo_create (punch); /* Draw 3 circles to the punch surface, then cut * that out of the main circle in the overlay */ draw_3circles (cr_tmp, xc, yc, radius, 1.0); cairo_destroy (cr_tmp); } cairo_set_operator (cr_overlay, CAIRO_OPERATOR_DEST_OUT); cairo_set_source_surface (cr_overlay, punch, 0, 0); cairo_paint (cr_overlay); /* Now draw the 3 circles in a subgroup again * at half intensity, and use OperatorAdd to join up * without seams. */ { cairo_t *cr_tmp; cr_tmp = cairo_create (circles); cairo_set_operator (cr_tmp, CAIRO_OPERATOR_OVER); draw_3circles (cr_tmp, xc, yc, radius, 0.5); cairo_destroy (cr_tmp); } cairo_set_operator (cr_overlay, CAIRO_OPERATOR_ADD); cairo_set_source_surface (cr_overlay, circles, 0, 0); cairo_paint (cr_overlay); cairo_destroy (cr_overlay); } cairo_set_source_surface (cr, overlay, 0, 0); cairo_paint (cr); cairo_surface_destroy (overlay); cairo_surface_destroy (punch); cairo_surface_destroy (circles); } int main (int argc, char **argv) { Display *dpy; int screen; Window w; Pixmap pixmap; char *title = "cairo: Knockout Groups"; unsigned int quit_keycode; int needs_redraw; GC gc; XWMHints *wmhints; XSizeHints *normalhints; XClassHint *classhint; int width = 400; int height = 400; dpy = XOpenDisplay (NULL); screen = DefaultScreen (dpy); w = XCreateSimpleWindow (dpy, RootWindow (dpy, screen), 0, 0, width, height, 0, BlackPixel (dpy, screen), WhitePixel (dpy, screen)); normalhints = XAllocSizeHints (); normalhints->flags = 0; normalhints->x = 0; normalhints->y = 0; normalhints->width = width; normalhints->height = height; classhint = XAllocClassHint (); classhint->res_name = "cairo-knockout"; classhint->res_class = "Cairo-knockout"; wmhints = XAllocWMHints (); wmhints->flags = InputHint; wmhints->input = True; XmbSetWMProperties (dpy, w, title, "cairo-knockout", 0, 0, normalhints, wmhints, classhint); XFree (wmhints); XFree (classhint); XFree (normalhints); pixmap = XCreatePixmap (dpy, w, width, height, DefaultDepth (dpy, screen)); gc = XCreateGC (dpy, pixmap, 0, NULL); quit_keycode = XKeysymToKeycode(dpy, XStringToKeysym("Q")); XSelectInput (dpy, w, ExposureMask | StructureNotifyMask | ButtonPressMask | KeyPressMask); XMapWindow (dpy, w); needs_redraw = 1; while (1) { XEvent xev; /* Only do the redraw if there are no events pending. This * avoids us getting behind doing several redraws for several * consecutive resize events for example. */ if (!XPending (dpy) && needs_redraw) { cairo_surface_t *surface; cairo_t *cr; surface = cairo_xlib_surface_create (dpy, pixmap, DefaultVisual (dpy, DefaultScreen (dpy)), width, height); cr = cairo_create (surface); draw (cr, width, height); cairo_destroy (cr); cairo_surface_destroy (surface); XCopyArea (dpy, pixmap, w, gc, 0, 0, width, height, 0, 0); needs_redraw = 0; } XNextEvent (dpy, &xev); switch (xev.xany.type) { case ButtonPress: /* A click on the canvas ends the program */ goto DONE; case KeyPress: if (xev.xkey.keycode == quit_keycode) goto DONE; break; case ConfigureNotify: /* Note new size and create new pixmap. */ width = xev.xconfigure.width; height = xev.xconfigure.height; XFreePixmap (dpy, pixmap); pixmap = XCreatePixmap (dpy, w, width, height, DefaultDepth (dpy, screen)); needs_redraw = 1; break; case Expose: XCopyArea (dpy, pixmap, w, gc, xev.xexpose.x, xev.xexpose.y, xev.xexpose.width, xev.xexpose.height, xev.xexpose.x, xev.xexpose.y); break; } } DONE: XFreeGC (dpy, gc); XCloseDisplay (dpy); return 0; } @ 1.16 log @ * cairo-demo-xcb.c: (win_draw): * cairo-demo.c: (win_draw): * cairo-knockout.c: (main): * cairo-spline.c: (win_refresh): Update for yet more cairo API changes. @ text @d63 2 a64 2 CAIRO_FORMAT_RGB24, 2 * CHECK_SIZE, 2 * CHECK_SIZE); d149 2 a150 2 CAIRO_FORMAT_ARGB32, width, height); d155 2 a156 2 CAIRO_FORMAT_A8, width, height); d161 2 a162 2 CAIRO_FORMAT_ARGB32, width, height); @ 1.15 log @ * .cvsignore: * Makefile: * cairo-demo-xcb.c: Split XCB stuff out out cairo-demo and into its own cairo-demo-xcb. * cairo-demo.c: * cairo-demo-xcb.c: * cairo-knockout.c: * cairo-spline.c: Update all X11 demos to latest cairo API changes. @ text @d16 1 d295 3 a297 3 surface = cairo_xlib_surface_create_for_pixmap_with_visual (dpy, pixmap, DefaultVisual (dpy, DefaultScreen (dpy))); @ 1.14 log @ * cairo-knockout.c (main): Switch from Xutf8SetWMProperties to XmbSetWMProperties for better portability to Solaris. @ text @d30 1 a30 1 cairo_matrix_t *matrix; d32 1 a32 2 matrix = cairo_matrix_create (); cairo_current_matrix (cr, matrix); d43 1 a43 2 cairo_set_matrix (cr, matrix); cairo_matrix_destroy (matrix); d61 1 a61 1 check = cairo_surface_create_similar (cairo_current_target_surface (cr), a63 1 cairo_surface_set_repeat (check, 1); d67 1 a67 1 cairo_save (cr); d69 1 a69 1 cairo_set_target_surface (cr, check); d71 1 a71 1 cairo_set_operator (cr, CAIRO_OPERATOR_SRC); d73 1 a73 1 cairo_set_rgb_color (cr, 0.4, 0.4, 0.4); d75 2 a76 2 cairo_rectangle (cr, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE); cairo_fill (cr); d78 1 a78 1 cairo_set_rgb_color (cr, 0.7, 0.7, 0.7); d80 4 a83 4 cairo_rectangle (cr, x, y, CHECK_SIZE, CHECK_SIZE); cairo_fill (cr); cairo_rectangle (cr, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE); cairo_fill (cr); d85 1 a85 1 cairo_restore (cr); d91 2 a92 1 cairo_set_pattern (cr, check_pattern); d108 2 a109 1 double radius) d113 1 a113 1 cairo_set_rgb_color (cr, 1., 0., 0.); d120 1 a120 1 cairo_set_rgb_color (cr, 0., 1., 0.); d127 1 a127 1 cairo_set_rgb_color (cr, 0., 0., 1.); d147 1 a147 1 overlay = cairo_surface_create_similar (cairo_current_target_surface (cr), d153 1 a153 1 punch = cairo_surface_create_similar (cairo_current_target_surface (cr), d159 1 a159 1 circles = cairo_surface_create_similar (cairo_current_target_surface (cr), a167 1 cairo_set_target_surface (cr, overlay); d169 13 a181 5 /* Draw a black circle on the overlay */ cairo_set_rgb_color (cr, 0., 0., 0.); oval_path (cr, xc, yc, radius, radius); cairo_fill (cr); d183 1 a183 2 cairo_save (cr); cairo_set_target_surface (cr, punch); d185 4 a188 4 /* Draw 3 circles to the punch surface, then cut * that out of the main circle in the overlay */ draw_3circles (cr, xc, yc, radius); d190 2 a191 1 cairo_restore (cr); d193 3 a195 2 cairo_set_operator (cr, CAIRO_OPERATOR_OUT_REVERSE); cairo_show_surface (cr, punch, width, height); d197 6 a202 6 /* Now draw the 3 circles in a subgroup again * at half intensity, and use OperatorAdd to join up * without seams. */ cairo_save (cr); cairo_set_target_surface (cr, circles); d204 1 a204 3 cairo_set_alpha (cr, 0.5); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); draw_3circles (cr, xc, yc, radius); d206 5 a210 1 cairo_restore (cr); d212 3 a214 2 cairo_set_operator (cr, CAIRO_OPERATOR_ADD); cairo_show_surface (cr, circles, width, height); d216 2 a217 1 cairo_restore (cr); d219 2 a220 1 cairo_show_surface (cr, overlay, width, height); d292 6 a297 3 cairo_t *cr = cairo_create (); cairo_set_target_drawable (cr, dpy, pixmap); d302 1 @ 1.13 log @ * cairo-spline.c: * cairo-knockout.c: * cairo-demo.c: Track split-up of cairo.h. @ text @d256 2 a257 2 Xutf8SetWMProperties (dpy, w, title, "cairo-knockout", 0, 0, normalhints, wmhints, classhint); @ 1.12 log @Fix cairo_set_pattern @ text @d17 1 @ 1.11 log @ * cairo-spline.c: cairo-knockout.c, cairo-demo.c: Remove cairo-xlib.h, no longer needed. @ text @d56 1 d92 2 a93 1 cairo_set_pattern (cr, check); d97 1 @ 1.10 log @ * cairo-knockout.c (main): Fix missing break in switch statement. @ text @a16 1 #include @ 1.9 log @ (oval_path): (fill_checks): (draw_3circles): (draw): Rename cairo_t identifier from r to cr. (main): Add "cairo" to window title. Fix comments. @ text @d302 1 @ 1.8 log @ * cairo-knockout.c: Double buffer everything so expose handling is a simple copy operation. Only do redraw after resize. Add more window properties so window managers like metacity will decorate the window. @ text @d26 1 a26 1 oval_path (cairo_t *r, d33 1 a33 1 cairo_current_matrix (r, matrix); d35 4 a38 4 cairo_translate (r, xc, yc); cairo_scale (r, 1.0, yr / xr); cairo_move_to (r, xr, 0.0); cairo_arc (r, d42 1 a42 1 cairo_close_path (r); d44 1 a44 1 cairo_set_matrix (r, matrix); d52 1 a52 1 fill_checks (cairo_t *r, d58 1 a58 1 cairo_save (r); d62 1 a62 1 check = cairo_surface_create_similar (cairo_current_target_surface (r), d69 1 a69 1 cairo_save (r); d71 1 a71 1 cairo_set_target_surface (r, check); d73 1 a73 1 cairo_set_operator (r, CAIRO_OPERATOR_SRC); d75 1 a75 1 cairo_set_rgb_color (r, 0.4, 0.4, 0.4); d77 2 a78 2 cairo_rectangle (r, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE); cairo_fill (r); d80 1 a80 1 cairo_set_rgb_color (r, 0.7, 0.7, 0.7); d82 4 a85 4 cairo_rectangle (r, x, y, CHECK_SIZE, CHECK_SIZE); cairo_fill (r); cairo_rectangle (r, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE); cairo_fill (r); d87 1 a87 1 cairo_restore (r); d92 3 a94 3 cairo_set_pattern (r, check); cairo_rectangle (r, 0, 0, width, height); cairo_fill (r); d98 1 a98 1 cairo_restore (r); d105 1 a105 1 draw_3circles (cairo_t *r, d111 2 a112 2 cairo_set_rgb_color (r, 1., 0., 0.); oval_path (r, d116 1 a116 1 cairo_fill (r); d118 2 a119 2 cairo_set_rgb_color (r, 0., 1., 0.); oval_path (r, d123 1 a123 1 cairo_fill (r); d125 2 a126 2 cairo_set_rgb_color (r, 0., 0., 1.); oval_path (r, d130 1 a130 1 cairo_fill (r); d134 1 a134 1 draw (cairo_t *r, d145 1 a145 1 overlay = cairo_surface_create_similar (cairo_current_target_surface (r), d151 1 a151 1 punch = cairo_surface_create_similar (cairo_current_target_surface (r), d157 1 a157 1 circles = cairo_surface_create_similar (cairo_current_target_surface (r), d163 1 a163 1 fill_checks (r, 0, 0, width, height); d165 2 a166 2 cairo_save (r); cairo_set_target_surface (r, overlay); d170 3 a172 3 cairo_set_rgb_color (r, 0., 0., 0.); oval_path (r, xc, yc, radius, radius); cairo_fill (r); d174 2 a175 2 cairo_save (r); cairo_set_target_surface (r, punch); d180 1 a180 1 draw_3circles (r, xc, yc, radius); d182 1 a182 1 cairo_restore (r); d184 2 a185 2 cairo_set_operator (r, CAIRO_OPERATOR_OUT_REVERSE); cairo_show_surface (r, punch, width, height); d191 2 a192 2 cairo_save (r); cairo_set_target_surface (r, circles); d194 3 a196 3 cairo_set_alpha (r, 0.5); cairo_set_operator (r, CAIRO_OPERATOR_OVER); draw_3circles (r, xc, yc, radius); d198 1 a198 1 cairo_restore (r); d200 2 a201 2 cairo_set_operator (r, CAIRO_OPERATOR_ADD); cairo_show_surface (r, circles, width, height); d203 1 a203 1 cairo_restore (r); d205 1 a205 1 cairo_show_surface (r, overlay, width, height); d220 1 a220 1 char *title = "Knockout Groups"; d272 3 a274 4 /* We accumulate the area to repaint until the event * queue, then repaint. This avoids us getting behind * on our repaint or painting the same area over and * over needlessly. d277 1 a277 1 cairo_t *r = cairo_create (); d279 1 a279 1 cairo_set_target_drawable (r, dpy, pixmap); d281 1 a281 1 draw (r, width, height); d283 1 a283 1 cairo_destroy (r); d303 1 a303 1 /* Note new size */ @ 1.7 log @Added cairo-xlib.h include needed for new Cairo bits; added text demo to cairo-demo. @ text @d13 1 a212 51 static void handle_expose (Display *dpy, int screen, Window win, int width, int height, Region region) { Pixmap p; cairo_t *r; XRectangle clip; GC gc; /* Create an offscreen pixmap of the size of the * area we need to repaint, and a cairo_t object * directed to that pixmap. */ XClipBox (region, &clip); p = XCreatePixmap (dpy, win, clip.width, clip.height, DefaultDepth (dpy, screen)); r = cairo_create (); cairo_set_target_drawable (r, dpy, p); /* By adding a translation, we hide the partial * pixmap from our drawing routine */ cairo_translate (r, -clip.x, -clip.y); /* It would be nice to be able to set 'region' as * clip for our drawing, then only copy that portion * of our drawing, but Cairo doesn't expose the clipping * features of Xrender. So, we redraw the entire * bounding rectangle, even if the area is, e.g., L shaped, * as frequently happens for exposes.x */ /* Draw the contents */ draw (r, width, height); /* Now copy from our offscreen pixmap to the window */ gc = XCreateGC (dpy, p, 0, NULL); XCopyArea (dpy, p, win, gc, 0, 0, clip.width, clip.height, clip.x, clip.y); XFreeGC (dpy, gc); XFreePixmap (dpy, p); cairo_destroy (r); } d219 1 a220 1 XTextProperty title_prop; d222 5 a229 1 Region update_region = XCreateRegion (); d238 23 a260 4 if (XStringListToTextProperty (&title, 1, &title_prop)) { XSetWMName (dpy, w, &title_prop); XFree (title_prop.value); } d267 2 d277 15 a291 6 if (!XPending (dpy) && !XEmptyRegion (update_region)) { handle_expose (dpy, screen, w, width, height, update_region); XDestroyRegion (update_region); update_region = XCreateRegion (); d307 3 d312 4 a315 11 /* Accumulate area that needs redraw */ { XRectangle r; r.x = xev.xexpose.x; r.y = xev.xexpose.y; r.width = xev.xexpose.width; r.height = xev.xexpose.height; XUnionRectWithRegion (&r, update_region, update_region); } d321 1 a321 1 XDestroyRegion (update_region); @ 1.6 log @Fix another bug in oval_path. @ text @d16 1 @ 1.5 log @Fix bug in oval_path. @ text @d40 1 @ 1.4 log @Use cairo_arc in oval_path @ text @d35 1 a35 1 cairo_move_to (r, 0.0, 0.0); @ 1.3 log @Use cairo_rectangle rather than private rect_path @ text @d12 1 d19 3 a21 4 /* Create a path that is roughly a circular oval with * radii xr, yr at xc, yc. We only use 4 bezier's * but the deviation is already pretty darn small. * (max of about 0.02%) d28 12 a39 4 int i; cairo_new_path (r); cairo_move_to (r, xc + xr, yc); d41 2 a42 23 #define TANGENT_MULT (1.65591 / 3.) for (i = 0; i < 4; i++) { double angle1 = ((i + 0) / 2.) * M_PI; double angle2 = ((i + 1) / 2.) * M_PI; double x0 = xc + xr * cos (angle1); double y0 = yc - yr * sin (angle1); double x1 = x0 - xr * sin (angle1) * TANGENT_MULT; double y1 = y0 - yr * cos (angle1) * TANGENT_MULT; double x3 = xc + xr * cos (angle2); double y3 = yc - yr * sin (angle2); double x2 = x3 + xr * sin (angle2) * TANGENT_MULT; double y2 = y3 + yr * cos (angle2) * TANGENT_MULT; cairo_curve_to (r, x1, y1, x2, y2, x3, y3); } cairo_close_path (r); d241 1 a241 1 * of our drawing, but Xr doesn't expose the clipping @ 1.2 log @Updated to track changes in Cairo API @ text @d8 4 a11 3 * v0.1 30 November 2002 * v0.2 1 December 2002 - typo fixes from Keith Packard * v0.3 17 April 2003 - Tracking changes in Xr, (Removal of Xr{Push,Pop}Group) a17 18 /* Create a rectangular path */ static void rect_path (cairo_t *r, double x, double y, double width, double height) { cairo_new_path (r); cairo_move_to (r, x, y); cairo_rel_line_to (r, 0, height); cairo_rel_line_to (r, width, 0); cairo_rel_line_to (r, 0, -height); cairo_rel_line_to (r, -width, 0); cairo_close_path (r); } d87 1 a87 1 rect_path (r, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE); d92 1 a92 1 rect_path (r, x, y, CHECK_SIZE, CHECK_SIZE); d94 1 a94 1 rect_path (r, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE); d103 1 a103 1 rect_path (r, 0, 0, width, height); @ 1.1 log @Added demos from OLS paper. @ text @d89 1 a89 1 check = cairo_surface_create_similar (cairo_get_target_surface (r), d172 1 a172 1 overlay = cairo_surface_create_similar (cairo_get_target_surface (r), d178 1 a178 1 punch = cairo_surface_create_similar (cairo_get_target_surface (r), d184 1 a184 1 circles = cairo_surface_create_similar (cairo_get_target_surface (r), @