Pixmap

Description Pixmaps are offscreen drawables. They can be drawn upon with the standard drawing primitives, then copied to another drawable (such as a GdkWindow) with gdk_pixmap_draw(). 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). GTK 3 will remove GdkPixmap and GdkBitmap. You should use cairo surfaces instead. However, because a lot of functions still use these types, they are not deprecated.

Constructors

this
this(GdkPixmap* gdkPixmap)

Sets our main struct and passes it to the parent class

this
this(Drawable drawable, int width, int height, int depth)

Create a new pixmap with a given size and depth. Please use gdk_window_create_similar_surface() instead of this function if you're not forced to use a GdkPixmap. It is intended as the replacement function for this function in GTK 3.

Members

Functions

getPixmapStruct
GdkPixmap* getPixmapStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getSize
void getSize(int width, int height)

This function is purely to make it possible to query the size of pixmaps even when compiling without deprecated symbols and you must use pixmaps. It is identical to gdk_drawable_get_size(), but for pixmaps. Since 2.24

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

colormapCreateFromXpm
Pixmap colormapCreateFromXpm(Drawable drawable, Colormap colormap, Bitmap mask, Color transparentColor, string filename)

Warning gdk_pixmap_colormap_create_from_xpm has been deprecated since version 2.22 and should not be used in newly-written code. Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_file() to create it. If you must use a pixmap, use gdk_pixmap_new() to create it and Cairo to draw the pixbuf onto it. Create a pixmap from a XPM file using a particular colormap.

colormapCreateFromXpmD
Pixmap colormapCreateFromXpmD(Drawable drawable, Colormap colormap, Bitmap mask, Color transparentColor, string[] data)

Warning gdk_pixmap_colormap_create_from_xpm_d has been deprecated since version 2.22 and should not be used in newly-written code. Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_xpm_data() to create it. If you must use a pixmap, use gdk_pixmap_new() to create it and Cairo to draw the pixbuf onto it. Create a pixmap from data in XPM format using a particular colormap.

createFromData
Pixmap createFromData(Drawable drawable, string data, int width, int height, int depth, Color fg, Color bg)

Warning gdk_pixmap_create_from_data has been deprecated since version 2.22 and should not be used in newly-written code. If you must replicate the functionality of this function, create a pixmap using gdk_pixmap_new(), cairo_paint() it with the background color and then create a Cairo image surface as pointed out in the docs to gdk_bitmap_create_from_data() and use this surface with cairo_mask_surface() to paint the foreground color. Create a two-color pixmap from data in XBM data.

createFromXpm
Pixmap createFromXpm(Drawable drawable, Bitmap mask, Color transparentColor, string filename)

Warning gdk_pixmap_create_from_xpm has been deprecated since version 2.22 and should not be used in newly-written code. Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_file() to create it. If you must use a pixmap, use gdk_pixmap_new() to create it and Cairo to draw the pixbuf onto it. Create a pixmap from a XPM file.

createFromXpmD
Pixmap createFromXpmD(Drawable drawable, Bitmap mask, Color transparentColor, string[] data)

Warning gdk_pixmap_create_from_xpm_d has been deprecated since version 2.22 and should not be used in newly-written code. Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_xpm_data() to create it. If you must use a pixmap, use gdk_pixmap_new() to create it and Cairo to draw the pixbuf onto it. Create a pixmap from data in XPM format.

Variables

gdkPixmap
GdkPixmap* gdkPixmap;

the main Gtk struct

Inherited Members

From Drawable

gdkDrawable
GdkDrawable* gdkDrawable;

the main Gtk struct

getDrawableStruct
GdkDrawable* getDrawableStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
drawPixbuf
void drawPixbuf(Pixbuf pixbuf, int destX, int destY)
drawPixbuf
void drawPixbuf(GC gc, Pixbuf pixbuf, int destX, int destY)
setData
void setData(string key, void* data, GDestroyNotify destroyFunc)

