head 1.15; access; symbols; locks; strict; comment @ * @; 1.15 date 2005.06.15.18.07.35; author cworth; state Exp; branches; next 1.14; commitid 550742b06e674567; 1.14 date 2005.05.17.14.50.15; author cworth; state Exp; branches; next 1.13; commitid cd9428a04a64567; 1.13 date 2005.05.13.22.33.59; author cworth; state Exp; branches; next 1.12; commitid 23ab42852b564567; 1.12 date 2005.02.07.13.41.34; author pippin; state Exp; branches; next 1.11; 1.11 date 2005.02.07.13.38.19; author pippin; state Exp; branches; next 1.10; 1.10 date 2005.01.20.16.32.30; author cworth; state Exp; branches; next 1.9; 1.9 date 2004.07.25.02.31.19; author jamey; state Exp; branches; next 1.8; 1.8 date 2004.05.11.14.45.32; author pippin; state Exp; branches; next 1.7; 1.7 date 2004.03.17.17.44.26; author jamey; state Exp; branches; next 1.6; 1.6 date 2004.02.03.07.25.48; author jamey; state Exp; branches; next 1.5; 1.5 date 2003.12.08.20.58.29; author dajobe; state Exp; branches; next 1.4; 1.4 date 2003.11.20.17.58.14; author cworth; state Exp; branches; next 1.3; 1.3 date 2003.10.10.12.39.44; author cworth; state Exp; branches; next 1.2; 1.2 date 2003.10.01.02.04.48; author jamey; state Exp; branches; next 1.1; 1.1 date 2003.08.18.18.11.37; author cworth; state Exp; branches; next ; desc @@ 1.15 log @ * Makefile: Don't build gtkcairo_slide directory by default. * X11/cairo-demo-xcb.c: (win_draw): * X11/cairo-demo.c: (win_draw): * X11/cairo-spline.c: (win_refresh): Track replacement of cairo_status_string by cairo_status_to_string. @ text @#include #include #include #include #include #define PI 3.1415926535 typedef struct win { Display *dpy; int scr; Window win; GC gc; int width, height; KeyCode quit_code; } 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); static void win_draw(win_t *win); static void win_handle_events(win_t *win); int main(int argc, char *argv[]) { win_t win; win.dpy = XOpenDisplay(0); if (win.dpy == NULL) { fprintf(stderr, "Failed to open display\n"); return 1; } win_init(&win); win_draw(&win); win_handle_events(&win); win_deinit(&win); XCloseDisplay(win.dpy); return 0; } #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_source_rgb(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); } */ static void win_draw(win_t *win) { #define NUM_DASH 2 static double dash[NUM_DASH] = {SIZE/4.0, SIZE/4.0}; cairo_surface_t *surface; cairo_t *cr; Visual *visual = DefaultVisual(win->dpy, DefaultScreen (win->dpy)); XClearWindow(win->dpy, win->win); surface = cairo_xlib_surface_create (win->dpy, win->win, visual, win->width, win->height); cr = cairo_create(surface); cairo_set_source_rgb(cr, 1, 1, 1); cairo_save(cr); cairo_set_font_size (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_source_rgb(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_to_string (cairo_status (cr))); exit(0); } cairo_destroy(cr); cairo_surface_destroy (surface); } static void win_init(win_t *win) { Window root; win->width = 400; win->height = 400; root = DefaultRootWindow(win->dpy); win->scr = DefaultScreen(win->dpy); win->win = XCreateSimpleWindow(win->dpy, root, 0, 0, win->width, win->height, 0, BlackPixel(win->dpy, win->scr), BlackPixel(win->dpy, win->scr)); win->quit_code = XKeysymToKeycode(win->dpy, XStringToKeysym("Q")); XSelectInput(win->dpy, win->win, KeyPressMask |StructureNotifyMask |ExposureMask); XMapWindow(win->dpy, win->win); } static void win_deinit(win_t *win) { XDestroyWindow(win->dpy, win->win); } static void win_handle_events(win_t *win) { XEvent xev; while (1) { XNextEvent(win->dpy, &xev); switch(xev.type) { case KeyPress: { XKeyEvent *kev = &xev.xkey; if (kev->keycode == win->quit_code) { return; } } break; case ConfigureNotify: { XConfigureEvent *cev = &xev.xconfigure; win->width = cev->width; win->height = cev->height; } break; case Expose: { XExposeEvent *eev = &xev.xexpose; if (eev->count == 0) win_draw(win); } break; } } } @ 1.14 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 @d267 3 a269 2 if (cairo_status(cr)) { printf("Cairo is unhappy: %s\n", cairo_status_string(cr)); @ 1.13 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 @d205 2 a206 3 surface = cairo_xlib_surface_create_for_window_with_visual (win->dpy, win->win, visual); @ 1.12 log @add proper macros to use xcb instead of xlib when available @ text @a5 7 #ifdef CAIRO_HAS_XCB_SURFACE #include #undef CAIRO_HAS_XLIB_SURFACE #endif #ifdef CAIRO_HAS_XLIB_SURFACE a6 1 #endif a10 1 #ifndef CAIRO_HAS_XCB_SURFACE d13 1 a13 4 #else /* CAIRO_HAS_XCB_SURFACE */ XCBConnection *dpy; #endif /* CAIRO_HAS_XCB_SURFACE */ #ifndef CAIRO_HAS_XCB_SURFACE d16 1 a16 4 #else /* CAIRO_HAS_XCB_SURFACE */ XCBWINDOW win; XCBGCONTEXT gc; #endif /* CAIRO_HAS_XCB_SURFACE */ a17 1 #ifndef CAIRO_HAS_XCB_SURFACE a18 3 #else /* CAIRO_HAS_XCB_SURFACE */ XCBVISUALTYPE *visual; #endif /* CAIRO_HAS_XCB_SURFACE */ a33 1 #ifndef CAIRO_HAS_XCB_SURFACE a34 3 #else /* CAIRO_HAS_XCB_SURFACE */ win.dpy = XCBConnectBasic(); #endif /* CAIRO_HAS_XCB_SURFACE */ a48 1 #ifndef CAIRO_HAS_XCB_SURFACE a49 3 #else /* CAIRO_HAS_XCB_SURFACE */ XCBDisconnect(win.dpy); #endif /* CAIRO_HAS_XCB_SURFACE */ d167 1 a167 1 cairo_set_rgb_color(cr, 1, 1, 1); d199 1 d201 1 a201 6 #ifndef CAIRO_HAS_XCB_SURFACE Drawable drawable = win->win; #else /* CAIRO_HAS_XCB_SURFACE */ XCBDRAWABLE drawable; drawable.window = win->win; #endif /* CAIRO_HAS_XCB_SURFACE */ a202 1 #ifndef CAIRO_HAS_XCB_SURFACE d204 7 a210 11 #else /* CAIRO_HAS_XCB_SURFACE */ XCBClearArea(win->dpy, 0, win->win, 0, 0, 0, 0); #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); d213 1 a213 1 cairo_scale_font (cr, 20); d263 1 a263 1 cairo_set_rgb_color(cr, 1, 0, 0); d274 1 a276 23 #ifdef CAIRO_HAS_XCB_SURFACE static int id_to_visual(XCBSCREEN *root, XCBVISUALTYPE **visual) { XCBDEPTHIter di; XCBVISUALTYPE *v; for(di = XCBSCREENAllowedDepthsIter(root); di.rem; XCBDEPTHNext(&di)) { int i; const int count = XCBDEPTHVisualsLength(di.data); v = XCBDEPTHVisuals(di.data); for(i = 0; i < count; ++i) if(v->visual_id.id == root->root_visual.id) { *visual = v; return di.data->depth; } } return 0; } #endif /* CAIRO_HAS_XCB_SURFACE */ a279 1 #ifndef CAIRO_HAS_XCB_SURFACE a280 6 #else /* CAIRO_HAS_XCB_SURFACE */ XCBSCREEN *root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(win->dpy)).data; CARD32 mask = XCBCWBackPixel | XCBCWEventMask; CARD32 values[] = { root->black_pixel, StructureNotifyMask | ExposureMask }; int depth; #endif /* CAIRO_HAS_XCB_SURFACE */ a284 1 #ifndef CAIRO_HAS_XCB_SURFACE a299 8 #else /* CAIRO_HAS_XCB_SURFACE */ win->win = XCBWINDOWNew(win->dpy); depth = id_to_visual(root, &win->visual); XCBCreateWindow(win->dpy, depth, win->win, root->root, 0, 0, win->width, win->height, 0, InputOutput, win->visual->visual_id, mask, values); XCBMapWindow(win->dpy, win->win); #endif /* CAIRO_HAS_XCB_SURFACE */ a304 1 #ifndef CAIRO_HAS_XCB_SURFACE a305 3 #else /* CAIRO_HAS_XCB_SURFACE */ XCBDestroyWindow(win->dpy, win->win); #endif /* CAIRO_HAS_XCB_SURFACE */ a310 1 #ifndef CAIRO_HAS_XCB_SURFACE a311 3 #else /* CAIRO_HAS_XCB_SURFACE */ XCBGenericEvent *xev; #endif /* CAIRO_HAS_XCB_SURFACE */ a313 1 #ifndef CAIRO_HAS_XCB_SURFACE a315 7 #else /* CAIRO_HAS_XCB_SURFACE */ xev = XCBWaitEvent(win->dpy); if(!xev) return; switch(xev->response_type) { #endif /* CAIRO_HAS_XCB_SURFACE */ #ifdef CAIRO_HAS_XLIB_SURFACE a324 2 #endif #ifndef CAIRO_HAS_XCB_SURFACE a325 3 #else /* CAIRO_HAS_XCB_SURFACE */ case XCBConfigureNotify: #endif /* CAIRO_HAS_XCB_SURFACE */ a326 1 #ifndef CAIRO_HAS_XCB_SURFACE a327 3 #else /* CAIRO_HAS_XCB_SURFACE */ XCBConfigureNotifyEvent *cev = (XCBConfigureNotifyEvent *) xev; #endif /* CAIRO_HAS_XCB_SURFACE */ a332 1 #ifndef CAIRO_HAS_XCB_SURFACE a333 3 #else /* CAIRO_HAS_XCB_SURFACE */ case XCBExpose: #endif /* CAIRO_HAS_XCB_SURFACE */ a334 1 #ifndef CAIRO_HAS_XCB_SURFACE a335 3 #else /* CAIRO_HAS_XCB_SURFACE */ XCBExposeEvent *eev = (XCBExposeEvent *) xev; #endif /* CAIRO_HAS_XCB_SURFACE */ @ 1.11 log @initializing data to silence valgrind @ text @a5 2 //#include #include d8 1 d12 4 @ 1.10 log @ * cairo-spline.c: * cairo-knockout.c: * cairo-demo.c: Track split-up of cairo.h. @ text @d6 1 a6 1 #include @ 1.9 log @Updated for XCB API change around iterators. @ text @d6 2 @ 1.8 log @replacing ct with cr @ text @d314 1 a314 1 for(di = XCBSCREENAllowedDepths(root); di.rem; XCBDEPTHNext(&di)) d336 1 a336 1 XCBSCREEN *root = XCBConnSetupSuccessRepRoots(XCBGetSetup(win->dpy)).data; @ 1.7 log @Fixed for latest XCB API. XCB headers can co-exist with Xlib headers now, so Cairo may be compiled with both backends in the same library. http://freedesktop.org/Software/XCBCompletedTasks#17_Mar_2004 @ text @d35 3 a37 3 static void triangle(cairo_t *ct); static void square(cairo_t *ct); static void bowtie(cairo_t *ct); d78 1 a78 1 triangle(cairo_t *ct) d80 4 a83 4 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); d87 1 a87 1 square(cairo_t *ct) d89 5 a93 5 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); d97 1 a97 1 bowtie(cairo_t *ct) d99 5 a103 5 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); d107 1 a107 1 inf(cairo_t *ct) d109 2 a110 2 cairo_move_to(ct, 0, SIZE); cairo_rel_curve_to(ct, d114 1 a114 1 cairo_rel_curve_to(ct, d118 1 a118 1 cairo_rel_curve_to(ct, d122 1 a122 1 cairo_rel_curve_to(ct, d126 1 a126 1 cairo_close_path(ct); d130 1 a130 1 draw_shapes(cairo_t *ct, int x, int y, int fill) d132 1 a132 1 cairo_save(ct); d134 3 a136 3 cairo_new_path(ct); cairo_translate(ct, x+SIZE, y+SIZE); bowtie(ct); d138 1 a138 1 cairo_fill(ct); d140 1 a140 1 cairo_stroke(ct); d142 3 a144 3 cairo_new_path(ct); cairo_translate(ct, 4*SIZE, 0); square(ct); d146 1 a146 1 cairo_fill(ct); d148 1 a148 1 cairo_stroke(ct); d150 3 a152 3 cairo_new_path(ct); cairo_translate(ct, 4*SIZE, 0); triangle(ct); d154 1 a154 1 cairo_fill(ct); d156 1 a156 1 cairo_stroke(ct); d158 3 a160 3 cairo_new_path(ct); cairo_translate(ct, 4*SIZE, 0); inf(ct); d162 1 a162 1 cairo_fill(ct); d164 1 a164 1 cairo_stroke(ct); d166 1 a166 1 cairo_restore(ct); d170 1 a170 1 fill_shapes(cairo_t *ct, int x, int y) d172 1 a172 1 draw_shapes(ct, x, y, 1); d176 1 a176 1 stroke_shapes(cairo_t *ct, int x, int y) d178 1 a178 1 draw_shapes(ct, x, y, 0); d183 1 a183 1 draw_broken_shapes(cairo_t *ct) d185 1 a185 1 cairo_save(ct); d187 22 a208 22 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); d210 1 a210 1 cairo_fill(ct); d212 1 a212 1 cairo_restore(ct); d221 1 a221 1 cairo_t *ct; d235 1 a235 1 ct = cairo_create(); d237 1 a237 1 cairo_set_target_drawable (ct, win->dpy, drawable); d239 1 a239 1 cairo_set_target_xcb (ct, win->dpy, drawable, win->visual, 0); d241 1 a241 1 cairo_set_rgb_color(ct, 1, 1, 1); d243 6 a248 6 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); d251 7 a257 7 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); d261 1 a261 1 /* cairo_scale(ct, 4, 4); */ d263 1 a263 1 cairo_set_line_width(ct, SIZE / 4); d265 1 a265 1 cairo_set_tolerance(ct, .1); d267 3 a269 3 cairo_set_line_join(ct, CAIRO_LINE_JOIN_ROUND); cairo_set_dash(ct, dash, NUM_DASH, 0); stroke_shapes(ct, 0, 0); d271 1 a271 1 cairo_translate(ct, 0, 4*SIZE); d273 2 a274 2 cairo_set_dash(ct, NULL, 0, 0); stroke_shapes(ct, 0, 0); d276 1 a276 1 cairo_translate(ct, 0, 4*SIZE); d278 2 a279 2 cairo_set_line_join(ct, CAIRO_LINE_JOIN_BEVEL); stroke_shapes(ct, 0, 0); d281 1 a281 1 cairo_translate(ct, 0, 4*SIZE); d283 2 a284 2 cairo_set_line_join(ct, CAIRO_LINE_JOIN_MITER); stroke_shapes(ct, 0, 0); d286 1 a286 1 cairo_translate(ct, 0, 4*SIZE); d288 1 a288 1 fill_shapes(ct, 0, 0); d290 1 a290 1 cairo_translate(ct, 0, 4*SIZE); d292 4 a295 4 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); d297 1 a297 1 draw_broken_shapes(ct); d299 2 a300 2 if (cairo_status(ct)) { printf("Cairo is unhappy: %s\n", cairo_status_string(ct)); d304 1 a304 1 cairo_destroy(ct); @ 1.6 log @Added support for the new Cairo XCB surface backend. @ text @d24 2 a25 2 WINDOW win; GCONTEXT gc; d31 1 a31 1 VISUALTYPE *visual; d225 1 a225 1 DRAWABLE drawable; d309 1 a309 1 id_to_visual(SCREEN *root, VISUALTYPE **visual) d311 2 a312 2 DEPTHIter di; VISUALTYPE *v; d314 1 a314 1 for(di = SCREENAllowedDepths(root); di.rem; DEPTHNext(&di)) d317 2 a318 2 const int count = DEPTHVisualsLength(di.data); v = DEPTHVisuals(di.data); d336 1 a336 1 SCREEN *root = XCBConnSetupSuccessRepRoots(XCBGetSetup(win->dpy)).data; d396 2 @ 1.5 log @ * cairo-spline.c: cairo-knockout.c, cairo-demo.c: Remove cairo-xlib.h, no longer needed. @ text @d7 4 d14 1 d17 4 d23 4 d28 1 d30 3 d38 1 a38 1 static void win_init(win_t *win, Display *dpy); a40 1 static void win_select_events(win_t *win); d48 5 a52 1 Display *dpy = XOpenDisplay(0); d54 2 a55 2 if (dpy == NULL) { fprintf(stderr, "Failed to open display: %s\n", XDisplayName(0)); d59 1 a59 1 win_init(&win, dpy); d67 5 a71 1 XCloseDisplay(dpy); a220 1 Display *dpy = win->dpy; d222 1 d224 10 a233 2 XClearWindow(dpy, win->win); d236 5 a240 1 cairo_set_target_drawable (ct, dpy, drawable); d307 23 d331 1 a331 1 win_init(win_t *win, Display *dpy) d333 1 d335 6 a341 1 win->dpy = dpy; d345 3 a347 2 root = DefaultRootWindow(dpy); win->scr = DefaultScreen(dpy); d349 1 a349 1 win->win = XCreateSimpleWindow(dpy, root, 0, 0, d351 1 a351 1 BlackPixel(dpy, win->scr), BlackPixel(dpy, win->scr)); d353 1 a353 1 win->quit_code = XKeysymToKeycode(dpy, XStringToKeysym("Q")); d355 4 a358 1 win_select_events(win); d360 9 a368 1 XMapWindow(dpy, win->win); d374 1 d376 3 a378 9 } static void win_select_events(win_t *win) { XSelectInput(win->dpy, win->win, KeyPressMask |StructureNotifyMask |ExposureMask); d384 1 d386 3 d391 1 a392 1 d394 5 d408 2 d411 3 d415 1 d417 3 d425 1 d427 3 d431 1 d433 3 @ 1.4 log @ * cairo-knockout.c (main): Fix missing break in switch statement. @ text @a5 1 #include @ 1.3 log @Remove XSynchronize from cairo-demo @ text @d265 1 a265 1 printf("%s\n", cairo_status_string(ct)); @ 1.2 log @Added cairo-xlib.h include needed for new Cairo bits; added text demo to cairo-demo. @ text @a34 2 XSynchronize (dpy, 1); d53 1 a53 1 #define SIZE 40 d226 1 a226 1 /* cairo_scale(ct, 8, 8); */ a227 4 #if XXX_JOINS_ARE_BROKEN_AFTER_SOME_TRANSFORMS cairo_scale(ct, 2, -2); cairo_translate(ct, 0, -200); #endif @ 1.1 log @Added demos from OLS paper. @ text @d6 3 d210 7 d242 2 d245 3 a247 1 stroke_shapes(ct, 0, 4*SIZE); d250 3 a252 1 stroke_shapes(ct, 0, 8*SIZE); d255 3 a257 1 stroke_shapes(ct, 0, 12*SIZE); d259 3 a261 1 fill_shapes(ct, 0, 16*SIZE); d264 1 a264 1 fill_shapes(ct, 0, 20*SIZE); d266 1 a266 1 stroke_shapes(ct, 0, 20*SIZE); d270 4 @