Prima::StdBitmap - shared access to the standard bitmaps
The toolkit provides the sysimage.gif file that contains the standard Prima image library and consists of a predefined set of images used by different modules. To provide unified access to the images inside the file, this module's API can be used. Every image is assigned to a sbmp:: constant that is used as an index for an image loading request. If an image is loaded successfully, the result is cached and the successive requests use the cached image.
sbmp::
The images can be loaded as Prima::Image and Prima::Icon instances, by two methods, correspondingly image and icon.
Prima::Image
Prima::Icon
image
icon
use Prima::StdBitmap; my $logo = Prima::StdBitmap::icon( sbmp::Logo );
Loads the INDEXth image frame and returns a Prima::Icon instance.
Loads the INDEXth image frame and returns a Prima::Image instance.
Loads the indexth image frame from file and returns it as either a Prima::Image or a Prima::Icon instance, depending on the value of the boolean icon flag. If the copy boolean flag is unset, a cached image can be used. If this flag is set, a cached image is never used and the created image is neither stored in the cache. Since the module's intended use is to provide shared and read-only access to the image library, copy set to 1 can be used to return non-shareable images.
index
file
copy
The loader automatically scales images if the system dpi suggests so. If layering is supported, the icon scaling will use that as well. To disable these optimizations use the raw => 1 flag to disable all optimizations, and argb => 0 to disable producing ARGB icons.
raw => 1
argb => 0
An index value passed to the methods must be one of the sbmp:: constants:
sbmp::Logo sbmp::CheckBoxChecked sbmp::CheckBoxCheckedPressed sbmp::CheckBoxUnchecked sbmp::CheckBoxUncheckedPressed sbmp::RadioChecked sbmp::RadioCheckedPressed sbmp::RadioUnchecked sbmp::RadioUncheckedPressed sbmp::Warning sbmp::Information sbmp::Question sbmp::OutlineCollapse sbmp::OutlineExpand sbmp::Error sbmp::SysMenu sbmp::SysMenuPressed sbmp::Max sbmp::MaxPressed sbmp::Min sbmp::MinPressed sbmp::Restore sbmp::RestorePressed sbmp::Close sbmp::ClosePressed sbmp::Hide sbmp::HidePressed sbmp::DriveUnknown sbmp::DriveFloppy sbmp::DriveHDD sbmp::DriveNetwork sbmp::DriveCDROM sbmp::DriveMemory sbmp::GlyphOK sbmp::GlyphCancel sbmp::SFolderOpened sbmp::SFolderClosed sbmp::Last
The $sysimage scalar is initialized to the file name to be used as a source of standard images. It is possible to alter this scalar at run-time, which causes all subsequent image frame requests to be redirected to the new file.
$sysimage
The loading routine scales and visually enhances the images automatically according to the system settings that are reported by the Prima::Application class. It is therefore advisable to load images after the Application object is created.
Prima::Application
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, Prima::Image, Prima::Const.
To install Prima, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prima
CPAN shell
perl -MCPAN -e shell install Prima
For more information on module installation, please visit the detailed CPAN module installation guide.