Gtk2::G...Drawable(3)
π NAME π
Gtk2::Gdk::Drawable β bestie, it's the wrapper for GdkDrawable. That's the whole name, no notes, we move. β¨
(You've landed on the Gtk2::G...Drawable(3) page from the User Contributed Perl Documentation, in case the URL got you confused π«Ά)
πΈ HIERARCHY πΈ
Glib::Object
+----Gtk2::Gdk::Drawable
So Gtk2::Gdk::Drawable is a Glib::Object that branched off and became its own thing. Family lineage, iconic, no cap. π
β¨ METHODS β¨
π The little getters that just vibe
unsigned = $drawable->XID
Hands you back an unsigned. That's it. That's the tea. β
unsigned = $drawable->XWINDOW
Also an unsigned β the all-caps, XWINDOW-flavored one. π
region = $drawable->get_clip_region
Returns a region. Clip clip, bestie. βοΈ
colormap or undef = $drawable->get_colormap
Returns a colormap, or undef. She may or may not show up β very "left me on read" of her. π
$drawable->set_colormap ($colormap)
$colormap(Gtk2::Gdk::Colormap) β the colormap you're handing over.
Setting the colormap. Periodt. π
integer = $drawable->get_depth
Returns an integer. How deep is the depth? An integer's worth. π
display = $drawable->get_display
Returns the display.
Since: gtk+ 2.2 β so if you're on anything older, this is not your era, sorry bestie. π
screen = $drawable->get_screen
Returns the screen.
Since: gtk+ 2.2
(width, height) = $drawable->get_size
Two things back at once: width and height. List-context girlies, this one is FOR you. π
region = $drawable->get_visible_region
Returns the region that's visible. Eyes on it π
visual = $drawable->get_visual
Returns the visual. Aesthetic, honestly. π¦
unsigned = $drawable->get_xid
Another unsigned β but this one goes through get_xid instead of the shouty XID spelling. Same energy, different font. π
π¨ Drawing things, the fun part
$drawable->copy_to_image ($image, $src_x, $src_y, $dest_x, $dest_y, $width, $height)
$image(Gtk2::Gdk::Imageorundef)$src_x(integer)$src_y(integer)$dest_x(integer)$dest_y(integer)$width(integer)$height(integer)
Returns an image. Copy it over, glow it up. β¨
Since: gtk+ 2.4
$drawable->draw_arc ($gc, $filled, $x, $y, $width, $height, $angle1, $angle2)
$gc(Gtk2::Gdk::GC)$filled(boolean)$x(integer)$y(integer)$width(integer)$height(integer)$angle1(integer)$angle2(integer)
An arc with two angles, because one angle could never carry the whole arc. π
$drawable->draw_drawable ($gc, $src, $xsrc, $ysrc, $xdest, $ydest, $width, $height)
$gc(Gtk2::Gdk::GC)$src(Gtk2::Gdk::Drawable)$xsrc(integer)$ysrc(integer)$xdest(integer)$ydest(integer)$width(integer)$height(integer)
Drawable drawing a drawable. Drawable-ception. π
$drawable->draw_gray_image ($gc, $x, $y, $width, $height, $dith, $buf, $rowstride)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$width(integer)$height(integer)$dith(Gtk2::Gdk::RgbDither)$buf(scalar)$rowstride(integer)
Gray image, but make it dither. π«οΈ
$drawable->draw_image ($gc, $image, $xsrc, $ysrc, $xdest, $ydest, $width, $height)
$gc(Gtk2::Gdk::GC)$image(Gtk2::Gdk::Image)$xsrc(integer)$ysrc(integer)$xdest(integer)$ydest(integer)$width(integer)$height(integer)
Drawing an actual Gtk2::Gdk::Image this time. πΌοΈ
$drawable->draw_indexed_image ($gc, $x, $y, $width, $height, $dith, $buf, $rowstride, $cmap)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$width(integer)$height(integer)$dith(Gtk2::Gdk::RgbDither)$buf(scalar)$rowstride(integer)$cmap(scalar)
Indexed image β she brought her own $cmap to the function, love that for her. π¨
$drawable->draw_layout ($gc, $x, $y, $layout)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$layout(Pango::Layout)
A Pango::Layout gets drawn. Text era. π
$drawable->draw_layout_line ($gc, $x, $y, $line)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$line(Pango::LayoutLine)
Same but a single Pango::LayoutLine instead of the whole layout. βοΈ
$drawable->draw_layout_line_with_colors ($gc, $x, $y, $line, $foreground, $background)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$line(Pango::LayoutLine)$foreground(Gtk2::Gdk::Colororundef)$background(Gtk2::Gdk::Colororundef)
Now WITH COLORS. Both $foreground and $background can be undef, so you can absolutely just do one. π¨π
$drawable->draw_layout_with_colors ($gc, $x, $y, $layout, $foreground, $background)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$layout(Pango::Layout)$foreground(Gtk2::Gdk::Colororundef)$background(Gtk2::Gdk::Colororundef)
The Pango::Layout version of the above, also with $foreground / $background that may be undef. π
$drawable->draw_line ($gc, $x1_, $y1_, $x2_, $y2_)
$gc(Gtk2::Gdk::GC)$x1_(integer)$y1_(integer)$x2_(integer)$y2_(integer)
One line. And yes, the trailing underscores in $x1_, $y1_, $x2_, $y2_ are real and intentional β do not "fix" them, bestie, that's the API. π«
$drawable->draw_lines ($gc, ...)
$gc(Gtk2::Gdk::GC)...(list) integer x,y coordinates (possibly none)
For example:
$win->draw_lines ($gc, 0,0, 20,30, 40,20);
"Possibly none" coordinates is sending me β you can literally call it with zero points. π
$drawable->draw_pixbuf ($gc, $pixbuf, $src_x, $src_y, $dest_x, $dest_y, $width, $height, $dither, $x_dither, $y_dither)
$gc(Gtk2::Gdk::GCorundef)$pixbuf(Gtk2::Gdk::Pixbuf)$src_x(integer)$src_y(integer)$dest_x(integer)$dest_y(integer)$width(integer)$height(integer)$dither(Gtk2::Gdk::RgbDither)$x_dither(integer)$y_dither(integer)
$gc here can be undef, which is very "come as you are" of it. π«Ά
Since: gtk+ 2.2
$drawable->draw_point ($gc, $x, $y)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)
One singular point. Tiny. Precious. A little pixel baby. β
$drawable->draw_points ($gc, ...)
$gc(Gtk2::Gdk::GC)...(list) integer x,y coordinates (possibly none)
For example three points:
$win->draw_points ($gc, 0,0, 10,10, 20,20);
$drawable->draw_polygon ($gc, $filled, $x1, $y1, ...)
$gc(Gtk2::Gdk::GC)$filled(boolean)$x1(integer) the x coordinate of the first point$y1(integer) the y coordinate of the first point...(list) pairs of x and y coordinates
You give it the first point properly ($x1, $y1), then the rest of the points roll in as pairs. π·
$drawable->draw_rectangle ($gc, $filled, $x, $y, $width, $height)
$gc(Gtk2::Gdk::GC)$filled(boolean)$x(integer)$y(integer)$width(integer)$height(integer)
A rectangle, and you decide whether it's $filled or just an outline. Serving both looks. β¬
$drawable->draw_rgb_32_image ($gc, $x, $y, $width, $height, $dith, $buf, $rowstride)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$width(integer)$height(integer)$dith(Gtk2::Gdk::RgbDither)$buf(scalar)$rowstride(integer)
32-bit RGB image, dither and all. π₯οΈ
$drawable->draw_rgb_32_image_dithalign ($gc, $x, $y, $width, $height, $dith, $rgb_buf, $rowstride, $xdith, $ydith)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$width(integer)$height(integer)$dith(Gtk2::Gdk::RgbDither)$rgb_buf(scalar)$rowstride(integer)$xdith(integer)$ydith(integer)
Same 32-bit RGB energy, except now the dither is aligned β that's what $xdith and $ydith are there for. Note the buffer is called $rgb_buf here, not $buf. Names matter, bestie. π
$drawable->draw_rgb_image ($gc, $x, $y, $width, $height, $dith, $buf, $rowstride)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$width(integer)$height(integer)$dith(Gtk2::Gdk::RgbDither)$buf(scalar)$rowstride(integer)
RGB image, no 32 in the name this time. π―
$drawable->draw_rgb_image_dithalign ($gc, $x, $y, $width, $height, $dith, $rgb_buf, $rowstride, $xdith, $ydith)
$gc(Gtk2::Gdk::GC)$x(integer)$y(integer)$width(integer)$height(integer)$dith(Gtk2::Gdk::RgbDither)$rgb_buf(scalar)$rowstride(integer)$xdith(integer)$ydith(integer)
And the RGB (not-32) version with dither alignment. $rgb_buf again, $xdith and $ydith again. π«
$drawable->draw_segments ($gc, ...)
$gc(Gtk2::Gdk::GC)...(list) quads of x1,y1,x2,y2 coordinates
For example, to draw two diagonal line segments:
$drawable->draw_segments($gc, 0,0,100,100, 200,200,300,300);
Quads. Four numbers per segment. Math ate. π
image = $drawable->get_image ($x, $y, $width, $height)
$x(integer)$y(integer)$width(integer)$height(integer)
Returns an image. πΈ
π ENUMS AND FLAGS π
enum Gtk2::Gdk::RgbDither
'none'/GDK_RGB_DITHER_NONE'normal'/GDK_RGB_DITHER_NORMAL'max'/GDK_RGB_DITHER_MAX
Three dither moods: none, normal, and max. Pick your fighter. β¨
π SEE ALSO π
Gtk2Glib::Object
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
Okay that's the whole page, bestie β you made it to the bottom, crown behavior. π This was perl v5.42.0, dated 2025-07-25, and you were reading Gtk2::G...Drawable(3) the whole time. Drink some water, go draw a rectangle, mwah ππ«Ά
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms