|Portability||portable (depends on GHC)|
- data ImageToolSelector
- class GObjectClass o => ImageToolSelectorClass o
- imageToolSelectorNew :: ImageViewClass view => view -> IO ImageToolSelector
- imageToolSelectorGetSelection :: ImageToolSelectorClass selector => selector -> IO Rectangle
- imageToolSelectorSetSelection :: ImageToolSelectorClass selector => selector -> Rectangle -> IO ()
- selectionChanged :: ImageToolSelectorClass selector => Signal selector (IO ())
ImageToolSelector is a tool for selecting areas of an image. It is useful for cropping an image,
for example. The tool is an implementor of the
IImageTool inteface which means that it can be
plugged into a
ImageView by using the
ImageToolSelector changes the default display of the
ImageView. It darkens down the unselected
region of the image which provides a nice effect and makes it clearer what part of the image that is
currently selected. Unfortunately, this effect is somewhat incompatible with how
because that widget will show the image without darkening it.
The tool also changes the default behaviour of the mouse. When a
ImageToolSelector is set on a
ImageView, mouse presses do not grab the image and you cannot scroll by dragging. Instead mouse
presses and dragging is used to resize and move the selection rectangle. When the mouse drags the
selection rectangle to the border of the widget, the view autoscrolls which is a convenient way for
a user to position the selection.
Please note that
ImageToolSelector draws the image in two layers. One darkened and the selection
rectangle in normal luminosity. Because it uses two draw operations instead one one like
ImageToolDragger does, it is significantly slower than that tool. Therefore, it makes sense for a
user of this library to set the interpolation to
InterpNearest when using this tool to ensure
that performance is acceptable to the users of the program.
Creates a new selector tool for the specified view with default values. The default values are:
- selection : (0, 0) - [0, 0]
Fills in rect with the current selection rectangle. If either the width or the height of rect is
zero, then nothing is selected and the selection should be considered inactive. See
selectionChanged for an example.
Sets the selection rectangle for the tool. Setting this attribute will cause the widget to immediately repaint itself if its view is realized.
This method does nothing under the following circumstances:
- If the views pixbuf is
Nothing. * 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
selectionChanged signal to be emitted.
The default selection is (0,0) - [0,0].