The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Prima::ImageViewer - standard image, icon, and bitmap viewer class.

DESCRIPTION

The module contains Prima::ImageViewer class, which provides image displaying functionality, including different zoom levels.

Prima::ImageViewer is a descendant of Prima::ScrollWidget and inherits its document scrolling behavior and programming interface. See Prima::ScrollWidget for details.

API

Properties

alignment INTEGER

One of the following ta::XXX constants:

        ta::Left
        ta::Center 
        ta::Right

Selects the horizontal image alignment.

Default value: ta::Left

image OBJECT

Selects the image object to be displayed. OBJECT can be an instance of Prima::Image, Prima::Icon, or Prima::DeviceBitmap class.

imageFile FILE

Set the image FILE to be loaded and displayed. Is rarely used since does not return a loading success flag.

quality BOOLEAN

A boolean flag, selecting if the palette of image is to be copied into the widget palette, providing higher visual quality on paletted displays. See also "palette" in Prima::Widget.

Default value: 1

valignment INTEGER

One of the following ta::XXX constants:

        ta::Top
        ta::Middle or ta::Center
        ta::Bottom

Selects the vertical image alignment.

NB: ta::Middle value is not equal to ta::Center's, however the both constants produce equal effect here.

Default value: ta::Bottom

zoom FLOAT

Selects zoom level for image display. The acceptable value range is between 0.02 and 100. The zoom value is rounded to fiftieth and twentieth fractional values - .02, .04, .05, .06, .08, and 0.1 .

Default value: 1

Methods

screen2point X, Y, [ X, Y, ... ]

Performs translation of integer pairs integers as (X,Y)-points from widget coordinates to pixel offset in image coordinates. Takes in account zoom level, image alignments, and offsets. Returns array of same length as the input.

Useful for determining correspondence, for example, of a mouse event to a image point.

The reverse function is point2screen.

point2screen X, Y, [ X, Y, ... ]

Performs translation of integer pairs as (X,Y)-points from image pixel offset to widget image coordinates. Takes in account zoom level, image alignments, and offsets. Returns array of same length as the input.

Useful for determining a screen location of an image point.

The reverse function is screen2point.

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima, Prima::Image, Prima::ScrollWidget, examples/iv.pl.