Trait image::GenericImage[][src]

pub trait GenericImage: Sized {
    type Pixel: Pixel;
    fn dimensions(&self) -> (u32, u32);
fn bounds(&self) -> (u32, u32, u32, u32);
fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel;
fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut Self::Pixel;
fn put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel);
fn blend_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel); fn width(&self) -> u32 { ... }
fn height(&self) -> u32 { ... }
fn in_bounds(&self, x: u32, y: u32) -> bool { ... }
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel { ... }
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel) { ... }
fn pixels(&self) -> Pixels<Self> { ... }
fn pixels_mut(&mut self) -> MutPixels<Self> { ... }
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool
    where
        O: GenericImage<Pixel = Self::Pixel>
, { ... }
fn sub_image(
        &mut self,
        x: u32,
        y: u32,
        width: u32,
        height: u32
    ) -> SubImage<Self>
    where
        Self: 'static,
        <Self::Pixel as Pixel>::Subpixel: 'static,
        Self::Pixel: 'static
, { ... } }

A trait for manipulating images.

Associated Types

The type of pixel.

Required Methods

The width and height of this image.

The bounding rectangle of this image.

Returns the pixel located at (x, y)

Panics

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

TODO: change this signature to &P

Puts a pixel at location (x, y)

Panics

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

Put a pixel at location (x, y)

Panics

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

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

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

Provided Methods

The width of this image.

The height of this image.

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

Returns the pixel located at (x, y)

This function can be implemented in a way that ignores bounds checking.

Puts a pixel at location (x, y)

This function can be implemented in a way that ignores bounds checking.

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

Important traits for MutPixels<'a, I>

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

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

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

The other image is copied with the top-left corner of the other image placed at (x, y).

In order to copy only a piece of the other image, use sub_image.

Returns

true if the copy was successful, false if the image could not be copied due to size constraints.

Returns a subimage that is a view into this image.

Implementors