Gtk2::ImageView (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Gtk2::ImageView - General purpose image viewer for Gtk+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 forThe Gtk2::ImageView module allows a perl developer to use the GtkImageView Widget.
HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::ImageView
INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable
METHODS
widget or undef = Gtk2::ImageView->new
Returns a new Gtk2::ImageView with the following default values.- 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
boolean = $view->get_black_bg
Returns$view->set_black_bg ($black_bg)
- *
- $black_bg (boolean)
If
The default value is
list = $view->get_check_colors
Reads the two colors used to draw transparent parts of images with an alpha channel. Note that if the transp setting of the view is$view->damage_pixels ($rect)
- *
- $rect (Gtk2::Gdk::Rectangle)
Mark the pixels in the rectangle as damaged. That the pixels are damaged means that they have been modified and that the view must redraw them to ensure that the visible part of the image corresponds to the pixels in that image. Calling this method emits the ::pixbuf-changed signal.
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
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.
rectangle = $view->get_draw_rect
Get the rectangle in the widget where the pixbuf is painted, or undef if the view is not allocated or has no pixbuf.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.
boolean = $view->get_fitting
Returns$view->set_fitting ($fitting)
- *
- $fitting (boolean)
Sets whether to fit or not. If
Setting the fitting causes the widget to immediately repaint itself.
Fitting is by default
- view : a Gtk2::ImageView
- fitting : whether to fit the image or not
rectangle = $view->image_to_widget_rect ($rect_in)
- *
- $rect_in (Gtk2::Gdk::Rectangle)
Converts a rectangle in image space coordinates to widget space coordinates. If the view is not realized, or if it contains no pixbuf, then the conversion was unsuccessful,
Note that this function may return a rectangle that is not visible on the widget.
interptype = $view->get_interpolation
Returns the current interpolation mode of the view.$view->set_interpolation ($interp)
- *
- $interp (Gtk2::Gdk::InterpType)
Sets the interpolation mode of how the view.
Setting the interpolation mode causes the widget to immidiately repaint itself.
The default interpolation mode is
- view : a Gtk2::ImageView
- interp : The Gtk2::Gdk::InterpType to use. One of GDK_INTERP_NEAREST, GDK_INTERP_BILINEARandGDK_INTERP_HYPER.
string = Gtk2::ImageView->library_version
Returns the version of the underlying GtkImageView C library$view->set_offset ($x, $y, $invalidate=FALSE)
- *
- $x (double)
- *
- $y (double)
- *
- $invalidate (boolean)
Sets the offset of where in the image the GtkImageView should begin displaying image data.
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
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
Normally, invalidate should always be
- 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.
pixbuf or undef = $view->get_pixbuf
Returns the pixbuf this view shows.$view->set_pixbuf ($pixbuf, $reset_fit=TRUE)
- *
- $pixbuf (Gtk2::Gdk::Pixbuf or undef)
- *
- $reset_fit (boolean)
Sets the pixbuf to display, or
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
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
The default pixbuf is
- view : a Gtk2::ImageView
- pixbuf : The pixbuf to display.
- reset_fit : Whether to reset fitting or not.
boolean = $view->get_show_cursor
Returns$view->set_show_cursor ($show_cursor)
- *
- $show_cursor (boolean)
Sets whether to show the mouse cursor when the mouse is over the widget or not. Hiding the cursor is useful when the widget is fullscreened.
The default value is
- view : a Gtk2::ImageView
- show_cursor : whether to show the cursor or not
boolean = $view->get_show_frame
Returns$view->set_show_frame ($show_frame)
- *
- $show_frame (boolean)
Sets whether to draw a frame around the image or not. When
The default value is
tool = $view->get_tool
Returns the currently bound image tool$view->set_tool ($tool)
- *
- $tool (Gtk2::ImageView::Tool)
Set the image tool to use. If the new tool is the same as the current tool, then nothing will be done. Otherwise Gtk2::ImageView::Tool::pixbuf_changed() is called so that the tool has a chance to generate initial data for the pixbuf.
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->set_transp ($transp, $transp_color=0x000000)
- *
- $transp (Gtk2::ImageView::Transp)
- *
- $transp_color (integer)
Sets how the view should draw transparent parts of images with an alpha channel. If transp is
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.
rectangle = $view->get_viewport
Returns a rectangle with the current viewport. If pixbuf isThe current viewport is defined as the rectangle, in zoomspace coordinates as the area of the loaded pixbuf the Gtk2::ImageView is currently showing.
double = $view->get_zoom
Get the current zoom factor of the view.$view->zoom_in
Zoom in the view one step. Calling this method causes the widget to immediately repaint itself.- view : a Gtk2::ImageView
$view->zoom_out
Zoom out the view one step. Calling this method causes the widget to immediately repaint itself.- view : a Gtk2::ImageView
$view->set_zoom ($zoom)
- *
- $zoom (double)
Sets the zoom of the view.
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
SIGNALS
- mouse-wheel-scroll (Gtk2::ImageView, Gtk2::Gdk::ScrollDirection)
- pixbuf-changed (Gtk2::ImageView)
- scroll (Gtk2::ImageView, Gtk2::ScrollType, Gtk2::ScrollType)
- set-fitting (Gtk2::ImageView, integer)
- set-scroll-adjustments (Gtk2::ImageView, Gtk2::Adjustment, Gtk2::Adjustment)
- set-zoom (Gtk2::ImageView, double)
- zoom-changed (Gtk2::ImageView)
- zoom-in (Gtk2::ImageView)
- zoom-out (Gtk2::ImageView)
ENUMS AND FLAGS
enum Gtk2::Gdk::InterpType
- *
-
'nearest' / 'GDK_INTERP_NEAREST'
- *
-
'tiles' / 'GDK_INTERP_TILES'
- *
-
'bilinear' / 'GDK_INTERP_BILINEAR'
- *
-
'hyper' / 'GDK_INTERP_HYPER'
enum Gtk2::Gdk::ScrollDirection
- *
-
'up' / 'GDK_SCROLL_UP'
- *
-
'down' / 'GDK_SCROLL_DOWN'
- *
-
'left' / 'GDK_SCROLL_LEFT'
- *
-
'right' / 'GDK_SCROLL_RIGHT'
enum Gtk2::ImageView::Transp
- *
-
'color' / 'GTK_IMAGE_TRANSP_COLOR'
- *
-
'background' / 'GTK_IMAGE_TRANSP_BACKGROUND'
- *
-
'grid' / 'GTK_IMAGE_TRANSP_GRID'
enum Gtk2::ScrollType
- *
-
'none' / 'GTK_SCROLL_NONE'
- *
-
'jump' / 'GTK_SCROLL_JUMP'
- *
-
'step-backward' / 'GTK_SCROLL_STEP_BACKWARD'
- *
-
'step-forward' / 'GTK_SCROLL_STEP_FORWARD'
- *
-
'page-backward' / 'GTK_SCROLL_PAGE_BACKWARD'
- *
-
'page-forward' / 'GTK_SCROLL_PAGE_FORWARD'
- *
-
'step-up' / 'GTK_SCROLL_STEP_UP'
- *
-
'step-down' / 'GTK_SCROLL_STEP_DOWN'
- *
-
'page-up' / 'GTK_SCROLL_PAGE_UP'
- *
-
'page-down' / 'GTK_SCROLL_PAGE_DOWN'
- *
-
'step-left' / 'GTK_SCROLL_STEP_LEFT'
- *
-
'step-right' / 'GTK_SCROLL_STEP_RIGHT'
- *
-
'page-left' / 'GTK_SCROLL_PAGE_LEFT'
- *
-
'page-right' / 'GTK_SCROLL_PAGE_RIGHT'
- *
-
'start' / 'GTK_SCROLL_START'
- *
-
'end' / 'GTK_SCROLL_END'
SEE ALSO
GtkImageView Reference Manual at trac.bjourne.webfactional.comperl(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
COPYRIGHT AND LICENSE
Copyright (c) 2007 --- 2008 by Jeffrey Ratcliffe <Jeffrey.Ratcliffe@gmail.com> seeThis library is free software; you can redistribute it and/or modify it under the terms of the
This library is distributed in the hope that it will be useful, but
You should have received a copy of the
COPYRIGHT
Copyright (C) 2007 by Jeffrey Ratcliffe.This software is licensed under the