Warning gdk_drawable_set_data is deprecated and should not be used in newly-written code. This function is equivalent to g_object_set_data(), the GObject variant should be used instead.

getData
void* getData(string key)

Warning gdk_drawable_get_data is deprecated and should not be used in newly-written code. Equivalent to g_object_get_data(); the GObject variant should be used instead.

getDisplay
Display getDisplay()

Warning gdk_drawable_get_display has been deprecated since version 2.24 and should not be used in newly-written code. Use gdk_window_get_display() instead Gets the GdkDisplay associated with a GdkDrawable. Since 2.2

getScreen
Screen getScreen()

Warning gdk_drawable_get_screen has been deprecated since version 2.24 and should not be used in newly-written code. Use gdk_window_get_screen() instead Gets the GdkScreen associated with a GdkDrawable. Since 2.2

getVisual
Visual getVisual()

Warning gdk_drawable_get_visual has been deprecated since version 2.24 and should not be used in newly-written code. Use gdk_window_get_visual() Gets the GdkVisual describing the pixel format of drawable.

setColormap
void setColormap(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 GdkGC to draw to a drawable, or copying one drawable to another, the colormaps should match.

getColormap
Colormap getColormap()

Gets the colormap for drawable, if one is set; returns NULL otherwise.

getDepth
int getDepth()

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.

getSize
void getSize(int width, int height)

Warning gdk_drawable_get_size has been deprecated since version 2.24 and should not be used in newly-written code. Use gdk_window_get_width() and gdk_window_get_height() for GdkWindows. Use gdk_pixmap_get_size() for GdkPixmaps. 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.

getClipRegion
Region getClipRegion()

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.

getVisibleRegion
Region getVisibleRegion()

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.

drawPoint
void drawPoint(GC gc, int x, int y)

Warning gdk_draw_point has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_rectangle() and cairo_fill() or cairo_move_to() and cairo_stroke() instead. Draws a point, using the foreground color and other attributes of the GdkGC.

drawPoints
void drawPoints(GC gc, GdkPoint[] points)

Warning gdk_draw_points has been deprecated since version 2.22 and should not be used in newly-written code. Use n_points calls to cairo_rectangle() and cairo_fill() instead. Draws a number of points, using the foreground color and other attributes of the GdkGC.

drawLine
void drawLine(GC gc, int x1_, int y1_, int x2_, int y2_)

Warning gdk_draw_line has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_line_to() and cairo_stroke() instead. Be aware that the default line width in Cairo is 2 pixels and that your coordinates need to describe the center of the line. To draw a single

drawLines
void drawLines(GC gc, GdkPoint[] points)

Warning gdk_draw_lines has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_line_to() and cairo_stroke() instead. See the documentation of gdk_draw_line() for notes on line drawing with Cairo. Draws a series of lines connecting the given points. The way in which joins between lines are draw is determined by the GdkCapStyle value in the GdkGC. This can be set with gdk_gc_set_line_attributes().

drawPixbuf
void drawPixbuf(GC gc, Pixbuf pixbuf, int srcX, int srcY, int destX, int destY, int width, int height, GdkRgbDither dither, int xDither, int yDither)

Warning gdk_draw_pixbuf has been deprecated since version 2.22 and should not be used in newly-written code. Use gdk_cairo_set_source_pixbuf() and cairo_paint() or cairo_rectangle() and cairo_fill() instead. 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-NULL window argument. Otherwise a colormap must be set on them with gdk_drawable_set_colormap(). On older X servers, rendering pixbufs with an alpha channel involves round trips to the X server, and may be somewhat slow. If GDK is built with the Sun mediaLib library, the gdk_draw_pixbuf function is accelerated using mediaLib, which provides hardware acceleration on Intel, AMD, and Sparc chipsets. If desired, mediaLib support can be turned off by setting the GDK_DISABLE_MEDIALIB environment variable. Since 2.2

drawSegments
void drawSegments(GC gc, GdkSegment[] segs)

Warning gdk_draw_segments has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_move_to(), cairo_line_to() and cairo_stroke() instead. See the documentation of gdk_draw_line() for notes on line drawing with Cairo. Draws a number of unconnected lines.

drawRectangle
void drawRectangle(GC gc, int filled, int x, int y, int width, int height)

Warning gdk_draw_rectangle has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_rectangle() and cairo_fill() or cairo_stroke() instead. For stroking, the same caveats for converting code apply as for gdk_draw_line(). Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the GdkGC. A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined. Calling gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20) results in a filled rectangle 20 pixels wide and 20 pixels high. Calling gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20) results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high. Note

