Prima::StdBitmap(3)

πŸ“¦
version 1.74000 Β· 5 versions
, in opensuse-leap 16.0

πŸ’… Prima::StdBitmap β€” a lil' treasure chest of standard bitmaps

okay so bestie, this is Prima::StdBitmap(3) from the User Contributed Perl Documentation, and it's literally the module that hands out the toolkit's shared standard images. Let's get into it πŸŽ€


✨ NAME ✨

Prima::StdBitmap β€” shared access to the standard bitmaps. yes, shared, as in everybody's using the same ones, no cap 🫢


🌸 DESCRIPTION 🌸

So the toolkit ships a file called sysimage.gif that contains the standard Prima image library β€” a whole predefined set of images that different modules use. To give everyone unified access to the images inside that file, you use this module's API. Iconic behavior, honestly.

Every image is assigned to an sbmp:: constant, and that constant is what you use as an index when you request an image to be loaded. And the way that caching works? If an image loads successfully, the result gets cached, and every successive request just reuses the cached image. efficient queen πŸ‘‘

The images can be loaded as Prima::Image and Prima::Icon instances, by two methods β€” correspondingly image and icon. two methods, two vibes, one image file πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

use Prima::StdBitmap;
my $logo = Prima::StdBitmap::icon( sbmp::Logo );

that's it, that's the whole thing, slay ✨


πŸ‘‘ API πŸ‘‘

πŸ’… Methods

  • icon INDEX β€” loads the INDEXth image frame and returns a Prima::Icon instance. cute little icon, ready to go πŸŽ€
  • image INDEX β€” loads the INDEXth image frame and returns a Prima::Image instance. same deal, but you get the raw image vibe πŸ–ΌοΈ
  • load_std_bmp %OPTIONS β€” the main character of the loading process, fr fr. It 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 it's set, a cached image is never used and the created image is neither stored in the cache. Since the module's whole intended use is to provide shared and read-only access to the image library, setting copy to 1 is what you do to get non-shareable images β€” i.e. ones you're allowed to mess with, bestie πŸ™ˆ

The loader automatically scales images if the system dpi suggests so. And if layering is supported, the icon scaling will use that too. To disable these optimizations, pass raw => 1 to disable all optimizations, and argb => 0 to disable producing ARGB icons πŸ’€

ngl, the "don't touch the shared ones" rule is real β€” if you wanna scribble on an image, that's what copy is for.

🌈 Constants

An index value passed to the methods must be one of the sbmp:: constants, and here's the full roster β€” every single one, no skips πŸ’œ

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

okay sbmp::Last is giving "end of the list, periodt" πŸ’€


πŸ“ Scalars

The $sysimage scalar is initialized to the file name to be used as a source of standard images. And yes β€” it's possible to alter this scalar at run-time, which causes all subsequent image frame requests to be redirected to the new file. hot-swap the whole image source, iykyk πŸ”₯


🧚 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. Which means it is therefore advisable to load images after the Application object is created β€” like, don't jump the gun, bestie ⭐

timing matters here: create your Application object first, then go grab your images. otherwise the auto-scaling has nothing to vibe-check against 😭

🌸 AUTHOR 🌸

Dmitry Karasik, <dmitry@karasik.eu.org>. king behavior πŸ‘‘


⭐ SEE ALSO ⭐

Prima, Prima::Image, Prima::Const. go read those next, they're all part of the same friend group 🫢


aaaand that's the whole page, bestie! 🌈 this gem is from perl v5.42.0, dated 2024-08-20, and it's the Prima::StdBitmap(3) man page β€” now go load some sbmp:: constants and be iconic πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from