Struct bevy_retrograde::core::image::SubImage [−]
pub struct SubImage<I> { /* fields omitted */ }
Expand description
A View into another image
Instances of this struct can be created using:
GenericImage::sub_image
to create a mutable view,GenericImageView::view
to create an immutable view,SubImage::new
to instantiate the struct directly.
Implementations
impl<I> SubImage<I>
impl<I> SubImage<I>
Construct a new subimage The coordinates set the position of the top left corner of the SubImage.
pub fn change_bounds(&mut self, x: u32, y: u32, width: u32, height: u32)
pub fn change_bounds(&mut self, x: u32, y: u32, width: u32, height: u32)
Change the coordinates of this subimage.
pub fn to_image(
&self
) -> ImageBuffer<<<I as Deref>::Target as GenericImageView>::Pixel, Vec<<<<I as Deref>::Target as GenericImageView>::Pixel as Pixel>::Subpixel, Global>> where
I: Deref,
<I as Deref>::Target: GenericImage,
<I as Deref>::Target: 'static,
pub fn to_image(
&self
) -> ImageBuffer<<<I as Deref>::Target as GenericImageView>::Pixel, Vec<<<<I as Deref>::Target as GenericImageView>::Pixel as Pixel>::Subpixel, Global>> where
I: Deref,
<I as Deref>::Target: GenericImage,
<I as Deref>::Target: 'static,
Convert this subimage to an ImageBuffer
Trait Implementations
impl<I> GenericImage for SubImage<I> where
I: DerefMut,
<I as Deref>::Target: GenericImage,
<I as Deref>::Target: Sized,
impl<I> GenericImage for SubImage<I> where
I: DerefMut,
<I as Deref>::Target: GenericImage,
<I as Deref>::Target: Sized,
pub fn blend_pixel(
&mut self,
x: u32,
y: u32,
pixel: <SubImage<I> as GenericImageView>::Pixel
)
pub 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.
type InnerImage = <I as Deref>::Target
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. Read more
pub fn get_pixel_mut(
&mut self,
x: u32,
y: u32
) -> &mut <SubImage<I> as GenericImageView>::Pixel
pub 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)
. Indexed from top left. Read more
Put a pixel at location (x, y). Indexed from top left. Read more
pub fn sub_image(
&mut self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&mut <SubImage<I> as GenericImage>::InnerImage>
pub 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
The coordinates set the position of the top left corner of the SubImage. Read more
pub fn inner_mut(&mut self) -> &mut <SubImage<I> as GenericImage>::InnerImage
pub fn inner_mut(&mut self) -> &mut <SubImage<I> as GenericImage>::InnerImage
Returns a mutable reference to the underlying image.
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel)
Puts a pixel at location (x, y). Indexed from top left. Read more
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> Result<(), ImageError> where
O: GenericImageView<Pixel = Self::Pixel>,
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
impl<I> GenericImageView for SubImage<I> where
I: Deref,
<I as Deref>::Target: GenericImageView,
<I as Deref>::Target: Sized,
impl<I> GenericImageView for SubImage<I> where
I: Deref,
<I as Deref>::Target: GenericImageView,
<I as Deref>::Target: Sized,
type Pixel = <<I as Deref>::Target as GenericImageView>::Pixel
type Pixel = <<I as Deref>::Target as GenericImageView>::Pixel
The type of pixel.
type InnerImageView = <I as Deref>::Target
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. Read more
pub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
The width and height of this image.
Returns the pixel located at (x, y). Indexed from top left. Read more
pub fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&<SubImage<I> as GenericImageView>::InnerImageView>
pub 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.
The coordinates set the position of the top left corner of the view. Read more
pub fn inner(&self) -> &<SubImage<I> as GenericImageView>::InnerImageView
pub fn inner(&self) -> &<SubImage<I> as GenericImageView>::InnerImageView
Returns a reference to the underlying image.
Returns true if this x, y coordinate is contained inside the image.
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
Returns the pixel located at (x, y). Indexed from top left. Read more
Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value Read more
Auto Trait Implementations
impl<I> RefUnwindSafe for SubImage<I> where
I: RefUnwindSafe,
impl<I> UnwindSafe for SubImage<I> where
I: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V