[][src]Struct image::ImageBuffer

pub struct ImageBuffer<P: Pixel, Container> { /* fields omitted */ }

Generic image buffer

Methods

impl<P, Container> ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]>, 
[src]

Contructs a buffer from a generic container (for example a Vec or a slice)

Returns None if the container is not big enough

Returns the underlying raw buffer

The width and height of this image.

The width of this image.

The height of this image.

Returns an iterator over the pixels of this image.

Enumerates over the pixels of the image. The iterator yields the coordinates of each pixel along with a reference to them.

Gets a reference to the pixel at location (x, y)

Panics

Panics if (x, y) is out of the bounds (width, height).

impl<P, Container> ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]> + DerefMut
[src]

Returns an iterator over the mutable pixels of this image.

Enumerates over the pixels of the image. The iterator yields the coordinates of each pixel along with a mutable reference to them.

Gets a reference to the mutable pixel at location (x, y)

Panics

Panics if (x, y) is out of the bounds (width, height).

Puts a pixel at location (x, y)

Panics

Panics if (x, y) is out of the bounds (width, height).

impl<P, Container> ImageBuffer<P, Container> where
    P: Pixel<Subpixel = u8> + 'static,
    Container: Deref<Target = [u8]>, 
[src]

Saves the buffer to a file at the path specified.

The image format is derived from the file extension. Currently only jpeg and png files are supported.

impl<P: Pixel + 'static> ImageBuffer<P, Vec<P::Subpixel>> where
    P::Subpixel: 'static, 
[src]

Creates a new image buffer based on a Vec<P::Subpixel>.

Constructs a new ImageBuffer by copying a pixel

Constructs a new ImageBuffer by repeated application of the supplied function. The arguments to the function are the pixel's x and y coordinates.

Creates an image buffer out of an existing buffer. Returns None if the buffer is not big enough.

Consumes the image buffer and returns the underlying data as an owned buffer

Trait Implementations

impl<P, Container> GenericImage for ImageBuffer<P, Container> where
    P: Pixel + 'static,
    Container: Deref<Target = [P::Subpixel]> + DerefMut,
    P::Subpixel: 'static, 
[src]

The type of pixel.

The width and height of this image.

The bounding rectangle of this image.

Returns the pixel located at (x, y) Read more

Puts a pixel at location (x, y) Read more

Returns the pixel located at (x, y), ignoring bounds checking.

Put a pixel at location (x, y) Read more

Puts a pixel at location (x, y), ignoring bounds checking.

Put a pixel at location (x, y), taking into account alpha channels

DEPRECATED: This method will be removed. Blend the pixel directly instead.

The width of this image.

The height of this image.

Returns true if this x, y coordinate is contained inside the image.

Important traits for Pixels<'a, I>

Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value Read more

Important traits for MutPixels<'a, I>

Deprecated

: This cannot be implemented safely in Rust. Please use the image buffer directly.

Returns an Iterator over mutable pixels of this image. The iterator yields the coordinates of each pixel along with a mutable reference to them. Read more

Copies all of the pixels from another image into this image. Read more

Returns a subimage that is a view into this image.

impl<'a, 'b, Container, FromType: Pixel + 'static, ToType: Pixel + 'static> ConvertBuffer<ImageBuffer<ToType, Vec<<ToType as Pixel>::Subpixel>>> for ImageBuffer<FromType, Container> where
    Container: Deref<Target = [FromType::Subpixel]>,
    ToType: FromColor<FromType>,
    FromType::Subpixel: 'static,
    ToType::Subpixel: 'static, 
[src]

Converts self to a buffer of type T Read more

impl<P, Container> Clone for ImageBuffer<P, Container> where
    P: Pixel,
    Container: Deref<Target = [P::Subpixel]> + Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<P: Debug + Pixel, Container: Debug> Debug for ImageBuffer<P, Container>
[src]

Formats the value using the given formatter. Read more

impl<P, Container> Deref for ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]>, 
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<P, Container> DerefMut for ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]> + DerefMut
[src]

Mutably dereferences the value.

impl<P, Container> Index<(u32, u32)> for ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]>, 
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<P, Container> IndexMut<(u32, u32)> for ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]> + DerefMut
[src]

Performs the mutable indexing (container[index]) operation.

Auto Trait Implementations

impl<P, Container> Send for ImageBuffer<P, Container> where
    Container: Send,
    P: Send

impl<P, Container> Sync for ImageBuffer<P, Container> where
    Container: Sync,
    P: Sync

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

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

Performs the conversion.

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

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Immutably borrows from an owned value. Read more

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

Mutably borrows from an owned value. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more