Prima::...eDialog(3)
πΈ NAME πΈ
Prima::Dialog::ImageDialog β image file open and save dialogs π
(straight outta the User Contributed Perl Documentation section of the manual, iykyk)
β¨ DESCRIPTION β¨
Okay so picture this: this module hands you the standard dialogs, except specially adjusted for image loading and image saving. That's it. That's the vibe. π
π¦ Prima::Dialog::ImageOpenDialog π¦
It gives you a preview widget so the user can literally look at the image file before loading it π, plus the ability to pick a frame index for multi-framed image files (yes, those exist, and yes, they're iconic).
Instead of the execute call, you use the load method to invoke the dialog, and it returns the loaded image as a Prima::Image object π«Ά. That loaded object carries the {extras} hash, all filled in by the loader with the file and image info. Peep Prima::image-load for more, fr fr.
β SYNOPSIS β
use Prima qw(Application Dialog::ImageDialog);
my $dlg = Prima::Dialog::ImageOpenDialog-> new;
my $img = $dlg-> load;
return unless $img;
print "$_:$img->{extras}->{$_}\n" for sort keys %{$img-> {extras}};
π Properties π
preview BOOLEANβ picks whether the preview functionality is active or not. The user can toggle it on and off interactively, no cap. Default value:1β¨
π₯ Methods π₯
load %PROFILEβ runs the dialog, and if it all goes well, loads the image file and the frame the user selected. Returns the loaded image as aPrima::Imageobject π.PROFILEis a hash that gets passed to thePrima::Image::loadmethod. Specifically, you can use it to disable the default loading of extra info into the{extras}hash variable, or to specify a non-default loading option. Like,{extras}->{className} = 'Prima::Icon'would return the loaded image as an icon object, cute right? See Prima::image-load for more.
load can report the progress of the image loading to the caller, and/or to an instance of Prima::ImageViewer, if you want π§. If either (or both!) onHeaderReady and onDataReady notifications are specified, they get called from the respective event handlers of the image being loaded (see "Loading with progress indicator" in Prima::image-load for the deets). And if the profile key progressViewer is supplied, its value is treated as a Prima::ImageViewer instance, and it's used to display the loading progress. See "watch_load_progress" in Prima::ImageViewer π
π Events π
HeaderReady IMAGEβ see "HeaderReady" in Prima::Image.DataReady IMAGE, X, Y, WIDTH, HEIGHTβ see "DataReady" in Prima::Image.
π Prima::Dialog::ImageSaveDialog π
The standard image save dialog, where the user gets to pick the desired image format, the bit depth, and other format-specific options π.
Those format-specific options can be set if a dialog for the file format is provided by the toolkit. The standard toolkit dialogs live under the Prima::Image namespace, in the Prima/Image subdirectory. For example, Prima::Image::gif gives you the selection of a transparent color, and Prima::Image::jpeg gives you the image quality control. If the image passed to the image property contains the {extras} hash variable, its data is used as the default values π«. In particular, the {extras}->{codecID} field β the one responsible for the file format β affects the default file format selection.
β SYNOPSIS β
my $dlg = Prima::Dialog::ImageSaveDialog-> new;
return unless $dlg-> save( $image );
print "saved as ", $dlg-> fileName, "\n";
π Properties π
image IMAGEβ selects the image to be saved. This property is meant for the standard invocation of the dialog, via theexecutemethod. It's not needed when the execution and saving are invoked via thesavemethod, so don't stress π«Ά.
π₯ Methods π₯
save IMAGE, %PROFILEβ invokes the dialog, and if the execution succeeds, saves theIMAGEaccording to the user selection and thePROFILEhash. Heads up:PROFILEis not used as a source of the default options β it's passed directly to thePrima::Image::savecall, possibly overriding the user's selection π.
Returns 1 on success, 0 on error. If an error occurs, the user is notified before the method returns β so nobody gets left in the dark π.
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org>.
πΈ SEE ALSO πΈ
Prima, Prima::Window, Prima::codecs, Prima::image-load, Prima::Image, Prima::Dialog::FileDialog, Prima::ImageViewer, examples/iv.pl.
That's the whole page, bestie β perl v5.42.0, dated 2024-08-20, and yeah the title got squished to Prima::...eDialog(3) but we know what it is π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms