Gtk2::I...ew::Tool(3)

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

✨ NAME ✨

Gtk2::ImageView::Tool β€” it's the interface for anything that wants to be a tool for Gtk2::ImageView πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, listen. Gtk2::ImageView::Tool is an interface β€” it defines how Gtk2::ImageView talks to objects that act as tools. And like, the view is not doing the hard work itself?? No ma'am. Gtk2::ImageView delegates a whole bunch of its most important tasks β€” drawing included β€” to its tool, and the tool does literally all the heavy lifting. main character energy for real πŸ‘‘

Gtk2::ImageView ships with two tools: Gtk2::ImageView::Tool::Dragger and Gtk2::ImageView::Tool::Selector. but here's the slay part β€” you can implement your own tool and extend Gtk2::ImageView to do stuff its author literally never imagined. iconic πŸŽ€

by default Gtk2::ImageView uses Gtk2::ImageView::Tool::Dragger, because that one is the most generally useful of the two. but swapping in another tool? trivial. no cap:

 my $view = Gtk2::ImageView->new;
 my $tool = Gtk2::ImageView::Tool::Selector ($view);
 $view->set_tool ($tool);

run that and boom πŸ’₯ β€” the view is now using the selector tool instead of the default dragger tool.


🌸 HIERARCHY 🌸

  Glib::Interface
  +----Gtk2::ImageView::Tool

πŸ› οΈ METHODS πŸ› οΈ

boolean = $tool->button_press ($ev)

  • $ev (Gtk2::Gdk::Event)

boolean = $tool->button_release ($ev)

  • $ev (Gtk2::Gdk::Event)

cursor = $tool->cursor_at_point ($x, $y)

  • $x (integer)
  • $y (integer)

returns the cursor to display at those given coordinates. ✨

boolean = $tool->motion_notify ($ev)

  • $ev (Gtk2::Gdk::Event)

$tool->paint_image ($opts, $drawable)

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

this one gets called whenever the image view decides that any part of the image it's showing needs to be redrawn. 🎨

$tool->pixbuf_changed ($reset_fit, $rect)

  • $reset_fit (boolean)
  • $rect (Gtk2::Gdk::Rectangle)

this is the heads-up that either part of, or the whole, pixbuf the image view shows has changed. the view calls it whenever its pixbuf changes or its tool changes β€” like, whenever any of these methods get used:

 Gtk2::ImageView::set_pixbuf()
 Gtk2::ImageView::set_tool()
 Gtk2::ImageView::damage_pixels()

and if the reset_fit parameter is TRUE? that means a brand new pixbuf has been loaded into the view, bestie 🫢

  • tool : the tool
  • reset_fit : whether the view is resetting its fit mode or not
  • rect : rectangle containing the changed area or NULL

πŸ‘€ SEE ALSO πŸ‘€

Gtk2::ImageView, Glib::Interface


Copyright (C) 2007 by Jeffrey Ratcliffe.

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


okay that's the whole page, you ate it, periodt πŸ’…βœ¨ this was perl v5.42.0, dated 2025-07-25, and you were reading the Gtk2::ImageView::Tool(3) man page πŸŽ€ bye bestie!! πŸŒˆπŸ’œ

πŸ“¦ where this page comes from