pub struct ImageView<'a, P>
where P: PixelExt,
{ /* private fields */ }
Expand description

Generic immutable image view.

Implementations§

source§

impl<'a, P> ImageView<'a, P>
where P: PixelExt,

source

pub fn new( width: NonZeroU32, height: NonZeroU32, rows: Vec<&'a [P]> ) -> Result<Self, ImageRowsError>

source

pub fn from_buffer( width: NonZeroU32, height: NonZeroU32, buffer: &'a [u8] ) -> Result<Self, ImageBufferError>

source

pub fn from_pixels( width: NonZeroU32, height: NonZeroU32, pixels: &'a [P] ) -> Result<Self, ImageBufferError>

source

pub fn pixel_type(&self) -> PixelType

source

pub fn width(&self) -> NonZeroU32

source

pub fn height(&self) -> NonZeroU32

source

pub fn crop_box(&self) -> CropBox

source

pub fn set_crop_box(&mut self, crop_box: CropBox) -> Result<(), CropBoxError>

source

pub fn set_crop_box_to_fit_dst_size( &mut self, dst_width: NonZeroU32, dst_height: NonZeroU32, centering: Option<(f64, f64)> )

Set a crop box to resize the source image into the aspect ratio of destination image without distortions.

centering used to control the cropping position. Use (0.5, 0.5) for center cropping (e.g. if cropping the width, take 50% off of the left side, and therefore 50% off the right side). (0.0, 0.0) will crop from the top left corner (i.e. if cropping the width, take all the crop off of the right side, and if cropping the height, take all of it off the bottom). (1.0, 0.0) will crop from the bottom left corner, etc. (i.e. if cropping the width, take all the crop off the left side, and if cropping the height take none from the top, and therefore all off the bottom).

Trait Implementations§

source§

impl<'a, P> Clone for ImageView<'a, P>
where P: PixelExt + Clone,

source§

fn clone(&self) -> ImageView<'a, P>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, P> Debug for ImageView<'a, P>
where P: PixelExt + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<ImageView<'a, Pixel<[u16; 2], u16, 2>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U16x2>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<[u16; 3], u16, 3>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U16x3>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<[u16; 4], u16, 4>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U16x4>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<[u8; 3], u8, 3>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U8x3>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<[u8; 4], u8, 4>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U8x4>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<f32, f32, 1>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, F32>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<i32, i32, 1>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, I32>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<u16, u16, 1>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U16>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<u16, u8, 2>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U8x2>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ImageView<'a, Pixel<u8, u8, 1>>> for DynamicImageView<'a>

source§

fn from(view: ImageView<'a, U8>) -> Self

Converts to this type from the input type.
source§

impl<'a, P> From<ImageViewMut<'a, P>> for ImageView<'a, P>
where P: PixelExt,

source§

fn from(view: ImageViewMut<'a, P>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, P> RefUnwindSafe for ImageView<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> Send for ImageView<'a, P>
where P: Sync,

§

impl<'a, P> Sync for ImageView<'a, P>
where P: Sync,

§

impl<'a, P> Unpin for ImageView<'a, P>

§

impl<'a, P> UnwindSafe for ImageView<'a, P>
where P: RefUnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.