NAME
Prima::StdBitmap - shared access to the standard bitmaps
DESCRIPTION
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.
The images can be loaded as Prima::Image
and Prima::Icon
instances, by two methods, correspondingly image
and icon
.
SYNOPSIS
use Prima::StdBitmap;
my $logo = Prima::StdBitmap::icon( sbmp::Logo );
API
Methods
- icon INDEX
-
Loads the INDEXth image frame and returns a
Prima::Icon
instance. - image INDEX
-
Loads the INDEXth image frame and returns a
Prima::Image
instance. - load_std_bmp %OPTIONS
-
Loads the
index
th image frame fromfile
and returns it as either aPrima::Image
or aPrima::Icon
instance, depending on the value of the booleanicon
flag. If thecopy
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.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, andargb => 0
to disable producing ARGB icons.
Constants
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
Scalars
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.
Scaling and ARGB-shading
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.
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.