[][src]Trait image::GenericImage

pub trait GenericImage: GenericImageView {
    type InnerImage: GenericImage<Pixel = 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 inner_mut(&mut self) -> &mut Self::InnerImage; unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel) { ... }
fn pixels_mut(&mut self) -> MutPixels<Self> { ... }
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool
    where
        O: GenericImageView<Pixel = Self::Pixel>
, { ... }
fn sub_image(
        &mut self,
        x: u32,
        y: u32,
        width: u32,
        height: u32
    ) -> SubImage<&mut Self::InnerImage> { ... } }

A trait for manipulating images.

Associated Types

type InnerImage: GenericImage<Pixel = Self::Pixel>

Underlying image type. This is mainly used by SubImages in order to always have a reference to the original image. This allows for less indirections and it eases the use of nested SubImages.

Loading content...

Required methods

fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut Self::Pixel

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

Panics

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

fn put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)

Put a pixel at location (x, y)

Panics

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

fn blend_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)

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

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

fn inner_mut(&mut self) -> &mut Self::InnerImage

Returns a mutable reference to the underlying image.

Loading content...

Provided methods

unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)

Puts a pixel at location (x, y)

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

Important traits for MutPixels<'a, I>
fn pixels_mut(&mut self) -> MutPixels<Self>

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.

fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
    O: GenericImageView<Pixel = Self::Pixel>, 

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.

fn sub_image(
    &mut self,
    x: u32,
    y: u32,
    width: u32,
    height: u32
) -> SubImage<&mut Self::InnerImage>

Returns a subimage that is a view into this image.

Loading content...

Implementors

impl GenericImage for DynamicImage[src]

type InnerImage = DynamicImage

fn blend_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)[src]

DEPRECATED: Use iterator pixels_mut to blend the pixels directly.

fn get_pixel_mut(&mut self, _: u32, _: u32) -> &mut Rgba<u8>[src]

DEPRECATED: Do not use is function: It is unimplemented!

unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)[src]

Important traits for MutPixels<'a, I>
fn pixels_mut(&mut self) -> MutPixels<Self>[src]

Deprecated:

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

fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
    O: GenericImageView<Pixel = Self::Pixel>, 
[src]

fn sub_image(
    &mut self,
    x: u32,
    y: u32,
    width: u32,
    height: u32
) -> SubImage<&mut Self::InnerImage>
[src]

impl<Buffer, P: Pixel> GenericImage for ViewMut<Buffer, P> where
    Buffer: AsMut<[P::Subpixel]> + AsRef<[P::Subpixel]>, 
[src]

type InnerImage = Self

unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)[src]

Important traits for MutPixels<'a, I>
fn pixels_mut(&mut self) -> MutPixels<Self>[src]

Deprecated:

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

fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
    O: GenericImageView<Pixel = Self::Pixel>, 
[src]

fn sub_image(
    &mut self,
    x: u32,
    y: u32,
    width: u32,
    height: u32
) -> SubImage<&mut Self::InnerImage>
[src]

impl<I> GenericImage for SubImage<I> where
    I: DerefMut,
    I::Target: GenericImage + Sized
[src]

type InnerImage = I::Target

fn blend_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)[src]

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

unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)[src]

Important traits for MutPixels<'a, I>
fn pixels_mut(&mut self) -> MutPixels<Self>[src]

Deprecated:

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

fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
    O: GenericImageView<Pixel = Self::Pixel>, 
[src]

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

type InnerImage = Self

unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: P)[src]

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

fn blend_pixel(&mut self, x: u32, y: u32, p: P)[src]

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

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

Important traits for MutPixels<'a, I>
fn pixels_mut(&mut self) -> MutPixels<Self>[src]

Deprecated:

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

fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
    O: GenericImageView<Pixel = Self::Pixel>, 
[src]

fn sub_image(
    &mut self,
    x: u32,
    y: u32,
    width: u32,
    height: u32
) -> SubImage<&mut Self::InnerImage>
[src]

Loading content...