Functions for drawing points, lines, arcs, and text
Class GdkDrawable
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().
Methods | |
draw_line | Draws a line, using the foreground color and other attributes of the GdkGC. |
draw_point | Draws a point, using the foreground color and other attributes of the GdkGC. |
draw_points | Draws a number of points, using the foreground color and other attributes of the GdkGC. |
get_clip_region | Computes the region of a drawable that potentially can be written to by drawing primitives. |
get_colormap | Gets the colormap for drawable, if one is set; returns NULL otherwise. |
get_depth | Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual. |
get_screen | Gets the GdkScreen associated with a GdkDrawable. |
get_size | Returns the size of drawable. |
get_visible_region | Computes the region of a drawable that is potentially visible. |
get_visual | Gets the GdkVisual describing the pixel format of drawable. |
set_colormap | Sets the colormap associated with drawable. |
Draws a line, using the foreground color and other attributes of the GdkGC.
GdkDrawable.draw_line( gc, x1, y1, x2, y2 )
gc | a GdkGC. |
x1 | the x coordinate of the start point. |
y1 | the y coordinate of the start point. |
x2 | the x coordinate of the end point. |
y2 | the y coordinate of the end point. |
Draws a point, using the foreground color and other attributes of the GdkGC.
GdkDrawable.draw_point( gc, x, y )
gc | a GdkGC. |
x | the x coordinate of the point. |
y | the y coordinate of the point. |
Draws a number of points, using the foreground color and other attributes of the GdkGC.
GdkDrawable.draw_points( gc, points )
gc | a GdkGC. |
points | an array of GdkPoint structures. |
Computes the region of a drawable that potentially can be written to by drawing primitives.
GdkDrawable.get_clip_region()
Return | a GdkRegion. |
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.
Gets the colormap for drawable, if one is set; returns NULL otherwise.
GdkDrawable.get_colormap()
Return | the colormap, or NULL |
Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual.
GdkDrawable.get_depth()
Return | number of bits per pixel |
Examples are 8 bits per pixel, 24 bits per pixel, etc.
Gets the GdkScreen associated with a GdkDrawable.
GdkDrawable.get_screen()
Return | the GdkScreen associated with drawable |
Returns the size of drawable.
GdkDrawable.get_size()
Return | an array [ drawable's width, drawable's height ] |
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.
Computes the region of a drawable that is potentially visible.
GdkDrawable.get_visible_region()
Return | a GdkRegion. |
This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.
Gets the GdkVisual describing the pixel format of drawable.
GdkDrawable.get_visual()
Return | a GdkVisual |
Sets the colormap associated with drawable.
GdkDrawable.set_colormap( colormap )
colormap | a GdkColormap |
Normally this will happen automatically when the drawable is created; you on ly 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. i.e. when using a GdkGC to draw to a drawable, or copying one drawable to another, the colormaps should match.