pub struct Canvas { /* private fields */ }Expand description
An RGBA8 raster.
Implementations§
Source§impl Canvas
impl Canvas
Sourcepub fn new(width: u32, height: u32, background: Color) -> Self
pub fn new(width: u32, height: u32, background: Color) -> Self
A canvas filled with background.
Sourcepub fn pixel(&self, x: u32, y: u32) -> Option<[u8; 4]>
pub fn pixel(&self, x: u32, y: u32) -> Option<[u8; 4]>
The RGBA value at (x, y), or None outside the canvas.
Sourcepub fn is_blank(&self) -> bool
pub fn is_blank(&self) -> bool
Whether every pixel is the background colour.
Used to tell “this page is empty” from “this page is drawn”: a page that
ran painting operators and left the canvas uniform is reported as
drew-nothing rather than as fully supported.
Sourcepub fn blend(&mut self, x: u32, y: u32, color: Color, alpha: f64)
pub fn blend(&mut self, x: u32, y: u32, color: Color, alpha: f64)
Paint one pixel with color at alpha, source-over.
Sourcepub fn blend_with(
&mut self,
x: u32,
y: u32,
color: Color,
alpha: f64,
mode: BlendMode,
)
pub fn blend_with( &mut self, x: u32, y: u32, color: Color, alpha: f64, mode: BlendMode, )
Paint one pixel through a blend mode (11.3.5).
The destination is opaque — this rasteriser has no alpha channel — so the
compositing formula collapses to (1-a)·Cb + a·B(Cb, Cs), which is what a
reader sees when painting onto a page.
Trait Implementations§
impl StructuralPartialEq for Canvas
Auto Trait Implementations§
impl Forget for Canvas
impl Freeze for Canvas
impl Move for Canvas
impl RefUnwindSafe for Canvas
impl Send for Canvas
impl Sync for Canvas
impl Unpin for Canvas
impl UnsafeUnpin for Canvas
impl UnwindSafe for Canvas
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