Struct footile::Raster

source ·
pub struct Raster<F: PixFmt> { /* private fields */ }
Expand description

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));

Implementations

Create a new raster image.

  • F Pixel format.
  • width Width in pixels.
  • height Height in pixels.

Get raster width.

Get raster height.

Get the pixels as a slice.

Get the pixels as a mutable slice.

Get the pixels as a u8 slice.

Get the pixels as a mutable u8 slice.

Clear all pixels.

Composite onto owned pixels, using “over”.

  • mask Alpha mask for compositing. It is cleared before returning.
  • clr Color to composite.
  • pixels Borrowed pixel data.

Write the raster to a PNG (portable network graphics) file.

  • filename Name of file to write.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.