pub struct RasterImage {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}Fields§
§width: u32§height: u32§pixels: Vec<u8>Implementations§
Source§impl RasterImage
impl RasterImage
pub fn new(width: u32, height: u32, background: Rgba) -> Self
pub fn blend_pixel(&mut self, x: i32, y: i32, color: Rgba)
pub fn fill_rect( &mut self, x: i32, y: i32, width: i32, height: i32, color: Rgba, )
pub fn stroke_rect( &mut self, x: i32, y: i32, width: i32, height: i32, thickness: i32, color: Rgba, )
pub fn draw_line( &mut self, x0: i32, y0: i32, x1: i32, y1: i32, thickness: i32, color: Rgba, )
pub fn fill_ellipse(&mut self, cx: i32, cy: i32, rx: i32, ry: i32, color: Rgba)
pub fn stroke_ellipse( &mut self, cx: i32, cy: i32, rx: i32, ry: i32, thickness: i32, color: Rgba, )
pub fn draw_text( &mut self, x: i32, y: i32, size_px: i32, color: Rgba, text: &str, bold: bool, )
pub fn measure_text(&self, text: &str, size_px: i32) -> i32
pub fn encode_png(&self) -> Vec<u8> ⓘ
pub fn encode_jpeg(&self, quality: u8) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl Clone for RasterImage
impl Clone for RasterImage
Source§fn clone(&self) -> RasterImage
fn clone(&self) -> RasterImage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RasterImage
impl RefUnwindSafe for RasterImage
impl Send for RasterImage
impl Sync for RasterImage
impl Unpin for RasterImage
impl UnsafeUnpin for RasterImage
impl UnwindSafe for RasterImage
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