pub struct Image<'a> { /* private fields */ }Expand description
A one-bit picture: height rows of stride bytes, a
byte’s highest bit its left pixel, a set bit white; and optionally a
mask of the same shape, a set bit where the picture is drawn (the
Playdate’s own bitmap layout). Without a mask every pixel is drawn.
Its source size is the size of the image a sprite names
(ImageTable), whose pixels the
sprite’s src counts in. It is the picture’s own size unless the
picture was enlarged before it was dithered (shuyi_assets::bitmap):
then each source pixel covers several of the picture’s.
Implementations§
Source§impl<'a> Image<'a>
impl<'a> Image<'a>
Sourcepub fn new(
width: u16,
height: u16,
data: &'a [u8],
mask: Option<&'a [u8]>,
) -> Option<Self>
pub fn new( width: u16, height: u16, data: &'a [u8], mask: Option<&'a [u8]>, ) -> Option<Self>
The picture, its source size its own, or None if data (or
mask) is too short for it.
Sourcepub fn from_bitmap(bitmap: &Bitmap<'a>, style: usize) -> Option<Self>
pub fn from_bitmap(bitmap: &Bitmap<'a>, style: usize) -> Option<Self>
Style style of one-bit picture file bitmap, with its mask and
source size, or None if it has no such style.
Sourcepub fn with_source(self, width: u16, height: u16) -> Self
pub fn with_source(self, width: u16, height: u16) -> Self
The same picture standing for an image width × height pixels
(its source size); a side of 0 is left as it was.