Enum image::DynamicImage
[−]
[src]
pub enum DynamicImage { ImageLuma8(GrayImage), ImageLumaA8(GrayAlphaImage), ImageRgb8(RgbImage), ImageRgba8(RgbaImage), }
A Dynamic Image
Variants
ImageLuma8 | Each pixel in this image is 8-bit Luma | |
ImageLumaA8 | Each pixel in this image is 8-bit Luma with alpha | |
ImageRgb8 | Each pixel in this image is 8-bit Rgb | |
ImageRgba8 | Each pixel in this image is 8-bit Rgb with alpha |
Methods
impl DynamicImage
fn new_luma8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of grey pixels.
fn new_luma_a8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of grey pixels with transparency.
fn new_rgb8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of RGB pixels.
fn new_rgba8(w: u32, h: u32) -> DynamicImage
Creates a dynamic image backed by a buffer of RGBA pixels.
fn to_rgb(&self) -> RgbImage
Returns a copy of this image as an RGB image.
fn to_rgba(&self) -> RgbaImage
Returns a copy of this image as an RGBA image.
fn to_luma(&self) -> GrayImage
Returns a copy of this image as a Luma image.
fn to_luma_alpha(&self) -> GrayAlphaImage
Returns a copy of this image as a LumaA image.
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.
fn as_rgb8(&self) -> Option<&RgbImage>
Return a reference to an 8bit RGB image
fn as_mut_rgb8(&mut self) -> Option<&mut RgbImage>
Return a mutable reference to an 8bit RGB image
fn as_rgba8(&self) -> Option<&RgbaImage>
Return a reference to an 8bit RGBA image
fn as_mut_rgba8(&mut self) -> Option<&mut RgbaImage>
Return a mutable reference to an 8bit RGBA image
fn as_luma8(&self) -> Option<&GrayImage>
Return a reference to an 8bit Grayscale image
fn as_mut_luma8(&mut self) -> Option<&mut GrayImage>
Return a mutable reference to an 8bit Grayscale image
fn as_luma_alpha8(&self) -> Option<&GrayAlphaImage>
Return a reference to an 8bit Grayscale image with an alpha channel
fn as_mut_luma_alpha8(&mut self) -> Option<&mut GrayAlphaImage>
Return a mutable reference to an 8bit Grayscale image with an alpha channel
fn raw_pixels(&self) -> Vec<u8>
Return this image's pixels as a byte vector.
fn color(&self) -> ColorType
Return this image's color type.
fn grayscale(&self) -> DynamicImage
Return a grayscale version of this image.
fn invert(&mut self)
Invert the colors of this image. This method operates inplace.
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.
nwidth
and nheight
are the new image's dimensions
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
fn blur(&self, sigma: f32) -> DynamicImage
Performs a Gaussian blur on this image.
sigma
is a measure of how much to blur by.
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
fn filter3x3(&self, kernel: &[f32]) -> DynamicImage
Filters this image with the specified 3x3 kernel.
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.
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.
fn flipv(&self) -> DynamicImage
Flip this image vertically
fn fliph(&self) -> DynamicImage
Flip this image horizontally
fn rotate90(&self) -> DynamicImage
Rotate this image 90 degrees clockwise.
fn rotate180(&self) -> DynamicImage
Rotate this image 180 degrees clockwise.
fn rotate270(&self) -> DynamicImage
Rotate this image 270 degrees clockwise.
fn save<W: Write>(&self, w: &mut W, format: ImageFormat) -> ImageResult<()>
Encode this image and write it to w
Trait Implementations
impl GenericImage for DynamicImage
type Pixel = Rgba<u8>
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
fn put_pixel(&mut self, x: u32, y: u32, pixel: Rgba<u8>)
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>
DEPRECATED: Do not use is function: It is unimplemented!