[−][src]Struct footile::Raster
A raster image with owned pixel data. If the pixel data must be owned elsewhere, consider using RasterB.
Example
use footile::{PathBuilder,Plotter,Raster,Rgba8}; let path = PathBuilder::new().pen_width(5.0) .move_to(16.0, 48.0) .line_to(32.0, 0.0) .line_to(-16.0, -32.0) .close().build(); let mut p = Plotter::new(100, 100); let mut r = Raster::new(p.width(), p.height()); r.over(p.stroke(&path), Rgba8::rgb(208, 255, 208));
Methods
impl<F: PixFmt> Raster<F>
[src]
pub fn new(width: u32, height: u32) -> Raster<F>
[src]
Create a new raster image.
F
Pixel format.width
Width in pixels.height
Height in pixels.
pub fn width(&self) -> u32
[src]
Get raster width.
pub fn height(&self) -> u32
[src]
Get raster height.
pub fn as_slice(&self) -> &[F]
[src]
Get the pixels as a slice.
pub fn as_slice_mut(&mut self) -> &mut [F]
[src]
Get the pixels as a mutable slice.
pub fn as_u8_slice(&self) -> &[u8]
[src]
Get the pixels as a u8 slice.
pub fn as_u8_slice_mut(&mut self) -> &mut [u8]
[src]
Get the pixels as a mutable u8 slice.
pub fn clear(&mut self)
[src]
Clear all pixels.
pub fn over(&mut self, mask: &mut Mask, clr: F)
[src]
Blend pixels with an alpha mask.
mask
Alpha mask for compositing. It is cleared before returning.clr
Color to composite.pixels
Borrowed pixel data.
pub fn write_png(self, filename: &str) -> Result<()>
[src]
Write the raster to a PNG (portable network graphics) file.
filename
Name of file to write.
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,