1Gtk2::ImageView::Tool::USseelrecCtoonrt(r3i)buted Perl DGotcku2m:e:nItmaatgieoVniew::Tool::Selector(3)
2
3
4
6 Gtk2::ImageView::Tool::Selector - Image tool for selecting rectangular
7 regions
8
10 Glib::Object
11 +----Gtk2::ImageView::Tool::Selector
12
14 Gtk2::ImageView::Tool
15
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
56 tool = Gtk2::ImageView::Tool::Selector->new ($view)
57 · $view (Gtk2::ImageView)
58
59 Creates a new selector tool for the specified view with default
60 values. The default values are:
61
62 selection : (0, 0) - [0, 0]
63 view : a Gtk2::ImageView.
64
65 Returns
66
67 a new Gtk2::ImageView::Tool::Selector
68
69 rectangle = $selector->get_selection
70 Returns a Gtk2::Gdk::Rectangle with the current selection. If
71 either the width or the height of the selection is zero, then
72 nothing is selected and undef is returned. See "selection-changed"
73 for an example.
74
75 selector : a Gtk2::ImageView::Tool::Selector
76
77 Returns
78
79 a Gtk2::Gdk::Rectangle with the current selection.
80
81 $selector->set_selection ($rect)
82 · $rect (Gtk2::Gdk::Rectangle or undef)
83
84 Sets the selection rectangle for the tool. Setting this attribute
85 will cause the widget to immidiately repaint itself if its view is
86 realized.
87
88 This method does nothing under the following circumstances:
89
90 If the views pixbuf is NULL.
91 If rect is wider or taller than the size of the pixbuf
92 If rect equals the current selection rectangle.
93
94 If the selection falls outside the pixbufs area, its position is
95 moved so that it is within the pixbuf.
96
97 Calling this method causes the ::selection-changed signal to be
98 emitted.
99
100 The default selection is (0,0) - [0,0].
101
102 selector : a Gtk2::ImageView::Tool::Selector
103 rect : Selection rectangle in image space coordinates.
104
106 'view' (Gtk2::ImageView : writable / construct-only)
107 Image View to navigate
108
110 selection-changed (Gtk2::ImageView::Tool::Selector)
111
113 Gtk2::ImageView, Glib::Object
114
116 Copyright (C) 2007 by Jeffrey Ratcliffe.
117
118 This software is licensed under the GPL-3; see Gtk2::ImageView for a
119 full notice.
120
122 Hey! The above document had some coding errors, which are explained
123 below:
124
125 Around line 64:
126 You forgot a '=back' before '=head3'
127
128 Around line 73:
129 =back without =over
130
131 Around line 88:
132 You forgot a '=back' before '=head3'
133
134 Around line 97:
135 =back without =over
136
137
138
139perl v5.12.0 2010-05-02Gtk2::ImageView::Tool::Selector(3)