SubImage

Struct SubImage 

Source
pub struct SubImage<I> { /* private fields */ }
Expand description

A View into another image

Instances of this struct can be created using:

Implementations§

Source§

impl<I> SubImage<I>

Source

pub fn new(image: I, x: u32, y: u32, width: u32, height: u32) -> SubImage<I>

Construct a new subimage

Source

pub fn change_bounds(&mut self, x: u32, y: u32, width: u32, height: u32)

Change the coordinates of this subimage.

Source

pub fn to_image( &self, ) -> ImageBuffer<<<I as Deref>::Target as GenericImageView>::Pixel, Vec<<<<I as Deref>::Target as GenericImageView>::Pixel as Pixel>::Subpixel>>
where I: Deref, <I as Deref>::Target: GenericImage + 'static,

Convert this subimage to an ImageBuffer

Trait Implementations§

Source§

impl<I> GenericImage for SubImage<I>
where I: DerefMut, <I as Deref>::Target: Sized + GenericImage,

Source§

fn blend_pixel( &mut self, x: u32, y: u32, pixel: <SubImage<I> as GenericImageView>::Pixel, )

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

Source§

type InnerImage = <I as Deref>::Target

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.
Source§

fn get_pixel_mut( &mut self, x: u32, y: u32, ) -> &mut <SubImage<I> as GenericImageView>::Pixel

Gets a reference to the mutable pixel at location (x, y) Read more
Source§

fn put_pixel( &mut self, x: u32, y: u32, pixel: <SubImage<I> as GenericImageView>::Pixel, )

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

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

Returns a mutable subimage that is a view into this image. If you want an immutable subimage instead, use GenericImageView::view
Source§

fn inner_mut(&mut self) -> &mut <SubImage<I> as GenericImage>::InnerImage

Returns a mutable reference to the underlying image.
Source§

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

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

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

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

fn copy_within(&mut self, source: Rect, x: u32, y: u32) -> bool

Copies all of the pixels from one part of this image to another part of this image. Read more
Source§

impl<I> GenericImageView for SubImage<I>
where I: Deref, <I as Deref>::Target: Sized + GenericImageView,

Source§

type Pixel = <<I as Deref>::Target as GenericImageView>::Pixel

The type of pixel.
Source§

type InnerImageView = <I as Deref>::Target

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.
Source§

fn dimensions(&self) -> (u32, u32)

The width and height of this image.
Source§

fn bounds(&self) -> (u32, u32, u32, u32)

The bounding rectangle of this image.
Source§

fn get_pixel(&self, x: u32, y: u32) -> <SubImage<I> as GenericImageView>::Pixel

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

fn view( &self, x: u32, y: u32, width: u32, height: u32, ) -> SubImage<&<SubImage<I> as GenericImageView>::InnerImageView>

Returns an subimage that is an immutable view into this image. You can use GenericImage::sub_image if you need a mutable view instead.
Source§

fn inner(&self) -> &<SubImage<I> as GenericImageView>::InnerImageView

Returns a reference to the underlying image.
Source§

fn width(&self) -> u32

The width of this image.
Source§

fn height(&self) -> u32

The height of this image.
Source§

fn in_bounds(&self, x: u32, y: u32) -> bool

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

unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel

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

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

Auto Trait Implementations§

§

impl<I> Freeze for SubImage<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for SubImage<I>
where I: RefUnwindSafe,

§

impl<I> Send for SubImage<I>
where I: Send,

§

impl<I> Sync for SubImage<I>
where I: Sync,

§

impl<I> Unpin for SubImage<I>
where I: Unpin,

§

impl<I> UnwindSafe for SubImage<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V