[−][src]Struct pix::RasterBuilder
Builder for Raster images.
Create with Raster::new
let rb = Raster::<Rgb8>::new(100, 100);
To build a Raster
, use one of the with_ methods:
Methods
impl<F: Format> RasterBuilder<F>
[src]
pub fn alpha_mode(self, alpha_mode: AlphaMode) -> Self
[src]
Set the alpha mode. The default value is Separated.
pub fn gamma_mode(self, gamma_mode: GammaMode) -> Self
[src]
Set the gamma mode. The default value is Srgb.
pub fn with_empty(self) -> Raster<F>
[src]
Build a Raster with empty pixel data.
pub fn with_pixels<B>(self, pixels: B) -> Raster<F> where
B: Into<Box<[F]>>,
[src]
B: Into<Box<[F]>>,
Build a Raster
with owned pixel data. You can get ownership of the
pixel data back from the Raster
as either a Vec<F>
or a Box<[F]>
by calling into()
.
F
Pixel Format.pixels
Pixel data.
Panics
Panics if pixels
length is not equal to width
* height
.
Example
use pix::*; let p = vec![Rgb8::new(255, 0, 255); 16]; // vec of magenta pix let mut r = Raster::new(4, 4).with_pixels(p); // convert to raster let clr = Rgb8::new(0x00, 0xFF, 0x00); // green r.set_region((2, 0, 1, 3), clr); // make stripe let p2 = Into::<Vec<Rgb8>>::into(r); // convert back to vec
pub fn with_u8_buffer<B>(self, buffer: B) -> Raster<F> where
B: Into<Box<[u8]>>,
F: Format<Chan = Ch8>,
[src]
B: Into<Box<[u8]>>,
F: Format<Chan = Ch8>,
Build a Raster
from a u8 buffer.
F
Pixel Format.buffer
Buffer of pixel data.
Panics
Panics if buffer
length is not equal to width
* height
*
std::mem::size_of::<F>()
.
pub fn with_u16_buffer<B>(self, buffer: B) -> Raster<F> where
B: Into<Box<[u16]>>,
F: Format<Chan = Ch16>,
[src]
B: Into<Box<[u16]>>,
F: Format<Chan = Ch16>,
Auto Trait Implementations
impl<F> Send for RasterBuilder<F> where
F: Send,
F: Send,
impl<F> Sync for RasterBuilder<F> where
F: Sync,
F: Sync,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,