Drawing Primitives. More...
Inherits Glib::Object.
Inherited by Gdk::Pixmap, and Gdk::Window.
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 () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
void | get_size (int& width, int& height) const |
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. | |
Cairo::RefPtr< Cairo::Region > | get_clip_region () const |
Computes the region of a drawable that potentially can be written to by drawing primitives. | |
Cairo::RefPtr< Cairo::Region > | get_visible_region () const |
Computes the region of a drawable that is potentially visible. | |
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. | |
Cairo::RefPtr< Cairo::Context > | create_cairo_context () |
Creates a Cairo context for drawing to drawable. | |
Static Public Member Functions | |
static 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) |
A Glib::wrap() method for this object. |
Drawing Primitives.
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.
An alternative is to create a Cairo::Context with get_cairo_context() while you handle the 'exposed' event of the drawable. For more about this, please see "Using cairo with GTK+" in the "Common questions" section of the GTK+ Reference Manual.
virtual Gdk::Drawable::~Drawable | ( | ) | [virtual] |
Gdk::Drawable::Drawable | ( | ) | [protected] |
static Glib::RefPtr<Drawable> Gdk::Drawable::create | ( | ) | [static] |
Cairo::RefPtr<Cairo::Context> Gdk::Drawable::create_cairo_context | ( | ) |
Cairo::RefPtr<Cairo::Region> Gdk::Drawable::get_clip_region | ( | ) | const |
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.
Glib::RefPtr<Colormap> Gdk::Drawable::get_colormap | ( | ) |
Gets the colormap for drawable, if one is set; returns 0
otherwise.
0
. int Gdk::Drawable::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.
Examples are 8 bits per pixel, 24 bits per pixel, etc.
Glib::RefPtr<const Display> Gdk::Drawable::get_display | ( | ) | const |
Gets the Gdk::Display associated with a Gdk::Drawable.
Glib::RefPtr<Display> Gdk::Drawable::get_display | ( | ) |
Gets the Gdk::Display associated with a Gdk::Drawable.
Glib::RefPtr<const Screen> Gdk::Drawable::get_screen | ( | ) | const |
Gets the Gdk::Screen associated with a Gdk::Drawable.
Glib::RefPtr<Screen> Gdk::Drawable::get_screen | ( | ) |
Gets the Gdk::Screen associated with a Gdk::Drawable.
void Gdk::Drawable::get_size | ( | int & | width, | |
int & | height | |||
) | const |
Fills * width and * height with the size of drawable.
width or height can be 0
if you only want the other one.
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.
width | Location to store drawable's width, or 0 . | |
height | Location to store drawable's height, or 0 . |
Cairo::RefPtr<Cairo::Region> Gdk::Drawable::get_visible_region | ( | ) | const |
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.
Glib::RefPtr<Visual> Gdk::Drawable::get_visual | ( | ) |
Gets the Gdk::Visual describing the pixel format of drawable.
const GdkDrawable* Gdk::Drawable::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
Reimplemented in Gdk::Pixmap, and Gdk::Window.
GdkDrawable* Gdk::Drawable::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
Reimplemented in Gdk::Pixmap, and Gdk::Window.
GdkDrawable* Gdk::Drawable::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Reimplemented in Gdk::Pixmap, and Gdk::Window.
void Gdk::Drawable::set_colormap | ( | const Glib::RefPtr< Colormap >& | 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. i.e. when using a Gdk::GC to draw to a drawable, or copying one drawable to another, the colormaps should match.
colormap | A Gdk::Colormap. |
Glib::RefPtr< Gdk::Drawable > wrap | ( | GdkDrawable * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. | |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |