![]() |
![]() |
![]() |
GDK Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <gdk/gdk.h> GdkDrawable; GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable
); GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable
); GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable
); void gdk_drawable_set_colormap (GdkDrawable *drawable
,GdkColormap *colormap
); GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable
); gint gdk_drawable_get_depth (GdkDrawable *drawable
); void gdk_drawable_get_size (GdkDrawable *drawable
,gint *width
,gint *height
); cairo_region_t * gdk_drawable_get_clip_region (GdkDrawable *drawable
); cairo_region_t * gdk_drawable_get_visible_region (GdkDrawable *drawable
);
These functions provide support for drawing points, lines, arcs and text onto what are called 'drawables'. Drawables, as the name suggests, are things which support drawing onto them, and are either GdkWindow or GdkPixmap objects.
Many of the drawing operations take a GdkGC argument, which represents a graphics context. This GdkGC contains a number of drawing attributes such as foreground color, background color and line width, and is used to reduce the number of arguments needed for each drawing operation. See the Graphics Contexts section for more information.
Some of the drawing operations take Pango data structures like PangoContext,
PangoLayout or PangoLayoutLine as arguments. If you're using GTK+, the ususal
way to obtain these structures is via gtk_widget_create_pango_context()
or
gtk_widget_create_pango_layout()
.
typedef struct _GdkDrawable GdkDrawable;
An opaque structure representing an object that can be drawn onto. This can be a GdkPixmap, a GdkBitmap, or a GdkWindow.
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable
);
Gets the GdkDisplay associated with a GdkDrawable.
|
a GdkDrawable |
Returns : |
the GdkDisplay associated with drawable
|
Since 2.2
GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable
);
Gets the GdkScreen associated with a GdkDrawable.
|
a GdkDrawable |
Returns : |
the GdkScreen associated with drawable
|
Since 2.2
GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable
);
Gets the GdkVisual describing the pixel format of drawable
.
|
a GdkDrawable |
Returns : |
a GdkVisual |
void gdk_drawable_set_colormap (GdkDrawable *drawable
,GdkColormap *colormap
);
Sets the colormap associated with drawable
. Normally this will
happen automatically when the drawable is created; you only need to
use this function if the drawable-creating function did not have a
way to determine the colormap, and you then use drawable operations
that require a colormap. The colormap for all drawables and
graphics contexts you intend to use together should match.
|
a GdkDrawable |
|
a GdkColormap |
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable
);
Gets the colormap for drawable
, if one is set; returns
NULL
otherwise.
|
a GdkDrawable |
Returns : |
the colormap, or NULL
|
gint gdk_drawable_get_depth (GdkDrawable *drawable
);
Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual. Examples are 8 bits per pixel, 24 bits per pixel, etc.
|
a GdkDrawable |
Returns : |
number of bits per pixel |
void gdk_drawable_get_size (GdkDrawable *drawable
,gint *width
,gint *height
);
Fills *width
and *height
with the size of drawable
.
width
or height
can be NULL
if you only want the other one.
On the X11 platform, if drawable
is a GdkWindow, the returned
size is the size reported in the most-recently-processed configure
event, rather than the current size on the X server.
|
a GdkDrawable |
|
location to store drawable's width, or NULL . [out][allow-none]
|
|
location to store drawable's height, or NULL . [out][allow-none]
|
cairo_region_t * gdk_drawable_get_clip_region (GdkDrawable *drawable
);
Computes the region of a drawable that potentially can be written to by drawing primitives. This region will not take into account the clip region for the GC, and may also not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.
|
a GdkDrawable |
Returns : |
a cairo_region_t. This must be freed with cairo_region_destroy()
when you are done.
|
cairo_region_t * gdk_drawable_get_visible_region (GdkDrawable *drawable
);
Computes the region of a drawable that is potentially visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.
|
a GdkDrawable |
Returns : |
a cairo_region_t. This must be freed with cairo_region_destroy()
when you are done.
|