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

SYNOPSIS

 use Gtk2::ImageView;
 Gtk2->init;

 $window = Gtk2::Window->new();

 $view = Gtk2::ImageView->new;
 $view->set_pixbuf($pixbuf, TRUE);
 $window->add($view);

 $window->show_all;

DESCRIPTION

GtkImageView is a full-featured general purpose image viewer widget for GTK. It provides a scrollable, zoomable pane in which a pixbuf can be displayed.

The Gtk2::ImageView module allows a perl developer to use the GtkImageView Widget.

SEE ALSO

GtkImageView Reference Manual at http://trac.bjourne.webfactional.com/

perl(1), Glib(3pm), Gtk2(3pm), Gtk2::ImageViewer - an alternative image viewer widget.

AUTHOR

Jeffrey Ratcliffe <Jeffrey dot Ratcliffe at gmail dot com>, with patches from muppet <scott at asofyet dot org>, Torsten Schoenfeld <kaffetisch at web dot de> and Emanuele Bassi <ebassi at gmail dot com> Kevin Ryde <user42 at zip.com.au>

The DESCRIPTION section of this page is adapted from the documentation of GtkImageView.

COPYRIGHT AND LICENSE

Copyright (c) 2007 -- 2008 by Jeffrey Ratcliffe <Jeffrey.Ratcliffe@gmail.com> see AUTHORS for complete list of contributors

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

black bg : FALSE
fitting : TRUE
image tool : a Gtk2::ImageView::Tool::Dragger instance
interpolation mode : GDK_INTERP_BILINEAR
offset : (0, 0)
pixbuf : NULL
show cursor: TRUE
show frame : TRUE
transp : GTK_IMAGE_TRANSP_GRID
zoom : 1.0

The current viewport is defined as the rectangle, in zoomspace coordinates as the area of the loaded pixbuf the Gtk2::ImageView is currently showing.

For example, if the widgets allocated size is 100, 100 and the pixbufs size is 50, 50 and the zoom factor is 1.0, then the pixbuf will be drawn centered on the widget. rect will then be (25,25)-[50,50].

This method is useful when converting from widget to image or zoom space coordinates.

Note that this function may return a rectangle that is not visible on the widget.

The offset is clamped so that it will never cause the GtkImageView to display pixels outside the pixbuf. Setting this attribute causes the widget to repaint itself if it is realized.

If invalidate is TRUE, the views entire area will be invalidated instead of redrawn immidiately. The view is then queued for redraw, which means that additional operations can be performed on it before it is redrawn.

The difference can sometimes be important like when you are overlaying data and get flicker or artifacts when setting the offset. If that happens, setting invalidate to TRUE could fix the problem. See the source code to GtkImageToolSelector for an example.

Normally, invalidate should always be FALSE because it is much faster to repaint immidately than invalidating.

view : a Gtk2::ImageView
x : X-component of the offset in zoom space coordinates.
y : Y-component of the offset in zoom space coordinates.
invalidate : whether to invalidate the view or redraw immediately, default=FALSE.

Calling this method causes the widget to immediately repaint. It also causes the pixbuf-changed signal to be emitted. This is done so that other widgets (such as GtkImageNav) will have a chance to render a view of the pixbuf with the new transparency settings.

view : a Gtk2::ImageView
transp : The Gtk2::ImageView::Transp to use when drawing transparent images, default GTK_IMAGE_TRANSP_GRID.
transp_color : Color to use when drawing transparent images, default 0x000000.

Setting the fitting causes the widget to immediately repaint itself.

Fitting is by default TRUE.

view : a Gtk2::ImageView
fitting : whether to fit the image or not

Sometimes, the fit mode should not be reset. For example, if GtkImageView is showing an animation, it would be bad to reset the fit mode for each new frame. The parameter should then be FALSE which leaves the fit mode of the view untouched.

This method should not be used if merely the contents of the pixbuf has changed. See gtk_image_view_damage_pixels() for that.

If reset_fit is TRUE, the zoom-changed signal is emitted, otherwise not. The pixbuf-changed signal is also emitted.

The default pixbuf is NULL.

view : a Gtk2::ImageView
pixbuf : The pixbuf to display.
reset_fit : Whether to reset fitting or not.

Fitting is always disabled after this method has run. The zoom-changed signal is unconditionally emitted.

view : a Gtk2::ImageView
zoom : the new zoom factor

The default value is FALSE.

The default value is TRUE.

Setting the interpolation mode causes the widget to immidiately repaint itself.

The default interpolation mode is GDK_INTERP_BILINEAR.

view : a Gtk2::ImageView
interp : The Gtk2::Gdk::InterpType to use. One of GDK_INTERP_NEAREST, GDK_INTERP_BILINEAR and GDK_INTERP_HYPER.

The default value is TRUE.

view : a Gtk2::ImageView
show_cursor : whether to show the cursor or not

Setting the tool causes the widget to immediately repaint itself.

The default image tool is a Gtk2::ImageView::Tool::Dragger instance. See also Gtk2::ImageView::Tool.

view : a Gtk2::ImageView
tool : The image tool to use (must not be NULL)
view : a Gtk2::ImageView
view : a Gtk2::ImageView

This method must be used when modifying the image data:

    // Drawing something cool in the area 20,20 - 60,60 here...
    ...
    // And force an update
    $view->damage_pixels (Gtk2::Gdk::Rectangle->new(20, 20, 40, 40);

If the whole pixbuf has been modified then rect should be NULL to indicate that a total update is needed.

See also gtk_image_view_set_pixbuf().

view : a Gtk2::ImageView
view : a Gtk2::Gdk::Rectangle in image space coordinates to mark as damaged or NULL, to mark the whole pixbuf as damaged.

Returns the version of the underlying GtkImageView C library