1Gtk2::ImageView(3)    User Contributed Perl Documentation   Gtk2::ImageView(3)
2
3
4

NAME

6       Gtk2::ImageView -  General purpose image viewer for Gtk+
7
8        use Gtk2::ImageView;
9        Gtk2->init;
10
11        $window = Gtk2::Window->new();
12
13        $view = Gtk2::ImageView->new;
14        $view->set_pixbuf($pixbuf, TRUE);
15        $window->add($view);
16
17        $window->show_all;
18

DESCRIPTION

20       GtkImageView is a full-featured general purpose image viewer widget for
21       GTK. It provides a scrollable, zoomable pane in which a pixbuf can be
22       displayed.
23
24       The Gtk2::ImageView module allows a perl developer to use the
25       GtkImageView Widget.
26

HIERARCHY

28         Glib::Object
29         +----Glib::InitiallyUnowned
30              +----Gtk2::Object
31                   +----Gtk2::Widget
32                        +----Gtk2::ImageView
33

INTERFACES

35         Glib::Object::_Unregistered::AtkImplementorIface
36         Gtk2::Buildable
37

METHODS

39   widget or undef = Gtk2::ImageView->new
40           Creates a new Gtk2::ImageView with default values. The default
41           values are:
42
43           black bg : FALSE
44           fitting : TRUE
45           image tool : a Gtk2::ImageView::Tool::Dragger instance
46           interpolation mode : GDK_INTERP_BILINEAR
47           offset : (0, 0)
48           pixbuf : NULL
49           show cursor: TRUE
50           show frame : TRUE
51           transp : GTK_IMAGE_TRANSP_GRID
52           zoom : 1.0
53
54       Returns
55
56       a new Gtk2::ImageView.
57
58   boolean = $view->get_black_bg
59           Returns whether the view renders the widget on a black background
60           or not.
61
62           view : a Gtk2::ImageView
63
64       Returns
65
66       TRUE if a black background is used, otherwise FALSE.
67
68   $view->set_black_bg ($black_bg)
69           ·   $black_bg (boolean)
70
71           If TRUE, the view uses a black background. If FALSE, the view uses
72           the default (normally gray) background.
73
74           The default value is FALSE.
75
76           view : a Gtk2::ImageView
77           black_bg : Whether to use a black background or not.
78
79   list = $view->get_check_colors
80           Reads the two colors used to draw transparent parts of images with
81           an alpha channel. Note that if the transp setting of the view is
82           GTK_IMAGE_TRANSP_BACKGROUND or GTK_IMAGE_TRANSP_COLOR, then both
83           colors will be equal.
84
85           view : a Gtk2::ImageView
86
87       Returns
88
89       check_color1 :      A pointer to an integer where the first check color
90       should be stored.
91       check_color2 :      A pointer to an integer wherer the second check
92       color should be stored.
93
94   $view->damage_pixels ($rect)
95           ·   $rect (Gtk2::Gdk::Rectangle)
96
97           Mark the pixels in the rectangle as damaged. That the pixels are
98           damaged means that they have been modified and that the view must
99           redraw them to ensure that the visible part of the image
100           corresponds to the pixels in that image. Calling this method emits
101           the ::pixbuf-changed signal.
102
103           This method must be used when modifying the image data:
104
105               // Drawing something cool in the area 20,20 - 60,60 here...
106               ...
107               // And force an update
108               $view->damage_pixels (Gtk2::Gdk::Rectangle->new(20, 20, 40, 40);
109
110           If the whole pixbuf has been modified then rect should be NULL to
111           indicate that a total update is needed.
112
113           See also gtk_image_view_set_pixbuf().
114
115           view : a Gtk2::ImageView
116           view : a Gtk2::Gdk::Rectangle in image space coordinates to mark as
117           damaged or NULL, to mark the whole pixbuf as damaged.
118
119   rectangle = $view->get_draw_rect
120           Get the rectangle in the widget where the pixbuf is painted.
121
122           For example, if the widgets allocated size is 100, 100 and the
123           pixbufs size is 50, 50 and the zoom factor is 1.0, then the pixbuf
124           will be drawn centered on the widget. rect will then be
125           (25,25)-[50,50].
126
127           This method is useful when converting from widget to image or zoom
128           space coordinates.
129
130           view : a Gtk2::ImageView
131
132
133       Returns
134
135       a Gtk2::Gdk::Rectangle with the area of the widget in which the pixbuf
136       is drawn, or undef if the view is not allocated or has no pixbuf.
137
138   boolean = $view->get_fitting
139           Returns the fitting setting of the view.
140
141           view : a Gtk2::ImageView
142
143       Returns
144
145       TRUE if the view is fitting the image, FALSE otherwise.
146
147   $view->set_fitting ($fitting)
148           ·   $fitting (boolean)
149
150           Sets whether to fit or not. If TRUE, then the view will adapt the
151           zoom so that the whole pixbuf is visible.
152
153           Setting the fitting causes the widget to immediately repaint
154           itself.
155
156           Fitting is by default TRUE.
157
158           view : a Gtk2::ImageView
159           fitting : whether to fit the image or not
160
161   rectangle = $view->image_to_widget_rect ($rect_in)
162           ·   $rect_in (Gtk2::Gdk::Rectangle)
163
164           Converts a rectangle in image space coordinates to widget space
165           coordinates.  If the view is not realized, or if it contains no
166           pixbuf, then the conversion was unsuccessful, FALSE is returned and
167           rect_out is left unmodified.
168
169           Note that this function may return a rectangle that is not visible
170           on the widget.
171
172           view : a Gtk2::ImageView
173           rect_in : Gtk2::Gdk::Rectangle in image space coordinates to
174           convert
175
176       Returns
177
178       rect_out : Gtk2::Gdk::Rectangle with the widget space coordinates or
179       undef
180
181   interptype = $view->get_interpolation
182           Returns the current interpolation mode of the view.
183
184           view : a Gtk2::ImageView
185
186       Returns
187
188       the Gtk2::Gdk::InterpType
189
190   $view->set_interpolation ($interp)
191           ·   $interp (Gtk2::Gdk::InterpType)
192
193           Sets the interpolation mode of how the view. GDK_INTERP_HYPER is
194           the slowest, but produces the best results. GDK_INTERP_NEAREST is
195           the fastest, but provides bad rendering quality.
196           GDK_INTERP_BILINEAR is a good compromise.
197
198           Setting the interpolation mode causes the widget to immidiately
199           repaint itself.
200
201           The default interpolation mode is GDK_INTERP_BILINEAR.
202
203           view : a Gtk2::ImageView
204           interp : The Gtk2::Gdk::InterpType to use. One of
205           GDK_INTERP_NEAREST, GDK_INTERP_BILINEAR and GDK_INTERP_HYPER.
206
207   string = Gtk2::ImageView->library_version
208           Returns the version of the underlying GtkImageView C library
209
210   $view->set_offset ($x, $y, $invalidate=FALSE)
211           ·   $x (double)
212
213           ·   $y (double)
214
215           ·   $invalidate (boolean)
216
217           Sets the offset of where in the image the GtkImageView should begin
218           displaying image data.
219
220           The offset is clamped so that it will never cause the GtkImageView
221           to display pixels outside the pixbuf. Setting this attribute causes
222           the widget to repaint itself if it is realized.
223
224           If invalidate is TRUE, the views entire area will be invalidated
225           instead of redrawn immidiately. The view is then queued for redraw,
226           which means that additional operations can be performed on it
227           before it is redrawn.
228
229           The difference can sometimes be important like when you are
230           overlaying data and get flicker or artifacts when setting the
231           offset. If that happens, setting invalidate to TRUE could fix the
232           problem. See the source code to GtkImageToolSelector for an
233           example.
234
235           Normally, invalidate should always be FALSE because it is much
236           faster to repaint immidately than invalidating.
237
238           view : a Gtk2::ImageView
239           x : X-component of the offset in zoom space coordinates.
240           y : Y-component of the offset in zoom space coordinates.
241           invalidate : whether to invalidate the view or redraw immediately,
242           default=FALSE.
243
244   pixbuf or undef = $view->get_pixbuf
245           Returns the pixbuf this view shows.
246
247           view : a Gtk2::ImageView
248
249       Returns
250
251       The pixbuf this view shows.
252
253   $view->set_pixbuf ($pixbuf, $reset_fit=TRUE)
254           ·   $pixbuf (Gtk2::Gdk::Pixbuf or undef)
255
256           ·   $reset_fit (boolean)
257
258           Sets the pixbuf to display, or NULL to not display any pixbuf.
259           Normally, reset_fit should be TRUE which enables fitting. Which
260           means that, initially, the whole pixbuf will be shown.
261
262           Sometimes, the fit mode should not be reset. For example, if
263           GtkImageView is showing an animation, it would be bad to reset the
264           fit mode for each new frame. The parameter should then be FALSE
265           which leaves the fit mode of the view untouched.
266
267           This method should not be used if merely the contents of the pixbuf
268           has changed. See gtk_image_view_damage_pixels() for that.
269
270           If reset_fit is TRUE, the zoom-changed signal is emitted, otherwise
271           not. The pixbuf-changed signal is also emitted.
272
273           The default pixbuf is NULL.
274
275           view : a Gtk2::ImageView
276           pixbuf : The pixbuf to display.
277           reset_fit : Whether to reset fitting or not.
278
279   boolean = $view->get_show_cursor
280           Returns whether to show the mouse cursor when the mouse is over the
281           widget or not.
282
283           view : a Gtk2::ImageView
284
285       Returns
286
287       TRUE if the cursor is shown, otherwise FALSE.
288
289   $view->set_show_cursor ($show_cursor)
290           ·   $show_cursor (boolean)
291
292           Sets whether to show the mouse cursor when the mouse is over the
293           widget or not. Hiding the cursor is useful when the widget is
294           fullscreened.
295
296           The default value is TRUE.
297
298           view : a Gtk2::ImageView
299           show_cursor : whether to show the cursor or not
300
301   boolean = $view->get_show_frame
302           Returns whether a one pixel frame is drawn around the pixbuf or
303           not.
304
305           view : a Gtk2::ImageView
306
307       Returns
308
309       TRUE if a frame is drawn around the pixbuf, otherwise FALSE.
310
311   $view->set_show_frame ($show_frame)
312           ·   $show_frame (boolean)
313
314           Sets whether to draw a frame around the image or not. When TRUE, a
315           one pixel wide frame is shown around the image. Setting this
316           attribute causes the widget to immediately repaint itself.
317
318           The default value is TRUE.
319
320           view : a Gtk2::ImageView
321           show_frame : whether to show a frame around the pixbuf or not
322
323   tool = $view->get_tool
324           view : a Gtk2::ImageView
325
326       Returns
327
328       The currently bound image tool
329
330   $view->set_tool ($tool)
331           ·   $tool (Gtk2::ImageView::Tool)
332
333           Set the image tool to use. If the new tool is the same as the
334           current tool, then nothing will be done. Otherwise
335           Gtk2::ImageView::Tool::pixbuf_changed() is called so that the tool
336           has a chance to generate initial data for the pixbuf.
337
338           Setting the tool causes the widget to immediately repaint itself.
339
340           The default image tool is a Gtk2::ImageView::Tool::Dragger
341           instance. See also Gtk2::ImageView::Tool.
342
343           view : a Gtk2::ImageView
344           tool : The image tool to use (must not be NULL)
345
346   $view->set_transp ($transp, $transp_color=0x000000)
347           ·   $transp (Gtk2::ImageView::Transp)
348
349           ·   $transp_color (integer)
350
351           Sets how the view should draw transparent parts of images with an
352           alpha channel. If transp is GTK_IMAGE_TRANSP_COLOR, the specified
353           color will be used. Otherwise the transp_color argument is ignored.
354           If it is GTK_IMAGE_TRANSP_BACKGROUND, the background color of the
355           widget will be used. If it is GTK_IMAGE_TRANSP_GRID, then a grid
356           with light and dark gray boxes will be drawn on the transparent
357           parts.
358
359           Calling this method causes the widget to immediately repaint. It
360           also causes the pixbuf-changed signal to be emitted. This is done
361           so that other widgets (such as GtkImageNav) will have a chance to
362           render a view of the pixbuf with the new transparency settings.
363
364           view : a Gtk2::ImageView
365           transp : The Gtk2::ImageView::Transp to use when drawing
366           transparent images, default GTK_IMAGE_TRANSP_GRID.
367           transp_color : Color to use when drawing transparent images,
368           default 0x000000.
369
370   rectangle = $view->get_viewport
371           Returns a rectangle with the current viewport. If pixbuf is NULL,
372           there is no viewport, undef is returned.
373
374           The current viewport is defined as the rectangle, in zoomspace
375           coordinates as the area of the loaded pixbuf the Gtk2::ImageView is
376           currently showing.
377
378           view : a Gtk2::ImageView
379
380       Returns
381
382       rect : a Gtk2::Gdk::Rectangle with the current viewport or NULL.
383
384   double = $view->get_zoom
385           Get the current zoom factor of the view.
386
387           view : a Gtk2::ImageView
388
389       Returns
390
391       the current zoom factor
392
393   $view->zoom_in
394           Zoom in the view one step. Calling this method causes the widget to
395           immediately repaint itself.
396
397           view : a Gtk2::ImageView
398
399   $view->zoom_out
400           Zoom out the view one step. Calling this method causes the widget
401           to immediately repaint itself.
402
403           view : a Gtk2::ImageView
404
405   $view->set_zoom ($zoom)
406           ·   $zoom (double)
407
408           Sets the zoom of the view.
409
410           Fitting is always disabled after this method has run. The zoom-
411           changed signal is unconditionally emitted.
412
413           view : a Gtk2::ImageView
414           zoom : the new zoom factor
415

SIGNALS

417       set-zoom (Gtk2::ImageView, double)
418       zoom-in (Gtk2::ImageView)
419       zoom-out (Gtk2::ImageView)
420       set-fitting (Gtk2::ImageView, integer)
421       scroll (Gtk2::ImageView, Gtk2::ScrollType, Gtk2::ScrollType)
422       mouse-wheel-scroll (Gtk2::ImageView, Gtk2::Gdk::ScrollDirection)
423       zoom-changed (Gtk2::ImageView)
424       pixbuf-changed (Gtk2::ImageView)
425       set-scroll-adjustments (Gtk2::ImageView, Gtk2::Adjustment,
426       Gtk2::Adjustment)
427

ENUMS AND FLAGS

429   enum Gtk2::Gdk::InterpType
430       ·   'nearest' / 'GDK_INTERP_NEAREST'
431
432       ·   'tiles' / 'GDK_INTERP_TILES'
433
434       ·   'bilinear' / 'GDK_INTERP_BILINEAR'
435
436       ·   'hyper' / 'GDK_INTERP_HYPER'
437
438   enum Gtk2::Gdk::ScrollDirection
439       ·   'up' / 'GDK_SCROLL_UP'
440
441       ·   'down' / 'GDK_SCROLL_DOWN'
442
443       ·   'left' / 'GDK_SCROLL_LEFT'
444
445       ·   'right' / 'GDK_SCROLL_RIGHT'
446
447   enum Gtk2::ImageView::Transp
448       ·   'color' / 'GTK_IMAGE_TRANSP_COLOR'
449
450       ·   'background' / 'GTK_IMAGE_TRANSP_BACKGROUND'
451
452       ·   'grid' / 'GTK_IMAGE_TRANSP_GRID'
453
454   enum Gtk2::ScrollType
455       ·   'none' / 'GTK_SCROLL_NONE'
456
457       ·   'jump' / 'GTK_SCROLL_JUMP'
458
459       ·   'step-backward' / 'GTK_SCROLL_STEP_BACKWARD'
460
461       ·   'step-forward' / 'GTK_SCROLL_STEP_FORWARD'
462
463       ·   'page-backward' / 'GTK_SCROLL_PAGE_BACKWARD'
464
465       ·   'page-forward' / 'GTK_SCROLL_PAGE_FORWARD'
466
467       ·   'step-up' / 'GTK_SCROLL_STEP_UP'
468
469       ·   'step-down' / 'GTK_SCROLL_STEP_DOWN'
470
471       ·   'page-up' / 'GTK_SCROLL_PAGE_UP'
472
473       ·   'page-down' / 'GTK_SCROLL_PAGE_DOWN'
474
475       ·   'step-left' / 'GTK_SCROLL_STEP_LEFT'
476
477       ·   'step-right' / 'GTK_SCROLL_STEP_RIGHT'
478
479       ·   'page-left' / 'GTK_SCROLL_PAGE_LEFT'
480
481       ·   'page-right' / 'GTK_SCROLL_PAGE_RIGHT'
482
483       ·   'start' / 'GTK_SCROLL_START'
484
485       ·   'end' / 'GTK_SCROLL_END'
486

SEE ALSO

488       GtkImageView Reference Manual at http://trac.bjourne.webfactional.com/
489
490       perl(1), Glib(3pm), Gtk2(3pm), Gtk2::ImageViewer - an alternative image
491       viewer widget.
492

AUTHOR

494       Jeffrey Ratcliffe <Jeffrey dot Ratcliffe at gmail dot com>, with
495       patches from muppet <scott at asofyet dot org>, Torsten Schoenfeld
496       <kaffetisch at web dot de> and Emanuele Bassi <ebassi at gmail dot com>
497
498       The DESCRIPTION section of this page is adapted from the documentation
499       of GtkImageView.
500
502       Copyright (c) 2007 -- 2008 by Jeffrey Ratcliffe
503       <Jeffrey.Ratcliffe@gmail.com> see AUTHORS for complete list of
504       contributors
505
506       This library is free software; you can redistribute it and/or modify it
507       under the terms of the GNU Lesser General Public License as published
508       by the Free Software Foundation; either version 3 of the License, or
509       (at your option) any later version.
510
511       This library is distributed in the hope that it will be useful, but
512       WITHOUT ANY WARRANTY; without even the implied warranty of
513       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
514       Library General Public License for more details.
515
516       You should have received a copy of the GNU Lesser General Public
517       License along with this program.  If not, see
518       <http://www.gnu.org/licenses/>.
519

POD ERRORS

521       Hey! The above document had some coding errors, which are explained
522       below:
523
524       Around line 86:
525           You forgot a '=back' before '=head3'
526
527       Around line 95:
528           =back without =over
529
530       Around line 110:
531           You forgot a '=back' before '=head3'
532
533       Around line 119:
534           =back without =over
535
536       Around line 160:
537           You forgot a '=back' before '=head3'
538
539       Around line 171:
540           =back without =over
541
542       Around line 231:
543           You forgot a '=back' before '=head3'
544
545       Around line 240:
546           =back without =over
547
548       Around line 255:
549           You forgot a '=back' before '=head3'
550
551       Around line 264:
552           =back without =over
553
554       Around line 320:
555           You forgot a '=back' before '=head3'
556
557       Around line 329:
558           =back without =over
559
560       Around line 344:
561           You forgot a '=back' before '=head3'
562
563       Around line 353:
564           =back without =over
565
566       Around line 446:
567           You forgot a '=back' before '=head3'
568
569       Around line 455:
570           =back without =over
571
572       Around line 506:
573           You forgot a '=back' before '=head3'
574
575       Around line 515:
576           =back without =over
577
578       Around line 556:
579           You forgot a '=back' before '=head3'
580
581       Around line 565:
582           =back without =over
583
584       Around line 604:
585           You forgot a '=back' before '=head3'
586
587       Around line 613:
588           =back without =over
589
590       Around line 688:
591           You forgot a '=back' before '=head3'
592
593       Around line 697:
594           =back without =over
595
596       Around line 712:
597           You forgot a '=back' before '=head3'
598
599       Around line 721:
600           =back without =over
601
602       Around line 938:
603           =cut found outside a pod block.  Skipping to next block.
604
605
606
607perl v5.12.0                      2010-05-02                Gtk2::ImageView(3)
Impressum