gtkimageview-0.11.1: Binding to the GtkImageView library.

Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net

Graphics.UI.Gtk.ImageView.ImageToolSelector

Contents

Description

 

Synopsis

Details

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 imageViewSetTool method.

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 ImageNav behaves 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.

Types

Methods

imageToolSelectorNew :: ImageViewClass view => view -> IO ImageToolSelectorSource

Creates a new selector tool for the specified view with default values. The default values are:

  • selection : (0, 0) - [0, 0]

imageToolSelectorGetSelection :: ImageToolSelectorClass selector => selector -> IO RectangleSource

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.

imageToolSelectorSetSelection :: ImageToolSelectorClass selector => selector -> Rectangle -> IO ()Source

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].

Signals

selectionChanged :: ImageToolSelectorClass selector => Signal selector (IO ())Source

The selectionChanged signal is emitted when the selection rectangle on the selector is moved or resized. It is inteded to be used by applications that wants to print status information.