20 #include <gdk/gdkdrawable.h> 22 #include <cairo-xlib.h> 35 gdk_cairo_create (GdkDrawable *target)
40 cairo_surface_t *surface;
41 GdkDrawable *drawable = target;
44 if (GDK_IS_WINDOW(target)) {
46 GdkWindow *window = GDK_WINDOW(target);
47 gdk_window_get_internal_paint_info (window,
48 &drawable, &x_off, &y_off);
50 visual = gdk_drawable_get_visual (drawable);
51 gdk_drawable_get_size (drawable, &width, &height);
54 surface = cairo_xlib_surface_create (GDK_DRAWABLE_XDISPLAY (drawable),
55 GDK_DRAWABLE_XID (drawable),
56 GDK_VISUAL_XVISUAL (visual),
58 }
else if (gdk_drawable_get_depth (drawable) == 1) {
59 surface = cairo_xlib_surface_create_for_bitmap
60 (GDK_PIXMAP_XDISPLAY (drawable),
61 GDK_PIXMAP_XID (drawable),
62 GDK_SCREEN_XSCREEN (gdk_drawable_get_screen (drawable)),
65 g_warning (
"Using Cairo rendering requires the drawable argument to\n" 66 "have a specified colormap. All windows have a colormap,\n" 67 "however, pixmaps only have colormap by default if they\n" 68 "were created with a non-NULL window argument. Otherwise\n" 69 "a colormap must be set on them with " 70 "gdk_drawable_set_colormap");
73 cairo_surface_set_device_offset (surface, -x_off, -y_off);
74 cr = cairo_create (surface);
75 cairo_surface_destroy (surface);
Definition: klash_part.cpp:329
Definition: klash_part.cpp:329