Struct rasterize::Layer

source ·
pub struct Layer<C> { /* private fields */ }
Expand description

Image with top left corner at (x, y) coordinates

Implementations§

source§

impl<C: Default + Copy> Layer<C>

source

pub fn new(bbox: BBox, color: Option<C>) -> Self

New layer fully containing bounding box

source

pub fn empty() -> Self

Create an empty layer

source

pub fn x(&self) -> i32

X coordinate of the layer

source

pub fn y(&self) -> i32

Y coordinate of the layer

source

pub fn translate(self, dx: i32, dy: i32) -> Self

Translate layer by (dx, dy)

source

pub fn compose<CF, CO>(&mut self, other: &Layer<CO>, compose: CF) -> &mut Self
where CO: Default + Copy, CF: Fn(C, CO) -> C,

Compose other layer on top of this one taking into account offset

Trait Implementations§

source§

impl<C: Clone> Clone for Layer<C>

source§

fn clone(&self) -> Layer<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C> Debug for Layer<C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C> Image for Layer<C>

§

type Pixel = C

Pixel type
source§

fn shape(&self) -> Shape

Shape of the image
source§

fn data(&self) -> &[Self::Pixel]

Data containing image
source§

fn size(&self) -> Size

Image size
source§

fn width(&self) -> usize

Image width
source§

fn height(&self) -> usize

Image height
source§

fn get(&self, row: usize, col: usize) -> Option<&Self::Pixel>

Get pixel at the specified row and column
source§

fn view( &self, row_min: usize, row_max: usize, col_min: usize, col_max: usize ) -> ImageRef<'_, Self::Pixel>

Create sub-image bounded by constraints, _max values are not inclusive.
source§

fn as_ref(&self) -> ImageRef<'_, Self::Pixel>

Create immutable view to the image of the concrete type of ImageRef
source§

fn iter(&self) -> ImageIter<'_, Self::Pixel>

Iterate over pixels
source§

impl<C> ImageMut for Layer<C>

source§

fn data_mut(&mut self) -> &mut [Self::Pixel]

Get a mutable slice of image data
source§

fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut Self::Pixel>

Get a mutable reference to the specified pixel
source§

fn view_mut( &mut self, row_min: usize, row_max: usize, col_min: usize, col_max: usize ) -> ImageMutRef<'_, Self::Pixel>

Create mutable sub-image bounded by constraints, _max values are not inclusive.
source§

fn as_mut(&mut self) -> ImageMutRef<'_, Self::Pixel>

Create concrete type reference to the image
source§

fn iter_mut(&mut self) -> ImageMutIter<'_, Self::Pixel>

Create iterator over mutable references to all the pixel of the image

Auto Trait Implementations§

§

impl<C> Freeze for Layer<C>

§

impl<C> RefUnwindSafe for Layer<C>
where C: RefUnwindSafe,

§

impl<C> Send for Layer<C>
where C: Send,

§

impl<C> Sync for Layer<C>
where C: Sync,

§

impl<C> Unpin for Layer<C>
where C: Unpin,

§

impl<C> UnwindSafe for Layer<C>
where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.