Gtk2::G...:Context(3)
π NAME π
ok so bestie, meet Gtk2::Gdk::Cairo::Context β that's the whole name, that's the vibe, that's the moment. She lives in the User Contributed Perl Documentation corner of your man pages and she is so much cooler than she sounds.
πΈ HIERARCHY πΈ
the family tree, and yes she's the baby of the family:
Cairo::Context
+---- Gtk2::Gdk::Cairo::Context (Perl subclass)
β¨ DESCRIPTION β¨
okay so this whole thing is some inter-operation between Cairo (go look at Cairo, fr) and Gdk stuff. it's giving crossover episode π
a Gtk2::Gdk::Cairo::Context lets Cairo draw on a Gdk drawable β that's a window or a pixmap, mwah. she's a Perl-level subclass of Cairo::Context, and all the lil functions down below can be used as methods on her. iconic behaviour honestly.
here's the twist though (and it's a good one): those methods can also be used on other Cairo::Context objects as plain functions. like, for example, set_source_pixbuf can set you up to draw from a Gtk2::Gdk::Pixbuf onto any Cairo context at all. watch:
my $cr = Cairo::Context->create ($surface);
Gtk2::Gdk::Cairo::Context::set_source_pixbuf ($cr, $pixbuf, $x,$y);
$cr->paint;
not me casually flexing that on a plain Cairo context. she's versatile like that π«Ά
π METHODS π
gdkcr = Gtk2::Gdk::Cairo::Context->create ($drawable)
$drawable(Gtk2::Gdk::Drawable)
$gdkcr->rectangle ($rectangle) / $gdkcr->rectangle ($x, $y, $width, $height) / Gtk2::Gdk::Cairo::Context::rectangle ($anycr, $rectangle)
$rectangle(Gtk2::Gdk::Rectangle)
the 4-argument $x, $y, $width, $height version is the base Cairo::Context style, the OGs. this one extends it so you can also just hand her a Gtk2::Gdk::Rectangle instead. glow up tbh β¨
$gdkcr->region ($region) / Gtk2::Gdk::Cairo::Context::region ($anycr, $region)
$region(Gtk2::Gdk::Region)
$gdkcr->reset_clip ($drawable) / Gtk2::Gdk::Cairo::Context::reset_clip ($anycr, $drawable)
$drawable(Gtk2::Gdk::Drawable)
Since: gtk+ 2.18 π±
$gdkcr->set_source_color ($color) / Gtk2::Gdk::Cairo::Context::set_source_color ($anycr, $color)
$color(Gtk2::Gdk::Color)
$gdkcr->set_source_pixbuf ($pixbuf, $pixbuf_x, $pixbuf_y) / Gtk2::Gdk::Cairo::Context::set_source_pixbuf ($anycr, $pixbuf, $pixbuf_x, $pixbuf_y)
$pixbuf(Gtk2::Gdk::Pixbuf)$pixbuf_x(double)$pixbuf_y(double)
$gdkcr->set_source_pixmap ($pixmap, $pixmap_x, $pixmap_y) / Gtk2::Gdk::Cairo::Context::set_source_pixmap ($anycr, $pixmap, $pixmap_x, $pixmap_y)
$pixmap(Gtk2::Gdk::Pixmap)$pixmap_x(double)$pixmap_y(double)
Since: gtk+ 2.10 π±
π SEE ALSO π
Gtk2
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
ok that's the whole page bestie, you ate that πβ¨ and if you wanna know who to blame for the paperwork: that was perl v5.42.0, dated 2025-07-25, signing off from Gtk2::G...:Context(3). mwah, go draw something cute π
π¦ 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