Gtk2::G...::Cache(3)

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

πŸ’– Gtk2::Gdk::Pixbuf::Draw::Cache β€” bestie edition πŸ’–

okay so this is the page for Gtk2::G...::Cache(3), from the User Contributed Perl Documentation collection (yes that's the whole manual name, it's a mouthful, we move). it's giving "niche but iconic" fr fr πŸŽ€


✨ NAME ✨

Gtk2::Gdk::Pixbuf::Draw::Cache β€” the Cache for drawing scaled pixbufs πŸ’…


🌸 DESCRIPTION 🌸

Gtk2::Gdk::Pixbuf::Draw::Cache gives you a cache, and bestie, this cache is supposed to be used by the Gtk2::ImageView::Tool whenever it's redrawing the Gtk2::ImageView. that's literally its whole job. no cap. ✨


πŸ¦‹ HIERARCHY πŸ¦‹

look at this little family tree, so cute:

  Glib::Boxed
  +----Gtk2::Gdk::Pixbuf::Draw::Cache

πŸ‘‘ METHODS πŸ‘‘

πŸ“ cache = Gtk2::Gdk::Pixbuf::Draw::Cache->new

Returns a new pixbuf draw cache. fresh out the box, brand new, main character energy. πŸ’–


🌈 $cache->draw ($opts, $drawable)

the args, bestie:

  • $opts (Gtk2::Gdk::Pixbuf::Draw::Opts)
  • $drawable (Gtk2::Gdk::Drawable)

this redraws the area specified in the pixbuf draw options, but like, in an efficient way, because it uses caching. we love an efficient queen. πŸ”₯

and the deets:

  • cache : a GdkPixbufDrawCache
  • opts : the Gtk2::Gdk::Pixbuf::Draw::Opts to use in this draw
  • drawable : a GdkDrawable to draw on

πŸ’€ $cache->free

Deallocates a pixbuf draw cache and all its data. it's over, it's done, say goodbye πŸ‘‹πŸ˜­


🧚 $cache->invalidate

Force the pixbuf draw cache to scale the pixbuf at the next draw. forceful. iconic. πŸ’…

Gtk2::Gdk::Pixbuf::Draw::Cache tries to minimize the number of scale operations needed by caching the last drawn pixbuf. and ngl, it would be inefficient to check the individual pixels inside the pixbuf, so instead it assumes that if the memory address of the pixbuf has not changed, then the cache is good to use. lowkey clever, highkey risky.

HOWEVER. 😭 when the image data is modified, this assumption breaks β€” which is exactly why you must use this method to tell the draw cache about it. don't skip this step bestie, fr fr.

⭐ method = Gtk2::Gdk::Pixbuf::Draw::Cache->get_method ($old, $new)

args, one more time:

  • $old (Gtk2::Gdk::Pixbuf::Draw::Opts)
  • $new (Gtk2::Gdk::Pixbuf::Draw::Opts)

Gets the fastest method to draw the specified draw options. old is assumed to be the last PixbufDrawOpts used, and new is the one to use this time. speedrun strats πŸƒβ™€οΈπŸ’¨


πŸŽ€ ENUMS AND FLAGS πŸŽ€

enum Gtk2::Gdk::Pixbuf::Draw::Method

the whole lineup, no notes:

  • 'scale' / 'GDK_PIXBUF_DRAW_METHOD_SCALE'
  • 'contains' / 'GDK_PIXBUF_DRAW_METHOD_CONTAINS'
  • 'scroll' / 'GDK_PIXBUF_DRAW_METHOD_SCROLL'

🫢 SEE ALSO 🫢

  • Gtk2::ImageView
  • Glib::Boxed

go read those too, iykyk πŸ’œ


Copyright (C) 2007 by Jeffrey Ratcliffe.

This software is licensed under the GPL-3; see Gtk2::ImageView for a full notice.


and that's the whole page babes ✨ this was perl v5.42.0, dated 2025-07-25, living its life as Gtk2::G...::Cache(3). slay, stay cached, and remember: invalidate when you mutate πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from