Gdk::Pixmap Class Reference

Pixmaps are offscreen drawables. More...

Inheritance diagram for Gdk::Pixmap:
[legend]
Collaboration diagram for Gdk::Pixmap:
[legend]

## Public Member Functions

| Pixmap (Pixmap&& src) noexcept
Pixmap& | operator= (Pixmap&& src) noexcept
| ~Pixmap () noexceptoverride
GdkPixmap* | gobj ()
| Provides access to the underlying C GObject. More...
const GdkPixmap* | gobj () const
| Provides access to the underlying C GObject. More...
GdkPixmap* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Public Member Functions inherited from Gdk::Drawable
| Drawable (Drawable&& src) noexcept
Drawable& | operator= (Drawable&& src) noexcept
| ~Drawable () noexceptoverride
GdkDrawable* | gobj ()
| Provides access to the underlying C GObject. More...
const GdkDrawable* | gobj () const
| Provides access to the underlying C GObject. More...
GdkDrawable* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
void | get_size (int& width, int& height)
| Fills * width and * height with the size of drawable. More...
void | get_size (int& width, int& height) const
| Fills * width and * height with the size of drawable. More...
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. More...
void | set_colormap (const Glib::RefPtr< Colormap >& colormap)
| Sets the colormap associated with drawable. More...
Glib::RefPtr< Colormap > | get_colormap ()
| Gets the colormap for drawable, if one is set; returns `nullptr` otherwise. More...
Glib::RefPtr< Visual > | get_visual ()
| Gets the Gdk::Visual describing the pixel format of drawable. More...
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. More...
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. More...
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. More...
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'. More...
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. More...
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. More...
void | draw_segments (const Glib::RefPtr< const GC >& gc, GdkSegment* segs, int nsegs)
| Draws a number of unconnected lines. More...
void | draw_glyphs (const Glib::RefPtr< const GC >& gc, const Glib::RefPtr< const Pango::Font >& font, int x, int y, const Pango::GlyphString& glyphs)
| This is a low-level function; 99% of text rendering should be done using gdk_draw_layout() instead. More...
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. More...
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. More...
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. More...
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. More...
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. More...
void | draw_pixbuf (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. More...
Glib::RefPtr< Image > | get_image (int x, int y, int width, int height) const
| A Gdk::Image stores client-side image data (pixels). More...
void | copy_to_image (const Glib::RefPtr< Image >& image, int src_x, int src_y, int dest_x, int dest_y, int width, int height) const
Region | get_clip_region () const
| Computes the region of a drawable that potentially can be written to by drawing primitives. More...
Region | get_visible_region () const
| Computes the region of a drawable that is potentially visible. More...
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* buf, int rowstride, int xdith, int ydith)
| Like gdk_draw_rgb_32_image(), but allows you to specify the dither offsets. More...
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. More...
Glib::RefPtr< const Screen > | get_screen () const
| Gets the Gdk::Screen associated with a Gdk::Drawable. More...
Glib::RefPtr< Display > | get_display ()
| Gets the Gdk::Display associated with a Gdk::Drawable. More...
Glib::RefPtr< const Display > | get_display () const
| Gets the Gdk::Display associated with a Gdk::Drawable. More...
Cairo::RefPtr< Cairo::Context > | create_cairo_context ()
| Creates a Cairo context for drawing to drawable. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< Pixmap > | create (const Glib::RefPtr< Drawable >& drawable, int width, int height, int depth=-1)
static Glib::RefPtr< Pixmap > | create (const Glib::RefPtr< Drawable >& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg)
static Glib::RefPtr< Pixmap > | create (const Glib::RefPtr< Display >& display, NativeWindow anid)
static Glib::RefPtr< Pixmap > | create_from_data (const Glib::RefPtr< const Drawable >& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg)
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< const Drawable >& drawable, const Color& transparent_color, const std::string& filename)
| Create a Pixmap from a xpm file. More...
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< const Drawable >& drawable, Glib::RefPtr< Bitmap >& mask, const Color& transparent_color, const std::string& filename)
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< const Drawable >& drawable, const Glib::RefPtr< Colormap >& colormap, Glib::RefPtr< Bitmap >& mask, const Color& transparent_color, const std::string& filename)
| Create a Pixmap from a xpm file with colormap. More...
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< const Drawable >& drawable, Glib::RefPtr< Bitmap >& mask, const Color& transparent_color, const char* const* data)
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< const Drawable >& drawable, const Glib::RefPtr< Colormap >& colormap, Glib::RefPtr< Bitmap >& mask, const Color& transparent_color, const char* const* data)
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< Colormap >& colormap, Glib::RefPtr< Bitmap >& mask, const Color& transparent_color, const char* const* data)
static Glib::RefPtr< Pixmap > | create_from_xpm (const Glib::RefPtr< Colormap >& colormap, Glib::RefPtr< Bitmap >& mask, const char* const* data)
Static Public Member Functions inherited from Gdk::Drawable
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< Drawable > | create ()

