Gtk2::Gdk::Image(3)
π Gtk2::Gdk::Image β bestie edition π
okay so this is the Gtk2::Gdk::Image page from the User Contributed Perl Documentation, and it's literally a wrapper for GdkImage. let's get into it π«Ά
β¨ NAME β¨
Gtk2::Gdk::Image β it's a wrapper for GdkImage, no cap. that's the whole vibe.
πΈ DESCRIPTION πΈ
so a Gtk2::Gdk::Image is a 2-D array of pixel values living in client-side memory. it can optionally use shared memory with the X server so copying to or from a window or pixmap is fast. icon behaviour honestly β¨
but bestie, hear me out β if you're thinking of using this, go look at Gtk2::Gdk::Pixbuf first. GdkPixbuf has so many more features, especially file read and write (PNG, JPEG, etc). the trade-off is real though: a GdkImage lets you work directly in pixel values instead of expanding to RGB components. so like, pick your fighter π
also go check Gtk2::Gdk::Drawable for the draw_image, get_image and copy_to_image methods β that's how you draw or fetch images to or from a window or pixmap. π
and one lil lore drop: the various get methods are Gtk 2.22 style. for previous versions they're direct field access. iykyk.
π¦ HIERARCHY π¦
Glib::Object
+----Gtk2::Gdk::Image
the family tree. iconic lineage π
π METHODS π
image or undef = Gtk2::Gdk::Image->new ($type, $visual, $width, $height)β makes a new image, or gives youundef. slay.$type(Gtk2::Gdk::ImageType)$visual(Gtk2::Gdk::Visual)$width(integer)$height(integer)
integer = $image->get_bits_per_pixelβ how many bits per pixel, as an integer.byteorder = $image->get_byte_orderβ hands you the byte order.integer = $image->get_bytes_per_lineβ bytes per line, integer flavoured.integer = $image->get_bytes_per_pixelβ bytes per pixel, also an integer.colormap = $image->get_colormapβ grabs the colormap.$image->set_colormap ($colormap)β sets the colormap.$colormap(Gtk2::Gdk::Colormap)
integer = $image->get_depthβ the depth, as an integer.integer = $image->get_heightβ the height, as an integer.imagetype = $image->get_image_typeβ the image type.unsigned = $image->get_pixel ($x, $y)β reads out one pixel. unsigned, obviously.$x(integer)$y(integer)
string = $image->get_pixels()β returns a copy of the raw pixel data memory from$image. that'sbytes_per_line * heightmany bytes, fr fr. it's giving "here's the whole memory blob bestie" π$image->put_pixel ($x, $y, $pixel)β writes a pixel. put it there π$x(integer)$y(integer)$pixel(unsigned)
visual = $image->get_visualβ the visual.integer = $image->get_widthβ the width, as an integer.
π ENUMS AND FLAGS π
enum Gtk2::Gdk::ByteOrder
'lsb-first'/'GDK_LSB_FIRST''msb-first'/'GDK_MSB_FIRST'
enum Gtk2::Gdk::ImageType
'normal'/'GDK_IMAGE_NORMAL''shared'/'GDK_IMAGE_SHARED''fastest'/'GDK_IMAGE_FASTEST'
all three image types, accounted for. no one left behind π§
π 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, we ate and left no crumbs πβ¨
sign-off time: this lil masterpiece is perl v5.42.0, dated 2025-07-25, and it lives at Gtk2::Gdk::Image(3). main character energy only. 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