#[repr(C)]pub struct TrayIconImage {
pub key: IconKey,
pub width: u32,
pub height: u32,
pub rgba: U8Vec,
}Expand description
RGBA8 image for a tray icon, at one specific size.
Unlike crate::window::WindowIcon, which is fixed at 16x16 / 32x32, a
tray icon needs arbitrary sizes: Windows wants
GetSystemMetricsForDpi(SM_CXSMICON) (16 / 20 / 24 / 32 px as the taskbar’s
DPI changes), macOS wants an 18x18 point template image (so 36x36 px on a
2x display), and SNI wants an array of whatever sizes we care to publish so
the panel can pick.
rgba is straight, non-premultiplied RGBA8, width * height * 4 bytes, top
row first. Every backend converts from this one representation:
Windows builds a BGRA HBITMAP + mask, macOS an NSBitmapImageRep, and
Linux byte-swaps to the ARGB32-big-endian that IconPixmap requires.
Fields§
§key: IconKeyCache key - lets a backend skip re-uploading an unchanged icon.
width: u32§height: u32§rgba: U8VecImplementations§
Source§impl TrayIconImage
impl TrayIconImage
Sourcepub fn new(width: u32, height: u32, rgba: U8Vec) -> OptionTrayIconImage
pub fn new(width: u32, height: u32, rgba: U8Vec) -> OptionTrayIconImage
rgba must be exactly width * height * 4 bytes; returns None
otherwise.
Returns OptionTrayIconImage rather than Option<Self> so the
signature crosses the C ABI unchanged.
Sourcepub fn to_argb32_be(&self) -> U8Vec
pub fn to_argb32_be(&self) -> U8Vec
The icon’s pixels as ARGB32 in network (big-endian) byte order, the
wire format org.kde.StatusNotifierItem’s IconPixmap (a(iiay))
requires. Nothing else uses this layout, so it is computed on demand.
Trait Implementations§
Source§impl Clone for TrayIconImage
impl Clone for TrayIconImage
Source§fn clone(&self) -> TrayIconImage
fn clone(&self) -> TrayIconImage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more