Gtk2::I...Selector(3)
π Gtk2::I...Selector(3) π
okay bestie, pull up a chair, we're reading the manual for Gtk2::I...Selector(3) from the User Contributed Perl Documentation, and honestly? it's giving "I select rectangles and I'm not sorry about it" β¨
πΈ NAME πΈ
Gtk2::ImageView::Tool::Selector β the image tool for selecting rectangular regions. yes that's the whole job. she's a specialist π
𧬠HIERARCHY π§¬
Glib::Object
+----Gtk2::ImageView::Tool::Selector
π¦ INTERFACES π¦
Gtk2::ImageView::Tool
β¨ DESCRIPTION β¨
Gtk2::ImageView::Tool::Selector is a tool for selecting areas of an image. super useful for cropping an image, for example. she's an implementor of the Gtk2::ImageView::Tool interface, which basically means she's plug-and-play β you can slot her into a Gtk2::ImageView using the Gtk2::ImageView::Tool::set_tool() method. no cap π«Ά
Gtk2::ImageView::Tool::Selector changes the default display of the Gtk2::ImageView. she darkens down the unselected region of the image, which is a gorgeous effect and makes it way clearer what part of the image is currently selected. unfortunately, this effect is somewhat incompatible with how Gtk2::ImageView::Nav behaves, because that widget will show the image without darkening it. π the vibes do NOT match.
The tool also changes the default behaviour of the mouse. When a Gtk2::ImageView::Tool::Selector is set on a Gtk2::ImageView, mouse presses do not "grab" the image, and you cannot scroll by dragging. instead, mouse presses and dragging are used to resize and move the selection rectangle. and when the mouse drags the selection rectangle all the way to the border of the widget, the view autoscrolls, which is a super convenient way for a user to position the selection. main character autoscroll energy fr fr π
Please note that Gtk2::ImageView::Tool::Selector draws the image in two layers. One darkened, and the selection rectangle in normal luminosity. Because it uses two draw operations instead of one like Gtk2::ImageView::Tool::Dragger does, it is significantly slower than that tool. So it genuinely makes sense for a user of this library to set the interpolation to GDK_INTERP_NEAREST when using this tool, to ensure that performance is acceptable to the users of the program. bestie, do it for the people π
π Zoom bug π
There's a small bug in Gtk2::ImageView::Tool::Selector that becomes apparent when the zoom factor is greater than about 30. In that case, the edge of the selection rectangle may intersect a pixel. rude of it, honestly π
The bug is caused by bug 389832 in gdk-pixbuf. There is no way to solve this bug on Gtk2::ImageView's level (but if someone knows how, I'd really like to know). if that's you, pls speak up π
π METHODS π
tool = Gtk2::ImageView::Tool::Selector->new ($view)
$view(Gtk2::ImageView)
Returns a new selector tool for the specified view, with the following default values:
selection : (0, 0) - [0, 0]
rectangle = $selector->get_selection
Returns a Gtk2::Gdk::Rectangle with the current selection. If either the width or the height of the selection is zero, then nothing is selected and undef is returned. See "selection-changed" for an example. π
$selector->set_selection ($rect)
$rect(Gtk2::Gdk::Rectangle)
Sets the selection rectangle for the tool. Setting this attribute will cause the widget to immidiately repaint itself if its view is realized. iconic behaviour, honestly β¨
This method does nothing under the following circumstances:
- If the views pixbuf is
undef. - If
rectis wider or taller than the size of the pixbuf. - If
rectequals the current selection rectangle.
If the selection falls outside the pixbufs area, its position is moved so that it is within the pixbuf.
Calling this method causes the ::selection-changed signal to be emitted. π£
The default selection is (0,0) - [0,0].
selector: aGtk2::ImageView::Tool::Selectorrect: Selection rectangle in image space coordinates.
π PROPERTIES π
'view'(Gtk2::ImageView: defaultundef: writable / construct-only) β Image View to navigate π§
π SIGNALS π
selection-changed(Gtk2::ImageView::Tool::Selector)
π SEE ALSO π
Gtk2::ImageView, Glib::Object
π COPYRIGHT π
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, bestie β this was Gtk2::I...Selector(3), perl v5.42.0, dated 2025-07-25, brought to you by User Contributed Perl Documentation. go select a rectangle, you've earned it πππΈ
π¦ where this page comes from
- fedora 43: perl-Gtk2-ImageView 0.05-35.fc43 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms