[−][src]Enum rin::graphics::image::DynamicImage
A Dynamic Image
Variants
ImageLuma8(ImageBuffer<Luma<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Luma
ImageLumaA8(ImageBuffer<LumaA<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Luma with alpha
ImageRgb8(ImageBuffer<Rgb<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Rgb
ImageRgba8(ImageBuffer<Rgba<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Rgb with alpha
ImageBgr8(ImageBuffer<Bgr<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Bgr
ImageBgra8(ImageBuffer<Bgra<u8>, Vec<u8>>)
Each pixel in this image is 8-bit Bgr with alpha
Methods
impl DynamicImage
[src]
impl DynamicImage
pub fn new_luma8(w: u32, h: u32) -> DynamicImage
[src]
pub fn new_luma8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of grey pixels.
pub fn new_luma_a8(w: u32, h: u32) -> DynamicImage
[src]
pub fn new_luma_a8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of grey pixels with transparency.
pub fn new_rgb8(w: u32, h: u32) -> DynamicImage
[src]
pub fn new_rgb8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of RGB pixels.
pub fn new_rgba8(w: u32, h: u32) -> DynamicImage
[src]
pub fn new_rgba8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of RGBA pixels.
pub fn new_bgra8(w: u32, h: u32) -> DynamicImage
[src]
pub fn new_bgra8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of BGRA pixels.
pub fn new_bgr8(w: u32, h: u32) -> DynamicImage
[src]
pub fn new_bgr8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of BGR pixels.
pub fn to_rgb(&self) -> ImageBuffer<Rgb<u8>, Vec<u8>>
[src]
pub fn to_rgb(&self) -> ImageBuffer<Rgb<u8>, Vec<u8>>
Returns a copy of this image as an RGB image.
pub fn to_rgba(&self) -> ImageBuffer<Rgba<u8>, Vec<u8>>
[src]
pub fn to_rgba(&self) -> ImageBuffer<Rgba<u8>, Vec<u8>>
Returns a copy of this image as an RGBA image.
pub fn to_bgr(&self) -> ImageBuffer<Bgr<u8>, Vec<u8>>
[src]
pub fn to_bgr(&self) -> ImageBuffer<Bgr<u8>, Vec<u8>>
Returns a copy of this image as an BGR image.
pub fn to_bgra(&self) -> ImageBuffer<Bgra<u8>, Vec<u8>>
[src]
pub fn to_bgra(&self) -> ImageBuffer<Bgra<u8>, Vec<u8>>
Returns a copy of this image as an BGRA image.
pub fn to_luma(&self) -> ImageBuffer<Luma<u8>, Vec<u8>>
[src]
pub fn to_luma(&self) -> ImageBuffer<Luma<u8>, Vec<u8>>
Returns a copy of this image as a Luma image.
pub fn to_luma_alpha(&self) -> ImageBuffer<LumaA<u8>, Vec<u8>>
[src]
pub fn to_luma_alpha(&self) -> ImageBuffer<LumaA<u8>, Vec<u8>>
Returns a copy of this image as a LumaA image.
pub fn crop(&mut self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage
[src]
pub fn crop(&mut self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage
Return a cut out of this image delimited by the bounding rectangle.
pub fn as_rgb8(&self) -> Option<&ImageBuffer<Rgb<u8>, Vec<u8>>>
[src]
pub fn as_rgb8(&self) -> Option<&ImageBuffer<Rgb<u8>, Vec<u8>>>
Return a reference to an 8bit RGB image
pub fn as_mut_rgb8(&mut self) -> Option<&mut ImageBuffer<Rgb<u8>, Vec<u8>>>
[src]
pub fn as_mut_rgb8(&mut self) -> Option<&mut ImageBuffer<Rgb<u8>, Vec<u8>>>
Return a mutable reference to an 8bit RGB image
pub fn as_bgr8(&self) -> Option<&ImageBuffer<Bgr<u8>, Vec<u8>>>
[src]
pub fn as_bgr8(&self) -> Option<&ImageBuffer<Bgr<u8>, Vec<u8>>>
Return a reference to an 8bit BGR image
pub fn as_mut_bgr8(&mut self) -> Option<&mut ImageBuffer<Bgr<u8>, Vec<u8>>>
[src]
pub fn as_mut_bgr8(&mut self) -> Option<&mut ImageBuffer<Bgr<u8>, Vec<u8>>>
Return a mutable reference to an 8bit BGR image
pub fn as_rgba8(&self) -> Option<&ImageBuffer<Rgba<u8>, Vec<u8>>>
[src]
pub fn as_rgba8(&self) -> Option<&ImageBuffer<Rgba<u8>, Vec<u8>>>
Return a reference to an 8bit RGBA image
pub fn as_mut_rgba8(&mut self) -> Option<&mut ImageBuffer<Rgba<u8>, Vec<u8>>>
[src]
pub fn as_mut_rgba8(&mut self) -> Option<&mut ImageBuffer<Rgba<u8>, Vec<u8>>>
Return a mutable reference to an 8bit RGBA image
pub fn as_bgra8(&self) -> Option<&ImageBuffer<Bgra<u8>, Vec<u8>>>
[src]
pub fn as_bgra8(&self) -> Option<&ImageBuffer<Bgra<u8>, Vec<u8>>>
Return a reference to an 8bit BGRA image
pub fn as_mut_bgra8(&mut self) -> Option<&mut ImageBuffer<Bgra<u8>, Vec<u8>>>
[src]
pub fn as_mut_bgra8(&mut self) -> Option<&mut ImageBuffer<Bgra<u8>, Vec<u8>>>
Return a mutable reference to an 8bit RGBA image
pub fn as_luma8(&self) -> Option<&ImageBuffer<Luma<u8>, Vec<u8>>>
[src]
pub fn as_luma8(&self) -> Option<&ImageBuffer<Luma<u8>, Vec<u8>>>
Return a reference to an 8bit Grayscale image
pub fn as_mut_luma8(&mut self) -> Option<&mut ImageBuffer<Luma<u8>, Vec<u8>>>
[src]
pub fn as_mut_luma8(&mut self) -> Option<&mut ImageBuffer<Luma<u8>, Vec<u8>>>
Return a mutable reference to an 8bit Grayscale image
pub fn as_luma_alpha8(&self) -> Option<&ImageBuffer<LumaA<u8>, Vec<u8>>>
[src]
pub fn as_luma_alpha8(&self) -> Option<&ImageBuffer<LumaA<u8>, Vec<u8>>>
Return a reference to an 8bit Grayscale image with an alpha channel
pub fn as_mut_luma_alpha8(
&mut self
) -> Option<&mut ImageBuffer<LumaA<u8>, Vec<u8>>>
[src]
pub fn as_mut_luma_alpha8(
&mut self
) -> Option<&mut ImageBuffer<LumaA<u8>, Vec<u8>>>
Return a mutable reference to an 8bit Grayscale image with an alpha channel
pub fn raw_pixels(&self) -> Vec<u8>
[src]
pub fn raw_pixels(&self) -> Vec<u8>
Return this image's pixels as a byte vector.
pub fn color(&self) -> ColorType
[src]
pub fn color(&self) -> ColorType
Return this image's color type.
pub fn grayscale(&self) -> DynamicImage
[src]
pub fn grayscale(&self) -> DynamicImage
Return a grayscale version of this image.
pub fn invert(&mut self)
[src]
pub fn invert(&mut self)
Invert the colors of this image. This method operates inplace.
pub fn resize(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
[src]
pub fn resize(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
Resize this image using the specified filter algorithm.
Returns a new image. The image's aspect ratio is preserved.
The image is scaled to the maximum possible size that fits
within the bounds specified by nwidth
and nheight
.
pub fn resize_exact(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
[src]
pub fn resize_exact(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
Resize this image using the specified filter algorithm.
Returns a new image. Does not preserve aspect ratio.
nwidth
and nheight
are the new image's dimensions
pub fn thumbnail(&self, nwidth: u32, nheight: u32) -> DynamicImage
[src]
pub fn thumbnail(&self, nwidth: u32, nheight: u32) -> DynamicImage
Scale this image down to fit within a specific size.
Returns a new image. The image's aspect ratio is preserved.
The image is scaled to the maximum possible size that fits
within the bounds specified by nwidth
and nheight
.
This method uses a fast integer algorithm where each source pixel contributes to exactly one target pixel. May give aliasing artifacts if new size is close to old size.
pub fn thumbnail_exact(&self, nwidth: u32, nheight: u32) -> DynamicImage
[src]
pub fn thumbnail_exact(&self, nwidth: u32, nheight: u32) -> DynamicImage
Scale this image down to a specific size.
Returns a new image. Does not preserve aspect ratio.
nwidth
and nheight
are the new image's dimensions.
This method uses a fast integer algorithm where each source
pixel contributes to exactly one target pixel.
May give aliasing artifacts if new size is close to old size.
pub fn resize_to_fill(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
[src]
pub fn resize_to_fill(
&self,
nwidth: u32,
nheight: u32,
filter: FilterType
) -> DynamicImage
Resize this image using the specified filter algorithm.
Returns a new image. The image's aspect ratio is preserved.
The image is scaled to the maximum possible size that fits
within the larger (relative to aspect ratio) of the bounds
specified by nwidth
and nheight
, then cropped to
fit within the other bound.
pub fn blur(&self, sigma: f32) -> DynamicImage
[src]
pub fn blur(&self, sigma: f32) -> DynamicImage
Performs a Gaussian blur on this image.
sigma
is a measure of how much to blur by.
pub fn unsharpen(&self, sigma: f32, threshold: i32) -> DynamicImage
[src]
pub fn unsharpen(&self, sigma: f32, threshold: i32) -> DynamicImage
Performs an unsharpen mask on this image.
sigma
is the amount to blur the image by.
threshold
is a control of how much to sharpen.
See https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking
pub fn filter3x3(&self, kernel: &[f32]) -> DynamicImage
[src]
pub fn filter3x3(&self, kernel: &[f32]) -> DynamicImage
Filters this image with the specified 3x3 kernel.
pub fn adjust_contrast(&self, c: f32) -> DynamicImage
[src]
pub fn adjust_contrast(&self, c: f32) -> DynamicImage
Adjust the contrast of this image.
contrast
is the amount to adjust the contrast by.
Negative values decrease the contrast and positive values increase the contrast.
pub fn brighten(&self, value: i32) -> DynamicImage
[src]
pub fn brighten(&self, value: i32) -> DynamicImage
Brighten the pixels of this image.
value
is the amount to brighten each pixel by.
Negative values decrease the brightness and positive values increase it.
pub fn huerotate(&self, value: i32) -> DynamicImage
[src]
pub fn huerotate(&self, value: i32) -> DynamicImage
Hue rotate the supplied image.
value
is the degrees to rotate each pixel by.
0 and 360 do nothing, the rest rotates by the given degree value.
just like the css webkit filter hue-rotate(180)
pub fn flipv(&self) -> DynamicImage
[src]
pub fn flipv(&self) -> DynamicImage
Flip this image vertically
pub fn fliph(&self) -> DynamicImage
[src]
pub fn fliph(&self) -> DynamicImage
Flip this image horizontally
pub fn rotate90(&self) -> DynamicImage
[src]
pub fn rotate90(&self) -> DynamicImage
Rotate this image 90 degrees clockwise.
pub fn rotate180(&self) -> DynamicImage
[src]
pub fn rotate180(&self) -> DynamicImage
Rotate this image 180 degrees clockwise.
pub fn rotate270(&self) -> DynamicImage
[src]
pub fn rotate270(&self) -> DynamicImage
Rotate this image 270 degrees clockwise.
pub fn write_to<W, F>(&self, w: &mut W, format: F) -> Result<(), ImageError> where
F: Into<ImageOutputFormat>,
W: Write,
[src]
pub fn write_to<W, F>(&self, w: &mut W, format: F) -> Result<(), ImageError> where
F: Into<ImageOutputFormat>,
W: Write,
Encode this image and write it to w
pub fn save<Q>(&self, path: Q) -> Result<(), Error> where
Q: AsRef<Path>,
[src]
pub fn save<Q>(&self, path: Q) -> Result<(), Error> where
Q: AsRef<Path>,
Saves the buffer to a file at the path specified.
The image format is derived from the file extension.
Trait Implementations
impl Image for DynamicImage
[src]
impl Image for DynamicImage
type DataType = u8
fn gl_internal_format_type(&self) -> Option<(u32, u32, u32)>
[src]
fn gl_internal_format_type(&self) -> Option<(u32, u32, u32)>
fn num_components(&self) -> usize
[src]
fn num_components(&self) -> usize
fn width(&self, _level: usize) -> usize
[src]
fn width(&self, _level: usize) -> usize
fn height(&self, _level: usize) -> usize
[src]
fn height(&self, _level: usize) -> usize
fn pitch_bytes(&self, _level: usize) -> usize
[src]
fn pitch_bytes(&self, _level: usize) -> usize
fn bytes_per_pixel(&self) -> usize
[src]
fn bytes_per_pixel(&self) -> usize
fn pitch_components(&self, _level: usize) -> usize
[src]
fn pitch_components(&self, _level: usize) -> usize
fn data(&self) -> &[u8]
[src]
fn data(&self) -> &[u8]
fn levels(&self) -> usize
[src]
fn levels(&self) -> usize
fn mipmap(&self, level: usize) -> Option<&[u8]>
[src]
fn mipmap(&self, level: usize) -> Option<&[u8]>
fn is_gpu_compressed(&self) -> bool
[src]
fn is_gpu_compressed(&self) -> bool
fn gl_internal(&self) -> Option<u32>
[src]
fn gl_internal(&self) -> Option<u32>
fn gl_format(&self) -> Option<u32>
[src]
fn gl_format(&self) -> Option<u32>
fn gl_type(&self) -> Option<u32>
[src]
fn gl_type(&self) -> Option<u32>
fn max_levels(&self) -> usize
[src]
fn max_levels(&self) -> usize
impl GenericImageView for DynamicImage
[src]
impl GenericImageView for DynamicImage
type Pixel = Rgba<u8>
The type of pixel.
type InnerImageView = DynamicImage
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
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 inner(&self) -> &<DynamicImage as GenericImageView>::InnerImageView
[src]
fn inner(&self) -> &<DynamicImage as GenericImageView>::InnerImageView
fn width(&self) -> u32
[src]
fn width(&self) -> u32
The width of this image.
fn height(&self) -> u32
[src]
fn height(&self) -> u32
The height of this image.
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
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
[src]
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
Returns the pixel located at (x, y) Read more
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
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 Read more
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
[src]
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
Returns an subimage that is an immutable view into this image.
impl Clone for DynamicImage
[src]
impl Clone for DynamicImage
fn clone(&self) -> DynamicImage
[src]
fn clone(&self) -> DynamicImage
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl GenericImage for DynamicImage
[src]
impl GenericImage for DynamicImage
type InnerImage = DynamicImage
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
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 inner_mut(&mut self) -> &mut <DynamicImage as GenericImage>::InnerImage
[src]
fn inner_mut(&mut self) -> &mut <DynamicImage as GenericImage>::InnerImage
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)
Puts a pixel at location (x, y) Read more
ⓘ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.
Returns an Iterator over mutable pixels of this image. The iterator yields the coordinates of each pixel along with a mutable reference to them. Read more
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> bool where
O: GenericImageView<Pixel = Self::Pixel>,
[src]
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. Read more
fn sub_image(
&mut self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&mut Self::InnerImage>
[src]
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.
Auto Trait Implementations
impl Send for DynamicImage
impl Send for DynamicImage
impl Sync for DynamicImage
impl Sync for DynamicImage
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: Any,
[src]
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> SetParameter for T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<V> IntoVec for V
[src]
impl<V> IntoVec for V
impl<V> IntoPnt for V
[src]
impl<V> IntoPnt for V
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
[src]
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
[src]
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
[src]
fn from_subset(element: &SS) -> SP
impl<T> Same for T
[src]
impl<T> Same for T
type Output = T
Should always be Self