![]() |
![]() |
Gdk::Drawable is the base class for all of the objects that accept drawing commands. The available drawables include pixmaps, windows, and bitmaps. Drawable is abstract as there is no such type on the server side.
To use a drawable, create a concrete Drawable of the type you wish to use and a Gdk::GC (graphics context) for that Drawable. With the GC you can draw lines, text, arcs and such.
Public Member Functions | |
virtual | ~Drawable () |
GdkDrawable* | gobj () |
Provides access to the underlying C GObject. | |
const GdkDrawable* | gobj () const |
Provides access to the underlying C GObject. | |
GdkDrawable* | gobj_copy () |
void | get_size (int& width, int& height) |
Fills * width and * height with the size of drawable . | |
int | get_depth () const |
Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual. | |
void | set_colormap (const Glib::RefPtr<Colormap>& colormap) |
Sets the colormap associated with drawable . | |
Glib::RefPtr<Colormap> | get_colormap () |
Gets the colormap for drawable , if one is set; returns 0 otherwise. | |
Glib::RefPtr<Visual> | get_visual () |
Gets the Gdk::Visual describing the pixel format of drawable . | |
void | draw_point (const Glib::RefPtr<const GC>& gc, int x, int y) |
Draws a point, using the foreground color and other attributes of the Gdk::GC. | |
void | draw_points (const Glib::RefPtr<const GC>& gc, const Glib::ArrayHandle<Point>& points) |
void | draw_line (const Glib::RefPtr<const GC>& gc, int x1, int y1, int x2, int y2) |
Draws a line, using the foreground color and other attributes of the Gdk::GC. | |
void | draw_lines (const Glib::RefPtr<const GC>& gc, const Glib::ArrayHandle<Point>& points) |
void | draw_rectangle (const Glib::RefPtr<const GC>& gc, bool filled, int x, int y, int width, int height) |
Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the Gdk::GC. | |
void | draw_arc (const Glib::RefPtr<const GC>& gc, bool filled, int x, int y, int width, int height, int angle1, int angle2) |
Draws an arc or a filled 'pie slice'. | |
void | draw_polygon (const Glib::RefPtr<const GC>& gc, bool filled, const Glib::ArrayHandle<Point>& points) |
void | draw_drawable (const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Drawable>& src, int xsrc, int ysrc, int xdest, int ydest, int width=-1, int height=-1) |
Copies the width x height region of src at coordinates ( xsrc , ysrc ) to coordinates ( xdest , ydest ) in drawable . | |
void | draw_image (const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Image>& image, int xsrc, int ysrc, int xdest, int ydest, int width=-1, int height=-1) |
Draws a Gdk::Image onto a drawable. | |
void | draw_segments (const Glib::RefPtr<const GC>& gc, GdkSegment* segs, int nsegs) |
Draws a number of unconnected lines. | |
void | draw_glyphs (const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<const Pango::Font>& font, int x, int y, PangoGlyphString* glyphs) |
This is a low-level function; 99% of text rendering should be done using gdk_draw_layout() instead. | |
void | draw_layout_line (const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::LayoutLine>& line) |
Render a Pango::LayoutLine onto an GDK drawable. | |
void | draw_layout_line (const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::LayoutLine>& line, const Color& foreground, const Color& background) |
Render a Pango::LayoutLine onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background . | |
void | draw_layout (const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout) |
Render a Pango::Layout onto a GDK drawable. | |
void | draw_layout (const Glib::RefPtr<const GC>& gc, int x, int y, const Glib::RefPtr<const Pango::Layout>& layout, const Color& foreground, const Color& background) |
Render a Pango::Layout onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background . | |
void | draw_pixbuf (const Glib::RefPtr<const GC>& gc, const Glib::RefPtr<Pixbuf>& pixbuf, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither) |
Renders a rectangular portion of a pixbuf to a drawable. | |
Glib::RefPtr<Image> | get_image (int x, int y, int width, int height) const |
A Gdk::Image stores client-side image data (pixels). | |
Region | get_clip_region () const |
Computes the region of a drawable that potentially can be written to by drawing primitives. | |
Region | get_visible_region () const |
Computes the region of a drawable that is potentially visible. | |
void | draw_rgb_image (const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) |
void | draw_rgb_image_dithalign (const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, int xdith, int ydith) |
void | draw_rgb_32_image (const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) |
void | draw_rgb_32_image_dithalign (const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, int xdith, int ydith) |
Like gdk_draw_rgb_32_image(), but allows you to specify the dither offsets. | |
void | draw_gray_image (const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) |
void | draw_indexed_image (const Glib::RefPtr<const GC>& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, const RgbCmap& cmap) |
Glib::RefPtr<Screen> | get_screen () |
Gets the Gdk::Screen associated with a Gdk::Drawable. | |
Glib::RefPtr<const Screen> | get_screen () const |
Gets the Gdk::Screen associated with a Gdk::Drawable. | |
Glib::RefPtr<Display> | get_display () |
Gets the Gdk::Display associated with a Gdk::Drawable. | |
Glib::RefPtr<const Display> | get_display () const |
Gets the Gdk::Display associated with a Gdk::Drawable. | |
Static Public Member Functions | |
Glib::RefPtr<Drawable> | create () |
Protected Member Functions | |
Drawable () | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr<Gdk::Drawable> | wrap (GdkDrawable* object, bool take_copy=false) |
|
|
|
|
|
Reimplemented in Gdk::Pixmap. |
|
Draws an arc or a filled 'pie slice'. The arc is defined by the bounding rectangle of the entire ellipse, and the start and end angles of the part of the ellipse to be drawn.
|
|
Copies the width x height region of src at coordinates ( xsrc , ysrc ) to coordinates ( xdest , ydest ) in drawable . width and/or height may be given as -1, in which case the entire src drawable will be copied. Most fields in gc are not used for this operation, but notably the clip mask or clip region will be honored. The source and destination drawables must have the same visual and colormap, or errors will result. (On X11, failure to match visual/colormap results in a BadMatch error from the X server.) A common cause of this problem is an attempt to draw a bitmap to a color drawable. The way to draw a bitmap is to set the bitmap as a clip mask on your Gdk::GC, then use gdk_draw_rectangle() to draw a rectangle clipped to the bitmap.
|
|
This is a low-level function; 99% of text rendering should be done using gdk_draw_layout() instead. A glyph is a character in a font. This function draws a sequence of glyphs. To obtain a sequence of glyphs you have to understand a lot about internationalized text handling, which you don't want to understand; thus, use gdk_draw_layout() instead of this function, gdk_draw_layout() handles the details.
|
|
|
|
Draws a Gdk::Image onto a drawable. The depth of the Gdk::Image must match the depth of the Gdk::Drawable.
|
|
|
|
Render a Pango::Layout onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background . foreground and background need not be allocated.
|
|
Render a Pango::Layout onto a GDK drawable.
|
|
Render a Pango::LayoutLine onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background . foreground and background need not be allocated.
|
|
Render a Pango::LayoutLine onto an GDK drawable.
|
|
Draws a line, using the foreground color and other attributes of the Gdk::GC.
|
|
|
|
Renders a rectangular portion of a pixbuf to a drawable.
The destination drawable must have a colormap. All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non- On older X servers, rendering pixbufs with an alpha channel involves round trips to the X server, and may be somewhat slow. Since: 2.2
|
|
Draws a point, using the foreground color and other attributes of the Gdk::GC.
|
|
|
|
|
|
Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the Gdk::GC.
A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined. Calling
|
|
|
|
Like gdk_draw_rgb_32_image(), but allows you to specify the dither offsets. See gdk_draw_rgb_image_dithalign() for more details.
|
|
|
|
|
|
Draws a number of unconnected lines.
|
|
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.
|
|
Gets the colormap for drawable , if one is set; returns
|
|
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.
|
|
Gets the Gdk::Display associated with a Gdk::Drawable.
|
|
Gets the Gdk::Display associated with a Gdk::Drawable.
|
|
A Gdk::Image stores client-side image data (pixels). In contrast, Gdk::Pixmap and Gdk::Window are server-side objects. get_image() obtains the pixels from a server-side drawable as a client-side Gdk::Image. The format of a Gdk::Image depends on the Gdk::Visual of the current display, which makes manipulating Gdk::Image extremely difficult; therefore, in most cases you should use Gdk::Pixbuf::get_from_drawable() instead of this lower-level function. A Gdk::Pixbuf contains image data in a canonicalized RGB format, rather than a display-dependent format. Of course, there's a convenience vs. speed tradeoff here, so you'll want to think about what makes sense for your application. x , y , width , and height define the region of drawable to obtain as an image. You would usually copy image data to the client side if you intend to examine the values of individual pixels, for example to darken an image or add a red tint. It would be prohibitively slow to make a round-trip request to the windowing system for each pixel, so instead you get all of them at once, modify them, then copy them all back at once. If the X server or other windowing system backend is on the local machine, this function may use shared memory to avoid copying the image data. If the source drawable is a Gdk::Window and partially offscreen or obscured, then the obscured portions of the returned image will contain undefined data.
|
|
Gets the Gdk::Screen associated with a Gdk::Drawable.
|
|
Gets the Gdk::Screen associated with a Gdk::Drawable.
|
|
Fills * width and * height with the size of drawable .
width or height can be On the X11 platform, if drawable is a Gdk::Window, 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. 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 Gdk::Visual describing the pixel format of drawable .
|
|
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase. Reimplemented in Gdk::Pixmap, and Gdk::Window. |
|
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase. Reimplemented in Gdk::Pixmap, and Gdk::Window. |
|
Reimplemented in Gdk::Pixmap, and Gdk::Window. |
|
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. i.e. when using a Gdk::GC to draw to a drawable, or copying one drawable to another, the colormaps should match.
|
|
|