Gtk2::I...Selector(3)

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

πŸ’– 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 rect is wider or taller than the size of the pixbuf.
  • If rect equals 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 : a Gtk2::ImageView::Tool::Selector
  • rect : Selection rectangle in image space coordinates.

πŸ’Ž PROPERTIES πŸ’Ž

  • 'view' (Gtk2::ImageView : default undef : writable / construct-only) β€” Image View to navigate 🧭

πŸ”” SIGNALS πŸ””

  • selection-changed (Gtk2::ImageView::Tool::Selector)

πŸ‘€ SEE ALSO πŸ‘€

Gtk2::ImageView, Glib::Object


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