drawArc
void drawArc(GC gc, int filled, int x, int y, int width, int height, int angle1, int angle2)

Warning gdk_draw_arc has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_arc() and cairo_fill() or cairo_stroke() instead. Note that arcs just like any drawing operation in Cairo are antialiased unless you call cairo_set_antialias(). 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.

drawPolygon
void drawPolygon(GC gc, int filled, GdkPoint[] points)

Warning gdk_draw_polygon has been deprecated since version 2.22 and should not be used in newly-written code. Use cairo_line_to() or cairo_append_path() and cairo_fill() or cairo_stroke() instead. Draws an outlined or filled polygon.

drawTrapezoids
void drawTrapezoids(GC gc, GdkTrapezoid[] trapezoids)

Warning gdk_draw_trapezoids has been deprecated since version 2.22 and should not be used in newly-written code. Use Cairo path contruction functions and cairo_fill() instead. Draws a set of anti-aliased trapezoids. The trapezoids are combined using saturation addition, then drawn over the background as a set. This is low level functionality used internally to implement rotated underlines and backgrouds when rendering a PangoLayout and is likely not useful for applications. Since 2.6

drawGlyphs
void drawGlyphs(GC gc, PgFont font, int x, int y, PgGlyphString glyphs)

Warning gdk_draw_glyphs has been deprecated since version 2.22 and should not be used in newly-written code. Use pango_cairo_show_glyphs() instead. This is a low-level function; 99% of text rendering should be done using gdk_draw_layout() instead. A glyph is a single image 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.

drawGlyphsTransformed
void drawGlyphsTransformed(GC gc, PgMatrix matrix, PgFont font, int x, int y, PgGlyphString glyphs)

Warning gdk_draw_glyphs_transformed has been deprecated since version 2.22 and should not be used in newly-written code. Use pango_cairo_show_glyphs() instead. Renders a PangoGlyphString onto a drawable, possibly transforming the layed-out coordinates through a transformation matrix. Note that the transformation matrix for font is not changed, so to produce correct rendering results, the font must have been loaded using a PangoContext with an identical transformation matrix to that passed in to this function. See also gdk_draw_glyphs(), gdk_draw_layout(). Since 2.6

drawLayoutLine
void drawLayoutLine(GC gc, int x, int y, PgLayoutLine line)

Warning gdk_draw_layout_line is deprecated and should not be used in newly-written code. Render a PangoLayoutLine onto an GDK drawable If the layout's PangoContext has a transformation matrix set, then x and y specify the position of the left edge of the baseline (left is in before-tranform user coordinates) in after-transform device coordinates.

drawLayoutLineWithColors
void drawLayoutLineWithColors(GC gc, int x, int y, PgLayoutLine line, Color foreground, Color background)

Warning gdk_draw_layout_line_with_colors is deprecated and should not be used in newly-written code. Render a PangoLayoutLine onto a GdkDrawable, overriding the layout's normal colors with foreground and/or background. foreground and background need not be allocated. If the layout's PangoContext has a transformation matrix set, then x and y specify the position of the left edge of the baseline (left is in before-tranform user coordinates) in after-transform device coordinates.

drawLayout
void drawLayout(GC gc, int x, int y, PgLayout layout)

Warning gdk_draw_layout is deprecated and should not be used in newly-written code. Render a PangoLayout onto a GDK drawable If the layout's PangoContext has a transformation matrix set, then x and y specify the position of the top left corner of the bounding box (in device space) of the transformed layout. If you're using GTK+, the usual way to obtain a PangoLayout is gtk_widget_create_pango_layout().

drawLayoutWithColors
void drawLayoutWithColors(GC gc, int x, int y, PgLayout layout, Color foreground, Color background)

Warning gdk_draw_layout_with_colors is deprecated and should not be used in newly-written code. Render a PangoLayout onto a GdkDrawable, overriding the layout's normal colors with foreground and/or background. foreground and background need not be allocated. If the layout's PangoContext has a transformation matrix set, then x and y specify the position of the top left corner of the bounding box (in device space) of the transformed layout. If you're using GTK+, the ususal way to obtain a PangoLayout is gtk_widget_create_pango_layout().

drawString
void drawString(Font font, GC gc, int x, int y, string string)

Warning gdk_draw_string has been deprecated since version 2.4 and should not be used in newly-written code. Use gdk_draw_layout() instead. Draws a string of characters in the given font or fontset.

drawText
void drawText(Font font, GC gc, int x, int y, string text, int textLength)

Warning gdk_draw_text has been deprecated since version 2.4 and should not be used in newly-written code. Use gdk_draw_layout() instead. Draws a number of characters in the given font or fontset.

drawTextWc
void drawTextWc(Font font, GC gc, int x, int y, GdkWChar[] text)

Warning gdk_draw_text_wc has been deprecated since version 2.4 and should not be used in newly-written code. Use gdk_draw_layout() instead. Draws a number of wide characters using the given font of fontset. If the font is a 1-byte font, the string is converted into 1-byte characters (discarding the high bytes) before output.

drawDrawable
void drawDrawable(GC gc, Drawable src, int xsrc, int ysrc, int xdest, int ydest, int width, int height)

Warning gdk_draw_drawable has been deprecated since version 2.22 and should not be used in newly-written code. Use gdk_cairo_set_source_pixmap(), cairo_rectangle() and cairo_fill() to draw pixmap on top of other drawables. Also keep in mind that the limitations on allowed sources do not apply to Cairo. 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 the stipple on the GdkGC, set the fill mode to GDK_STIPPLED, and then draw the rectangle.

drawImage
void drawImage(GC gc, ImageGdk image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)

Warning gdk_draw_image has been deprecated since version 2.22 and should not be used in newly-written code. Do not use GdkImage anymore, instead use Cairo image surfaces. Draws a GdkImage onto a drawable. The depth of the GdkImage must match the depth of the GdkDrawable.

getImage
ImageGdk getImage(int x, int y, int width, int height)

Warning gdk_drawable_get_image has been deprecated since version 2.22 and should not be used in newly-written code. Use drawable as the source and draw to a Cairo image surface if you want to download contents to the client. A GdkImage stores client-side image data (pixels). In contrast, GdkPixmap and GdkWindow are server-side objects. gdk_drawable_get_image() obtains the pixels from a server-side drawable as a client-side GdkImage. The format of a GdkImage depends on the GdkVisual of the current display, which makes manipulating GdkImage extremely difficult; therefore, in most cases you should use gdk_pixbuf_get_from_drawable() instead of this lower-level function. A GdkPixbuf 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 GdkWindow and partially offscreen or obscured, then the obscured portions of the returned image will contain undefined data.

copyToImage
ImageGdk copyToImage(ImageGdk image, int srcX, int srcY, int destX, int destY, int width, int height)

Warning gdk_drawable_copy_to_image has been deprecated since version 2.22 and should not be used in newly-written code. Use drawable as the source and draw to a Cairo image surface if you want to download contents to the client. Copies a portion of drawable into the client side image structure image. If image is NULL, creates a new image of size width x height and copies into that. See gdk_drawable_get_image() for further details. Since 2.4

Meta