1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29 #include <pango/pangocairo.h>
30 #include <gdk-pixbuf/gdk-pixbuf.h>
32 #include "gdkdrawable.h"
33 #include "gdkinternals.h"
34 #include "gdkwindow.h"
35 #include "gdkscreen.h"
36 #include "gdkpixbuf.h"
39 static GdkDrawable* gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
44 gint *composite_x_offset,
45 gint *composite_y_offset);
46 static cairo_region_t * gdk_drawable_real_get_visible_region (GdkDrawable *drawable);
47 static void gdk_drawable_real_draw_drawable (GdkDrawable *drawable,
58 G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
61 gdk_drawable_class_init (GdkDrawableClass *klass)
63 klass->get_composite_drawable = gdk_drawable_real_get_composite_drawable;
64 /* Default implementation for clip and visible region is the same */
65 klass->get_clip_region = gdk_drawable_real_get_visible_region;
66 klass->get_visible_region = gdk_drawable_real_get_visible_region;
67 klass->draw_drawable = gdk_drawable_real_draw_drawable;
71 gdk_drawable_init (GdkDrawable *drawable)
75 /* Manipulation of drawables
79 * gdk_drawable_get_size:
80 * @drawable: a #GdkDrawable
81 * @width: (out) (allow-none): location to store drawable's width, or %NULL
82 * @height: (out) (allow-none): location to store drawable's height, or %NULL
84 * Fills *@width and *@height with the size of @drawable.
85 * @width or @height can be %NULL if you only want the other one.
87 * On the X11 platform, if @drawable is a #GdkWindow, the returned
88 * size is the size reported in the most-recently-processed configure
89 * event, rather than the current size on the X server.
93 gdk_drawable_get_size (GdkDrawable *drawable,
97 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
99 GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
103 * gdk_drawable_get_visual:
104 * @drawable: a #GdkDrawable
106 * Gets the #GdkVisual describing the pixel format of @drawable.
108 * Return value: a #GdkVisual
111 gdk_drawable_get_visual (GdkDrawable *drawable)
113 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
115 return GDK_DRAWABLE_GET_CLASS (drawable)->get_visual (drawable);
119 * gdk_drawable_get_depth:
120 * @drawable: a #GdkDrawable
122 * Obtains the bit depth of the drawable, that is, the number of bits
123 * that make up a pixel in the drawable's visual. Examples are 8 bits
124 * per pixel, 24 bits per pixel, etc.
126 * Return value: number of bits per pixel
129 gdk_drawable_get_depth (GdkDrawable *drawable)
131 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
133 return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
136 * gdk_drawable_get_screen:
137 * @drawable: a #GdkDrawable
139 * Gets the #GdkScreen associated with a #GdkDrawable.
141 * Return value: the #GdkScreen associated with @drawable
146 gdk_drawable_get_screen(GdkDrawable *drawable)
148 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
150 return GDK_DRAWABLE_GET_CLASS (drawable)->get_screen (drawable);
154 * gdk_drawable_get_display:
155 * @drawable: a #GdkDrawable
157 * Gets the #GdkDisplay associated with a #GdkDrawable.
159 * Return value: the #GdkDisplay associated with @drawable
164 gdk_drawable_get_display (GdkDrawable *drawable)
166 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
168 return gdk_screen_get_display (gdk_drawable_get_screen (drawable));
172 * gdk_drawable_set_colormap:
173 * @drawable: a #GdkDrawable
174 * @colormap: a #GdkColormap
176 * Sets the colormap associated with @drawable. Normally this will
177 * happen automatically when the drawable is created; you only need to
178 * use this function if the drawable-creating function did not have a
179 * way to determine the colormap, and you then use drawable operations
180 * that require a colormap. The colormap for all drawables and
181 * graphics contexts you intend to use together should match. i.e.
182 * when using a #GdkGC to draw to a drawable, or copying one drawable
183 * to another, the colormaps should match.
187 gdk_drawable_set_colormap (GdkDrawable *drawable,
190 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
191 g_return_if_fail (cmap == NULL || gdk_drawable_get_depth (drawable)
192 == cmap->visual->depth);
194 GDK_DRAWABLE_GET_CLASS (drawable)->set_colormap (drawable, cmap);
198 * gdk_drawable_get_colormap:
199 * @drawable: a #GdkDrawable
201 * Gets the colormap for @drawable, if one is set; returns
204 * Return value: the colormap, or %NULL
207 gdk_drawable_get_colormap (GdkDrawable *drawable)
209 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
211 return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable);
219 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
221 * @x: the x coordinate of the point.
222 * @y: the y coordinate of the point.
224 * Draws a point, using the foreground color and other attributes of
228 gdk_draw_point (GdkDrawable *drawable,
235 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
236 g_return_if_fail (GDK_IS_GC (gc));
241 GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, &point, 1);
246 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
248 * @x1_: the x coordinate of the start point.
249 * @y1_: the y coordinate of the start point.
250 * @x2_: the x coordinate of the end point.
251 * @y2_: the y coordinate of the end point.
253 * Draws a line, using the foreground color and other attributes of
257 gdk_draw_line (GdkDrawable *drawable,
266 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
267 g_return_if_fail (GDK_IS_GC (gc));
273 GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, &segment, 1);
277 * gdk_draw_rectangle:
278 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
280 * @filled: %TRUE if the rectangle should be filled.
281 * @x: the x coordinate of the left edge of the rectangle.
282 * @y: the y coordinate of the top edge of the rectangle.
283 * @width: the width of the rectangle.
284 * @height: the height of the rectangle.
286 * Draws a rectangular outline or filled rectangle, using the foreground color
287 * and other attributes of the #GdkGC.
289 * A rectangle drawn filled is 1 pixel smaller in both dimensions than a
290 * rectangle outlined. Calling
291 * <literal>gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20)</literal>
292 * results in a filled rectangle 20 pixels wide and 20 pixels high. Calling
293 * <literal>gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20)</literal>
294 * results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20),
295 * and (20, 0), which makes it 21 pixels wide and 21 pixels high.
298 gdk_draw_rectangle (GdkDrawable *drawable,
306 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
307 g_return_if_fail (GDK_IS_GC (gc));
309 if (width < 0 || height < 0)
314 gdk_drawable_get_size (drawable, &real_width, &real_height);
319 height = real_height;
322 GDK_DRAWABLE_GET_CLASS (drawable)->draw_rectangle (drawable, gc, filled, x, y,
328 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
330 * @filled: %TRUE if the polygon should be filled. The polygon is closed
331 * automatically, connecting the last point to the first point if
333 * @points: an array of #GdkPoint structures specifying the points making
335 * @n_points: the number of points.
337 * Draws an outlined or filled polygon.
340 gdk_draw_polygon (GdkDrawable *drawable,
343 const GdkPoint *points,
346 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
347 g_return_if_fail (GDK_IS_GC (gc));
349 GDK_DRAWABLE_GET_CLASS (drawable)->draw_polygon (drawable, gc, filled,
356 * @drawable: a #GdkDrawable
357 * @gc: a #GdkGC sharing the drawable's visual and colormap
358 * @src: the source #GdkDrawable, which may be the same as @drawable
359 * @xsrc: X position in @src of rectangle to draw
360 * @ysrc: Y position in @src of rectangle to draw
361 * @xdest: X position in @drawable where the rectangle should be drawn
362 * @ydest: Y position in @drawable where the rectangle should be drawn
363 * @width: width of rectangle to draw, or -1 for entire @src width
364 * @height: height of rectangle to draw, or -1 for entire @src height
366 * Copies the @width x @height region of @src at coordinates (@xsrc,
367 * @ysrc) to coordinates (@xdest, @ydest) in @drawable.
368 * @width and/or @height may be given as -1, in which case the entire
369 * @src drawable will be copied.
371 * Most fields in @gc are not used for this operation, but notably the
372 * clip mask or clip region will be honored.
374 * The source and destination drawables must have the same visual and
375 * colormap, or errors will result. (On X11, failure to match
376 * visual/colormap results in a BadMatch error from the X server.)
377 * A common cause of this problem is an attempt to draw a bitmap to
378 * a color drawable. The way to draw a bitmap is to set the bitmap as
379 * the stipple on the #GdkGC, set the fill mode to %GDK_STIPPLED, and
380 * then draw the rectangle.
383 gdk_draw_drawable (GdkDrawable *drawable,
393 GdkDrawable *composite;
394 gint composite_x_offset = 0;
395 gint composite_y_offset = 0;
397 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
398 g_return_if_fail (GDK_IS_DRAWABLE (src));
399 g_return_if_fail (GDK_IS_GC (gc));
401 if (width < 0 || height < 0)
406 gdk_drawable_get_size (src, &real_width, &real_height);
411 height = real_height;
416 GDK_DRAWABLE_GET_CLASS (src)->get_composite_drawable (src,
420 &composite_y_offset);
422 /* TODO: For non-native windows this may copy stuff from other overlapping
423 windows. We should clip that and (for windows with bg != None) clear that
424 area in the destination instead. */
426 if (GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src)
427 GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable, gc,
429 xsrc - composite_x_offset,
430 ysrc - composite_y_offset,
434 else /* backwards compat for old out-of-tree implementations of GdkDrawable (are there any?) */
435 GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc,
437 xsrc - composite_x_offset,
438 ysrc - composite_y_offset,
442 g_object_unref (composite);
447 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
449 * @points: an array of #GdkPoint structures.
450 * @n_points: the number of points to be drawn.
452 * Draws a number of points, using the foreground color and other
453 * attributes of the #GdkGC.
456 gdk_draw_points (GdkDrawable *drawable,
458 const GdkPoint *points,
461 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
462 g_return_if_fail ((points != NULL) && (n_points > 0));
463 g_return_if_fail (GDK_IS_GC (gc));
464 g_return_if_fail (n_points >= 0);
469 GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc,
470 (GdkPoint *) points, n_points);
475 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
477 * @segs: an array of #GdkSegment structures specifying the start and
478 * end points of the lines to be drawn.
479 * @n_segs: the number of line segments to draw, i.e. the size of the
482 * Draws a number of unconnected lines.
485 gdk_draw_segments (GdkDrawable *drawable,
487 const GdkSegment *segs,
490 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
495 g_return_if_fail (segs != NULL);
496 g_return_if_fail (GDK_IS_GC (gc));
497 g_return_if_fail (n_segs >= 0);
499 GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc,
500 (GdkSegment *) segs, n_segs);
505 * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
507 * @points: an array of #GdkPoint structures specifying the endpoints of the
508 * @n_points: the size of the @points array.
510 * Draws a series of lines connecting the given points.
511 * The way in which joins between lines are draw is determined by the
512 * #GdkCapStyle value in the #GdkGC. This can be set with
513 * gdk_gc_set_line_attributes().
516 gdk_draw_lines (GdkDrawable *drawable,
518 const GdkPoint *points,
521 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
522 g_return_if_fail (points != NULL);
523 g_return_if_fail (GDK_IS_GC (gc));
524 g_return_if_fail (n_points >= 0);
529 GDK_DRAWABLE_GET_CLASS (drawable)->draw_lines (drawable, gc,
530 (GdkPoint *) points, n_points);
534 real_draw_glyphs (GdkDrawable *drawable,
536 const PangoMatrix *matrix,
540 PangoGlyphString *glyphs)
544 cr = gdk_cairo_create (drawable);
545 _gdk_gc_update_context (gc, cr, NULL, NULL, TRUE, drawable);
549 cairo_matrix_t cairo_matrix;
551 cairo_matrix.xx = matrix->xx;
552 cairo_matrix.yx = matrix->yx;
553 cairo_matrix.xy = matrix->xy;
554 cairo_matrix.yy = matrix->yy;
555 cairo_matrix.x0 = matrix->x0;
556 cairo_matrix.y0 = matrix->y0;
558 cairo_set_matrix (cr, &cairo_matrix);
561 cairo_move_to (cr, x, y);
562 pango_cairo_show_glyph_string (cr, font, glyphs);
569 * @drawable: a #GdkDrawable
571 * @font: font to be used
572 * @x: X coordinate of baseline origin
573 * @y: Y coordinate of baseline origin
574 * @glyphs: the glyph string to draw
576 * This is a low-level function; 99% of text rendering should be done
577 * using gdk_draw_layout() instead.
579 * A glyph is a single image in a font. This function draws a sequence of
580 * glyphs. To obtain a sequence of glyphs you have to understand a
581 * lot about internationalized text handling, which you don't want to
582 * understand; thus, use gdk_draw_layout() instead of this function,
583 * gdk_draw_layout() handles the details.
587 gdk_draw_glyphs (GdkDrawable *drawable,
592 PangoGlyphString *glyphs)
594 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
595 g_return_if_fail (GDK_IS_GC (gc));
597 real_draw_glyphs (drawable, gc, NULL, font,
602 * gdk_draw_glyphs_transformed:
603 * @drawable: a #GdkDrawable
605 * @matrix: (allow-none): a #PangoMatrix, or %NULL to use an identity transformation
606 * @font: the font in which to draw the string
607 * @x: the x position of the start of the string (in Pango
608 * units in user space coordinates)
609 * @y: the y position of the baseline (in Pango units
610 * in user space coordinates)
611 * @glyphs: the glyph string to draw
613 * Renders a #PangoGlyphString onto a drawable, possibly
614 * transforming the layed-out coordinates through a transformation
615 * matrix. Note that the transformation matrix for @font is not
616 * changed, so to produce correct rendering results, the @font
617 * must have been loaded using a #PangoContext with an identical
618 * transformation matrix to that passed in to this function.
620 * See also gdk_draw_glyphs(), gdk_draw_layout().
625 gdk_draw_glyphs_transformed (GdkDrawable *drawable,
627 const PangoMatrix *matrix,
631 PangoGlyphString *glyphs)
633 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
634 g_return_if_fail (GDK_IS_GC (gc));
636 real_draw_glyphs (drawable, gc, matrix, font,
637 x / PANGO_SCALE, y / PANGO_SCALE, glyphs);
641 * gdk_draw_trapezoids:
642 * @drawable: a #GdkDrawable
644 * @trapezoids: an array of #GdkTrapezoid structures
645 * @n_trapezoids: the number of trapezoids to draw
647 * Draws a set of anti-aliased trapezoids. The trapezoids are
648 * combined using saturation addition, then drawn over the background
649 * as a set. This is low level functionality used internally to implement
650 * rotated underlines and backgrouds when rendering a PangoLayout and is
651 * likely not useful for applications.
656 gdk_draw_trapezoids (GdkDrawable *drawable,
658 const GdkTrapezoid *trapezoids,
664 g_return_if_fail (GDK_IS_DRAWABLE (drawable));
665 g_return_if_fail (GDK_IS_GC (gc));
666 g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
668 cr = gdk_cairo_create (drawable);
669 _gdk_gc_update_context (gc, cr, NULL, NULL, TRUE, drawable);
671 for (i = 0; i < n_trapezoids; i++)
673 cairo_move_to (cr, trapezoids[i].x11, trapezoids[i].y1);
674 cairo_line_to (cr, trapezoids[i].x21, trapezoids[i].y1);
675 cairo_line_to (cr, trapezoids[i].x22, trapezoids[i].y2);
676 cairo_line_to (cr, trapezoids[i].x12, trapezoids[i].y2);
677 cairo_close_path (cr);
686 gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
691 gint *composite_x_offset,
692 gint *composite_y_offset)
694 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
696 *composite_x_offset = 0;
697 *composite_y_offset = 0;
699 return g_object_ref (drawable);
703 * gdk_drawable_get_clip_region:
704 * @drawable: a #GdkDrawable
706 * Computes the region of a drawable that potentially can be written
707 * to by drawing primitives. This region will not take into account
708 * the clip region for the GC, and may also not take into account
709 * other factors such as if the window is obscured by other windows,
710 * but no area outside of this region will be affected by drawing
713 * Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
717 gdk_drawable_get_clip_region (GdkDrawable *drawable)
719 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
721 return GDK_DRAWABLE_GET_CLASS (drawable)->get_clip_region (drawable);
725 * gdk_drawable_get_visible_region:
726 * @drawable: a #GdkDrawable
728 * Computes the region of a drawable that is potentially visible.
729 * This does not necessarily take into account if the window is
730 * obscured by other windows, but no area outside of this region
733 * Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
737 gdk_drawable_get_visible_region (GdkDrawable *drawable)
739 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
741 return GDK_DRAWABLE_GET_CLASS (drawable)->get_visible_region (drawable);
744 static cairo_region_t *
745 gdk_drawable_real_get_visible_region (GdkDrawable *drawable)
752 gdk_drawable_get_size (drawable, &rect.width, &rect.height);
754 return cairo_region_create_rectangle (&rect);
758 * _gdk_drawable_ref_cairo_surface:
759 * @drawable: a #GdkDrawable
761 * Obtains a #cairo_surface_t for the given drawable. If a
762 * #cairo_surface_t for the drawable already exists, it will be
763 * referenced, otherwise a new surface will be created.
765 * Return value: a newly referenced #cairo_surface_t that points
766 * to @drawable. Unref with cairo_surface_destroy()
769 _gdk_drawable_ref_cairo_surface (GdkDrawable *drawable)
771 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
773 return GDK_DRAWABLE_GET_CLASS (drawable)->ref_cairo_surface (drawable);
776 /* Implementation of the old vfunc in terms of the new one
777 in case someone calls it directly (which they shouldn't!) */
779 gdk_drawable_real_draw_drawable (GdkDrawable *drawable,
789 GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable,
801 /************************************************************************/
804 * _gdk_drawable_get_scratch_gc:
805 * @drawable: A #GdkDrawable
806 * @graphics_exposures: Whether the returned #GdkGC should generate graphics exposures
808 * Returns a #GdkGC suitable for drawing on @drawable. The #GdkGC has
809 * the standard values for @drawable, except for the graphics_exposures
810 * field which is determined by the @graphics_exposures parameter.
812 * The foreground color of the returned #GdkGC is undefined. The #GdkGC
813 * must not be altered in any way, except to change its foreground color.
815 * Return value: A #GdkGC suitable for drawing on @drawable
820 _gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
821 gboolean graphics_exposures)
826 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
828 screen = gdk_drawable_get_screen (drawable);
830 g_return_val_if_fail (!screen->closed, NULL);
832 depth = gdk_drawable_get_depth (drawable) - 1;
834 if (graphics_exposures)
836 if (!screen->exposure_gcs[depth])
839 GdkGCValuesMask mask;
841 values.graphics_exposures = TRUE;
842 mask = GDK_GC_EXPOSURES;
844 screen->exposure_gcs[depth] =
845 gdk_gc_new_with_values (drawable, &values, mask);
848 return screen->exposure_gcs[depth];
852 if (!screen->normal_gcs[depth])
854 screen->normal_gcs[depth] =
855 gdk_gc_new (drawable);
858 return screen->normal_gcs[depth];
863 * _gdk_drawable_get_subwindow_scratch_gc:
864 * @drawable: A #GdkDrawable
866 * Returns a #GdkGC suitable for drawing on @drawable. The #GdkGC has
867 * the standard values for @drawable, except for the graphics_exposures
868 * field which is %TRUE and the subwindow mode which is %GDK_INCLUDE_INFERIORS.
870 * The foreground color of the returned #GdkGC is undefined. The #GdkGC
871 * must not be altered in any way, except to change its foreground color.
873 * Return value: A #GdkGC suitable for drawing on @drawable
878 _gdk_drawable_get_subwindow_scratch_gc (GdkDrawable *drawable)
883 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
885 screen = gdk_drawable_get_screen (drawable);
887 g_return_val_if_fail (!screen->closed, NULL);
889 depth = gdk_drawable_get_depth (drawable) - 1;
891 if (!screen->subwindow_gcs[depth])
894 GdkGCValuesMask mask;
896 values.graphics_exposures = TRUE;
897 values.subwindow_mode = GDK_INCLUDE_INFERIORS;
898 mask = GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW;
900 screen->subwindow_gcs[depth] =
901 gdk_gc_new_with_values (drawable, &values, mask);
904 return screen->subwindow_gcs[depth];
909 * _gdk_drawable_get_source_drawable:
910 * @drawable: a #GdkDrawable
912 * Returns a drawable for the passed @drawable that is guaranteed to be
913 * usable to create a pixmap (e.g.: not an offscreen window).
918 _gdk_drawable_get_source_drawable (GdkDrawable *drawable)
920 g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
922 if (GDK_DRAWABLE_GET_CLASS (drawable)->get_source_drawable)
923 return GDK_DRAWABLE_GET_CLASS (drawable)->get_source_drawable (drawable);
929 _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
933 return GDK_DRAWABLE_GET_CLASS (drawable)->create_cairo_surface (drawable,