#[non_exhaustive]pub struct Painted { /* private fields */ }Expand description
A picture a skin paints at run time (ADR-0078). Its fields keep their sizes, so they are read and written through methods; the ones that write move its revision.
Implementations§
Source§impl Painted
impl Painted
Sourcepub fn rgba(width: u16, height: u16) -> Self
pub fn rgba(width: u16, height: u16) -> Self
An RGBA picture width × height, every pixel clear.
Sourcepub fn indexed(width: u16, height: u16, palette: &[Rgb]) -> Self
pub fn indexed(width: u16, height: u16, palette: &[Rgb]) -> Self
An indexed picture width × height, every pixel index 0, its
palette the first PALETTE_LEN colours of palette and black
for the rest.
Sourcepub fn one_bit(width: u16, height: u16) -> Self
pub fn one_bit(width: u16, height: u16) -> Self
A one-bit picture width × height, every pixel black, without a
mask (every pixel drawn).
Sourcepub fn with_mask(self) -> Self
pub fn with_mask(self) -> Self
The same one-bit picture with a mask, every pixel drawn; any other picture as it is.
Sourcepub const fn kind(&self) -> PaintedKind
pub const fn kind(&self) -> PaintedKind
What its bytes are.
Sourcepub const fn revision(&self) -> u32
pub const fn revision(&self) -> u32
How many times its pixels, palette or mask were borrowed for writing, wrapping: a picture whose revision didn’t move since a frame is that frame’s.
Sourcepub fn pixels_mut(&mut self) -> &mut [u8] ⓘ
pub fn pixels_mut(&mut self) -> &mut [u8] ⓘ
Its bytes to write; moves the revision.
Sourcepub fn palette(&self) -> &[Rgb]
pub fn palette(&self) -> &[Rgb]
An indexed picture’s PALETTE_LEN colours; none for another.
Sourcepub fn palette_mut(&mut self) -> &mut [Rgb]
pub fn palette_mut(&mut self) -> &mut [Rgb]
An indexed picture’s colours to write (none for another); moves the revision.
Sourcepub fn mask_mut(&mut self) -> Option<&mut [u8]>
pub fn mask_mut(&mut self) -> Option<&mut [u8]>
The mask to write, if it has one; then moves the revision.
Sourcepub fn rgba_at(&self, x: u16, y: u16) -> [u8; 4]
pub fn rgba_at(&self, x: u16, y: u16) -> [u8; 4]
Pixel (x, y), which must lie in the picture, as RGBA8: an indexed
one’s colour, opaque; a one-bit one white or black, clear where the
mask leaves it out.
Sourcepub fn rgba_into(&self, out: &mut Vec<u8>)
pub fn rgba_into(&self, out: &mut Vec<u8>)
Writes the whole picture as RGBA8, row after row, into out (its
old bytes gone): each pixel as rgba_at has it.
What a painter that draws RGBA uploads.
Sourcepub fn fingerprint(&self) -> u64
pub fn fingerprint(&self) -> u64
The FNV hash (shuyi_assets::fnv) of its size, kind, pixels,
palette and mask, not its revision: what a snapshot shows of it.
Trait Implementations§
Source§impl Debug for Painted
Its size, kind, revision and fingerprint: its pixels would bury a
failed test’s message.
impl Debug for Painted
Its size, kind, revision and fingerprint: its pixels would bury a failed test’s message.