pub struct StockIcon {
pub role: IconRole,
pub size: IconSize,
pub mode: ThemeMode,
pub scale: u32,
pub source: IconSource,
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}Expand description
A resolved icon raster (RGBA8, row-major, straight alpha).
Fields§
§role: IconRoleRole this icon resolved from.
size: IconSizeRequested DPI variant.
mode: ThemeModeTheme mode the palette was resolved for.
scale: u32Requested DPI scale factor (1 = 96 dpi baseline), clamped to 1..=4.
source: IconSourceTier that produced the raster.
width: u32Raster width in device pixels (size.pixels() * scale, or the
rounded fractional edge from render_stock_icon_for_scale).
height: u32Raster height in device pixels (same rule as width).
pixels: Vec<u8>RGBA8 pixels, width * height * 4 bytes, straight (un-premultiplied)
alpha.
Implementations§
Source§impl StockIcon
impl StockIcon
Sourcepub fn pixel(&self, x: u32, y: u32) -> Option<[u8; 4]>
pub fn pixel(&self, x: u32, y: u32) -> Option<[u8; 4]>
Returns the RGBA pixel at (x, y), or None when out of bounds.
Sourcepub fn has_visible_pixels(&self) -> bool
pub fn has_visible_pixels(&self) -> bool
Whether the raster contains at least one visible (non-zero alpha) pixel. A fully transparent raster is a rendering bug, never valid art.
Trait Implementations§
impl Eq for StockIcon
impl StructuralPartialEq for StockIcon
Auto Trait Implementations§
impl Forget for StockIcon
impl Freeze for StockIcon
impl Move for StockIcon
impl RefUnwindSafe for StockIcon
impl Send for StockIconwhere
RawVecInner: Send,
impl Sync for StockIconwhere
RawVecInner: Sync,
impl Unpin for StockIcon
impl UnsafeUnpin for StockIcon
impl UnwindSafe for StockIconwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more