Gtk2::Gdk::Image(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– 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 you undef. 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's bytes_per_line * height many 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 πŸ’€

  • Gtk2
  • Glib::Object

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