1Prima::ImageDialog(3) User Contributed Perl DocumentationPrima::ImageDialog(3)
2
3
4
6 Prima::ImageDialog - file open and save dialogs.
7
9 The module provides dialogs specially adjusted for image loading and
10 saving.
11
13 Provides a preview feature, allowing the user to view the image file
14 before loading, and the selection of a frame index for the multi-framed
15 image files. Instead of "execute" call, the load method is used to
16 invoke the dialog and returns the loaded image as a "Prima::Image"
17 object. The loaded object by default contains "{extras}" hash variable
18 set, which contains extra information returned by the loader. See
19 Prima::image-load for more information.
20
21 SYNOPSIS
22 my $dlg = Prima::ImageOpenDialog-> create;
23 my $img = $dlg-> load;
24 return unless $img;
25 print "$_:$img->{extras}->{$_}\n" for sort keys %{$img-> {extras}};
26
27 Proprties
28 preview BOOLEAN
29 Selects if the preview functionality is active. The user can
30 switch it on and off interactively.
31
32 Default value: 1
33
34 Methods
35 load %PROFILE
36 Executes the dialog, and, if successful, loads the image file and
37 frame selected by the user. Returns the loaded image as a
38 "Prima::Image" object. PROFILE is a hash, passed to
39 "Prima::Image::load" method. In particular, it can be used to
40 disable the default loading of extra information in "{extras}"
41 variable, or to specify a non-default loading option. For example,
42 "{extras}->{className} = 'Prima::Icon'" would return the loaded
43 image as an icon object. See Prima::image-load for more.
44
45 "load" can report progressive image loading to the caller, and/or
46 to an instance of "Prima::ImageViewer", if desired. If either (or
47 both) "onHeaderReady" and "onDataReady" notifications are
48 specified, these are called from the respective event handlers of
49 the image being loaded ( see "Loading with progress indicator" in
50 Prima::image-load for details). If profile key "progressViewer" is
51 supplied, its value is treated as a "Prima::ImageViewer" instance,
52 and it is used to display image loading progress. See
53 "watch_load_progress" in Prima::ImageViewer.
54
55 Events
56 HeaderReady IMAGE
57 See "HeaderReady" in Prima::Image.
58
59 DataReady IMAGE, X, Y, WIDTH, HEIGHT
60 See "DataReady" in Prima::Image.
61
63 Provides a save dialog where the user can select image format, the bit
64 depth and other format-specific options. The format-specific options
65 can be set if a dialog for the file format is provided. The standard
66 toolkit dialogs reside under in "Prima::Image" namespace, in
67 Prima/Image subdirectory. For example, "Prima::Image::gif" provides the
68 selection of transparency color, and "Prima::Image::jpeg" the image
69 quality control. If the image passed to the image property contains
70 "{extras}" variable, the data are read and used as the default values.
71 In particular, "{extras}->-{codecID}" field, responsible for the file
72 format, if present, affects the default file format selection.
73
74 SYNOPSIS
75 my $dlg = Prima::ImageSaveDialog-> create;
76 return unless $dlg-> save( $image );
77 print "saved as ", $dlg-> fileName, "\n";
78
79 Properties
80 image IMAGE
81 Selects the image to be saved. This property is to be used for the
82 standard invocation of dialog, via "execute". It is not needed when
83 the execution and saving is invoked via save method.
84
85 Methods
86 save IMAGE, %PROFILE
87 Invokes the dialog, and, if the execution was successful, saves the
88 IMAGE according to the user selection and PROFILE hash. PROFILE is
89 not used for the default options, but is passed directly to
90 "Prima::Image::save" call, possibly overriding selection of the
91 user. Returns 1 in case of success, 0 in case of error. If the
92 error occurs, the user is notified before the method returns.
93
95 Dmitry Karasik, <dmitry@karasik.eu.org>.
96
98 Prima, Prima::Window, Prima::codecs, Prima::image-load, Prima::Image,
99 Prima::FileDialog, Prima::ImageViewer, examples/iv.pl.
100
101
102
103perl v5.28.0 2017-02-28 Prima::ImageDialog(3)