[][src]Struct canvas::Layout

pub struct Layout<P> { /* fields omitted */ }

Describes the memory region used for the image.

The underlying buffer may have more data allocated than this region and cause the overhead to be reused when resizing the image. All ways to construct this already check that all pixels within the resulting image can be addressed via an index.

Methods

impl<P> Layout<P>[src]

pub fn width_and_height_for_pixel(
    pixel: Pixel<P>,
    width: usize,
    height: usize
) -> Option<Self>
[src]

pub fn width_and_height(width: usize, height: usize) -> Option<Self> where
    P: AsPixel
[src]

pub fn byte_len(self) -> usize[src]

Get the required bytes for this layout.

pub fn len(self) -> usize[src]

The number of pixels in this layout

pub fn width(self) -> usize[src]

pub fn height(self) -> usize[src]

pub fn pixel(self) -> Pixel<P>[src]

pub fn transmute<Q: AsPixel>(self) -> Layout<Q>[src]

Reinterpret to another, same size pixel type.

See transmute_to for details.

pub fn transmute_to<Q>(self, pixel: Pixel<Q>) -> Layout<Q>[src]

Reinterpret to another, same size pixel type.

Panics

Like std::mem::transmute, the size of the two types need to be equal. This ensures that all indices are valid in both directions.

pub fn map<Q: AsPixel>(self) -> Option<Layout<Q>>[src]

Utility method to change the pixel type without changing the dimensions.

pub fn map_to<Q>(self, pixel: Pixel<Q>) -> Option<Layout<Q>>[src]

Utility method to change the pixel type without changing the dimensions.

Trait Implementations

impl<P> Clone for Layout<P>[src]

impl<P> Copy for Layout<P>[src]

impl<P> Debug for Layout<P>[src]

impl<P: AsPixel> Default for Layout<P>[src]

impl<P> Eq for Layout<P>[src]

impl<P> PartialEq<Layout<P>> for Layout<P>[src]

impl<P> PartialOrd<Layout<P>> for Layout<P>[src]

Auto Trait Implementations

impl<P> RefUnwindSafe for Layout<P> where
    P: RefUnwindSafe

impl<P> Send for Layout<P> where
    P: Send

impl<P> Sync for Layout<P> where
    P: Sync

impl<P> Unpin for Layout<P> where
    P: Unpin

impl<P> UnwindSafe for Layout<P> where
    P: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.