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