## Protected Member Functions

| Pixmap ()
| Pixmap (const Glib::RefPtr< Drawable >& drawable, int width, int height, int depth=-1)
| Pixmap (const Glib::RefPtr< Drawable >& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg)
| Initialize a Pixmap from data. More...
| Pixmap (const Glib::RefPtr< Display >& display, NativeWindow anid)
Protected Member Functions inherited from Gdk::Drawable
| Drawable ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexceptoverride
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gdk::Pixmap > | wrap (GdkPixmapObject* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gdk::Drawable
Glib::RefPtr< Gdk::Drawable > | wrap (GdkDrawable* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members

Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Pixmaps are offscreen drawables.

They can be drawn upon with the standard drawing primitives, then copied to another drawable (such as a Gdk::Window) with Gdk::Drawable::draw_drawable(). The depth of a pixmap is the number of bits per pixels. Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off).

## Constructor & Destructor Documentation

Gdk::Pixmap::Pixmap | ( | Pixmap&& | src | ) |

noexcept

Gdk::Pixmap::~Pixmap | ( |  | ) |

override noexcept

Gdk::Pixmap::Pixmap | ( |  | ) |

protected

Gdk::Pixmap::Pixmap | ( | const Glib::RefPtr< Drawable >& | drawable,
|  | int | width,
|  | int | height,
|  | int | depth = `-1`
| ) |  |

protected

Gdk::Pixmap::Pixmap | ( | const Glib::RefPtr< Drawable >& | drawable,
|  | const char * | data,
|  | int | width,
|  | int | height,
|  | int | depth,
|  | const Color& | fg,
|  | const Color& | bg
| ) |  |

protected

Initialize a Pixmap from data.

Gdk::Pixmap::Pixmap | ( | const Glib::RefPtr< Display >& | display,
|  | NativeWindow | anid
| ) |  |

protected

## Member Function Documentation

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create | ( | const Glib::RefPtr< Drawable >& | drawable,
|  | int | width,
|  | int | height,
|  | int | depth = `-1`
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create | ( | const Glib::RefPtr< Drawable >& | drawable,
|  | const char * | data,
|  | int | width,
|  | int | height,
|  | int | depth,
|  | const Color& | fg,
|  | const Color& | bg
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create | ( | const Glib::RefPtr< Display >& | display,
|  | NativeWindow | anid
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_data | ( | const Glib::RefPtr< const Drawable >& | drawable,
|  | const char * | data,
|  | int | width,
|  | int | height,
|  | int | depth,
|  | const Color& | fg,
|  | const Color& | bg
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< const Drawable >& | drawable,
|  | const Color& | transparent_color,
|  | const std::string & | filename
| ) |  |

static

Create a Pixmap from a xpm file.

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< const Drawable >& | drawable,
|  | Glib::RefPtr< Bitmap >& | mask,
|  | const Color& | transparent_color,
|  | const std::string & | filename
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< const Drawable >& | drawable,
|  | const Glib::RefPtr< Colormap >& | colormap,
|  | Glib::RefPtr< Bitmap >& | mask,
|  | const Color& | transparent_color,
|  | const std::string & | filename
| ) |  |

static

Create a Pixmap from a xpm file with colormap.

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< const Drawable >& | drawable,
|  | Glib::RefPtr< Bitmap >& | mask,
|  | const Color& | transparent_color,
|  | const char *const * | data
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< const Drawable >& | drawable,
|  | const Glib::RefPtr< Colormap >& | colormap,
|  | Glib::RefPtr< Bitmap >& | mask,
|  | const Color& | transparent_color,
|  | const char *const * | data
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< Colormap >& | colormap,
|  | Glib::RefPtr< Bitmap >& | mask,
|  | const Color& | transparent_color,
|  | const char *const * | data
| ) |  |

static

static Glib::RefPtr<Pixmap> Gdk::Pixmap::create_from_xpm | ( | const Glib::RefPtr< Colormap >& | colormap,
|  | Glib::RefPtr< Bitmap >& | mask,
|  | const char *const * | data
| ) |  |

static

static GType Gdk::Pixmap::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

GdkPixmap* Gdk::Pixmap::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

const GdkPixmap* Gdk::Pixmap::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

GdkPixmap* Gdk::Pixmap::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Pixmap& Gdk::Pixmap::operator= | ( | Pixmap&& | src | ) |

noexcept

## Friends And Related Function Documentation

Glib::RefPtr< Gdk::Pixmap > wrap | ( | GdkPixmapObject * | object,
|  | bool | take_copy = `false`
| ) |  |

related

A Glib::wrap() method for this object.

Parameters

  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.

Returns
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gdkmm/pixmap.h