1Gtk2::ImageView::Tool::USseelrecCtoonrt(r3i)buted Perl DGotcku2m:e:nItmaatgieoVniew::Tool::Selector(3)
2
3
4

NAME

6       Gtk2::ImageView::Tool::Selector -  Image tool for selecting rectangular
7       regions
8

HIERARCHY

10         Glib::Object
11         +----Gtk2::ImageView::Tool::Selector
12

INTERFACES

14         Gtk2::ImageView::Tool
15

DESCRIPTION

17       Gtk2::ImageView::Tool::Selector is a tool for selecting areas of an
18       image. It is useful for cropping an image, for example. The tool is an
19       implementor of the Gtk2::ImageView::Tool inteface which means that it
20       can be plugged into a Gtk2::ImageView by using the
21       Gtk2::ImageView::Tool::set_tool() method.
22
23       Gtk2::ImageView::Tool::Selector changes the default display of the
24       Gtk2::ImageView. It darkens down the unselected region of the image
25       which provides a nice effect and makes it clearer what part of the
26       image that is currently selected. Unfortunately, this effect is
27       somewhat incompatible with how Gtk2::ImageView::Nav behaves because
28       that widget will show the image without darkening it.
29
30       The tool also changes the default behaviour of the mouse. When a
31       Gtk2::ImageView::Tool::Selector is set on a Gtk2::ImageView, mouse
32       presses do not "grab" the image and you cannot scroll by dragging.
33       Instead mouse presses and dragging is used to resize and move the
34       selection rectangle. When the mouse drags the selection rectangle to
35       the border of the widget, the view autoscrolls which is a convenient
36       way for a user to position the selection.
37
38       Please note that Gtk2::ImageView::Tool::Selector draws the image in two
39       layers.  One darkened and the selection rectangle in normal luminosity.
40       Because it uses two draw operations instead one one like
41       Gtk2::ImageView::Tool::Dragger does, it is significantly slower than
42       that tool. Therefore, it makes sense for a user of this library to set
43       the interpolation to GDK_INTERP_NEAREST when using this tool to ensure
44       that performance is acceptable to the users of the program.
45
46   Zoom bug
47       There is a small bug in Gtk2::ImageView::Tool::Selector that becomes
48       apparent when the zoom factor is greater than about 30. The edge of the
49       selection rectangle may in that case intersect a pixel.
50
51       The bug is caused by bug 389832 in gdk-pixbuf. There is no way to solve
52       this bug on Gtk2::ImageView's level (but if someone knows how, I'd
53       really like to know).
54

METHODS

56   tool = Gtk2::ImageView::Tool::Selector->new ($view)
57       •   $view (Gtk2::ImageView)
58
59       Returns a new selector tool for the specified view with the following
60       default values:
61
62       selection : (0, 0) - [0, 0]
63
64   rectangle = $selector->get_selection
65       Returns a Gtk2::Gdk::Rectangle with the current selection. If either
66       the width or the height of the selection is zero, then nothing is
67       selected and undef is returned. See "selection-changed" for an example.
68
69   $selector->set_selection ($rect)
70       •   $rect (Gtk2::Gdk::Rectangle)
71
72       Sets the selection rectangle for the tool. Setting this attribute will
73       cause the widget to immidiately repaint itself if its view is realized.
74
75       This method does nothing under the following circumstances:
76
77       If the views pixbuf is undef.
78       If rect is wider or taller than the size of the pixbuf
79       If rect equals the current selection rectangle.
80
81       If the selection falls outside the pixbufs area, its position is moved
82       so that it is within the pixbuf.
83
84       Calling this method causes the ::selection-changed signal to be
85       emitted.
86
87       The default selection is (0,0) - [0,0].
88
89       selector : a Gtk2::ImageView::Tool::Selector
90       rect : Selection rectangle in image space coordinates.
91

PROPERTIES

93       'view' (Gtk2::ImageView : default undef : writable / construct-only)
94           Image View to navigate
95

SIGNALS

97       selection-changed (Gtk2::ImageView::Tool::Selector)
98

SEE ALSO

100       Gtk2::ImageView, Glib::Object
101
103       Copyright (C) 2007 by Jeffrey Ratcliffe.
104
105       This software is licensed under the GPL-3; see Gtk2::ImageView for a
106       full notice.
107
108
109
110perl v5.34.0                      2021-07-22Gtk2::ImageView::Tool::Selector(3)
Impressum