pub struct AzulPixmap { /* private fields */ }Expand description
A simple RGBA pixel buffer. Replaces tiny_skia::Pixmap.
Implementations§
Source§impl AzulPixmap
impl AzulPixmap
Sourcepub fn new(width: u32, height: u32) -> Option<Self>
pub fn new(width: u32, height: u32) -> Option<Self>
Create a new pixmap filled with opaque white.
Sourcepub fn fill_rect(
&mut self,
x: i32,
y: i32,
w: i32,
h: i32,
r: u8,
g: u8,
b: u8,
a: u8,
)
pub fn fill_rect( &mut self, x: i32, y: i32, w: i32, h: i32, r: u8, g: u8, b: u8, a: u8, )
Fill a rectangular region with a single color (pixel coordinates).
Sourcepub fn clone_pixmap(&self) -> Self
pub fn clone_pixmap(&self) -> Self
Create a clone of this pixmap (for filter application).
Sourcepub fn resize_grow_only(
&mut self,
new_width: u32,
new_height: u32,
fill_r: u8,
fill_g: u8,
fill_b: u8,
fill_a: u8,
) -> Option<()>
pub fn resize_grow_only( &mut self, new_width: u32, new_height: u32, fill_r: u8, fill_g: u8, fill_b: u8, fill_a: u8, ) -> Option<()>
Resize the pixmap preserving existing content in the top-left corner. New right/bottom strips are filled with the specified color. Only grows — returns None if new dimensions are smaller (caller should realloc).
Sourcepub fn resize_reuse(
&mut self,
new_width: u32,
new_height: u32,
fill_r: u8,
fill_g: u8,
fill_b: u8,
fill_a: u8,
)
pub fn resize_reuse( &mut self, new_width: u32, new_height: u32, fill_r: u8, fill_g: u8, fill_b: u8, fill_a: u8, )
Resize the pixmap, reusing existing content for the overlapping region. Works for both growing and shrinking. New areas are filled with the given color.
Sourcepub fn decode_png(png_bytes: &[u8]) -> Result<Self, String>
pub fn decode_png(png_bytes: &[u8]) -> Result<Self, String>
Decode a PNG byte slice into an AzulPixmap.
Auto Trait Implementations§
impl Freeze for AzulPixmap
impl RefUnwindSafe for AzulPixmap
impl Send for AzulPixmap
impl Sync for AzulPixmap
impl Unpin for AzulPixmap
impl UnsafeUnpin for AzulPixmap
impl UnwindSafe for AzulPixmap
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more