[−][src]Trait image::GenericImage
A trait for manipulating images.
Associated Types
Required Methods
fn dimensions(&self) -> (u32, u32)
The width and height of this image.
fn bounds(&self) -> (u32, u32, u32, u32)
The bounding rectangle of this image.
fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel
Returns the pixel located at (x, y)
Panics
Panics if (x, y)
is out of bounds.
TODO: change this signature to &P
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)
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
fn width(&self) -> u32
The width of this image.
fn height(&self) -> u32
The height of this image.
fn in_bounds(&self, x: u32, y: u32) -> bool
Returns true if this x, y coordinate is contained inside the image.
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
Returns the pixel located at (x, y)
This function can be implemented in a way that ignores bounds checking.
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.
fn pixels(&self) -> Pixels<Self>
Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value
fn pixels_mut(&mut self) -> MutPixels<Self>
: 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: GenericImage<Pixel = Self::Pixel>,
O: GenericImage<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<Self> where
Self: 'static,
<Self::Pixel as Pixel>::Subpixel: 'static,
Self::Pixel: 'static,
&mut self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<Self> where
Self: 'static,
<Self::Pixel as Pixel>::Subpixel: 'static,
Self::Pixel: 'static,
Returns a subimage that is a view into this image.
Implementors
impl GenericImage for DynamicImage
[src]
impl GenericImage for DynamicImage
type Pixel = Rgba<u8>
fn dimensions(&self) -> (u32, u32)
[src]
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
[src]
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
fn put_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
[src]
fn put_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
fn blend_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
[src]
fn blend_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
DEPRECATED: Use iterator pixels_mut
to blend the pixels directly.
fn get_pixel_mut(&mut self, _: u32, _: u32) -> &mut Rgba<u8>
[src]
fn get_pixel_mut(&mut self, _: u32, _: u32) -> &mut Rgba<u8>
DEPRECATED: Do not use is function: It is unimplemented!
fn width(&self) -> u32
[src]
fn width(&self) -> u32
fn height(&self) -> u32
[src]
fn height(&self) -> u32
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
fn in_bounds(&self, x: u32, y: u32) -> bool
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
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)
[src]
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
fn pixels(&self) -> Pixels<Self>
ⓘImportant traits for MutPixels<'a, I>fn pixels_mut(&mut self) -> MutPixels<Self>
[src]
fn pixels_mut(&mut self) -> MutPixels<Self>
: 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: GenericImage<Pixel = Self::Pixel>,
[src]
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,
[src]
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,
impl<'a, I: GenericImage + 'static> GenericImage for SubImage<'a, I> where
I::Pixel: 'static,
<I::Pixel as Pixel>::Subpixel: 'static,
[src]
impl<'a, I: GenericImage + 'static> GenericImage for SubImage<'a, I> where
I::Pixel: 'static,
<I::Pixel as Pixel>::Subpixel: 'static,
type Pixel = I::Pixel
fn dimensions(&self) -> (u32, u32)
[src]
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> I::Pixel
[src]
fn get_pixel(&self, x: u32, y: u32) -> I::Pixel
fn put_pixel(&mut self, x: u32, y: u32, pixel: I::Pixel)
[src]
fn put_pixel(&mut self, x: u32, y: u32, pixel: I::Pixel)
fn blend_pixel(&mut self, x: u32, y: u32, pixel: I::Pixel)
[src]
fn blend_pixel(&mut self, x: u32, y: u32, pixel: I::Pixel)
DEPRECATED: This method will be removed. Blend the pixel directly instead.
fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut I::Pixel
[src]
fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut I::Pixel
fn width(&self) -> u32
[src]
fn width(&self) -> u32
fn height(&self) -> u32
[src]
fn height(&self) -> u32
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
fn in_bounds(&self, x: u32, y: u32) -> bool
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
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)
[src]
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
fn pixels(&self) -> Pixels<Self>
ⓘImportant traits for MutPixels<'a, I>fn pixels_mut(&mut self) -> MutPixels<Self>
[src]
fn pixels_mut(&mut self) -> MutPixels<Self>
: 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: GenericImage<Pixel = Self::Pixel>,
[src]
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,
[src]
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,
impl<P, Container> GenericImage for ImageBuffer<P, Container> where
P: Pixel + 'static,
Container: Deref<Target = [P::Subpixel]> + DerefMut,
P::Subpixel: 'static,
[src]
impl<P, Container> GenericImage for ImageBuffer<P, Container> where
P: Pixel + 'static,
Container: Deref<Target = [P::Subpixel]> + DerefMut,
P::Subpixel: 'static,
type Pixel = P
fn dimensions(&self) -> (u32, u32)
[src]
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> P
[src]
fn get_pixel(&self, x: u32, y: u32) -> P
fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut P
[src]
fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut P
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> P
[src]
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> P
Returns the pixel located at (x, y), ignoring bounds checking.
fn put_pixel(&mut self, x: u32, y: u32, pixel: P)
[src]
fn put_pixel(&mut self, x: u32, y: u32, pixel: P)
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: P)
[src]
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: P)
Puts a pixel at location (x, y), ignoring bounds checking.
fn blend_pixel(&mut self, x: u32, y: u32, p: P)
[src]
fn blend_pixel(&mut self, x: u32, y: u32, p: P)
Put a pixel at location (x, y), taking into account alpha channels
DEPRECATED: This method will be removed. Blend the pixel directly instead.
fn width(&self) -> u32
[src]
fn width(&self) -> u32
fn height(&self) -> u32
[src]
fn height(&self) -> u32
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
fn in_bounds(&self, x: u32, y: u32) -> bool
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
fn pixels(&self) -> Pixels<Self>
ⓘImportant traits for MutPixels<'a, I>fn pixels_mut(&mut self) -> MutPixels<Self>
[src]
fn pixels_mut(&mut self) -> MutPixels<Self>
: 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: GenericImage<Pixel = Self::Pixel>,
[src]
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,
[src]
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,