pub struct Image { /* private fields */ }Expand description
A premultiplied ARGB8888 image, one u32 per pixel, rows contiguous.
Premultiplied because that is what KMS scans out: a plane’s ARGB8888
pixels already have their color scaled by their coverage, and compositing
them any other way would double-apply it. The layout is 0xAARRGGBB in a
native-endian u32, which is what a little-endian host sees in a
DRM_FORMAT_ARGB8888 buffer.
Implementations§
Source§impl Image
impl Image
Sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
A transparent image of the given size.
A zero in either dimension gives the same empty image as
Image::default – there is no such thing as a 0x100 picture, and
carrying one would mean every consumer checking both dimensions.
Sourcepub const fn stride_bytes(&self) -> u32
pub const fn stride_bytes(&self) -> u32
Bytes per row. Always width * 4; the storage is tightly packed.
Sourcepub fn pixels_mut(&mut self) -> &mut [u32]
pub fn pixels_mut(&mut self) -> &mut [u32]
The pixels, row-major, mutable.
Trait Implementations§
impl Eq for Image
impl StructuralPartialEq for Image
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
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