Struct fast_image_resize::ImageView
source · 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,
impl<'a, P> ImageView<'a, P>where
P: PixelExt,
pub fn new( width: NonZeroU32, height: NonZeroU32, rows: Vec<&'a [P]> ) -> Result<Self, ImageRowsError>
pub fn from_buffer( width: NonZeroU32, height: NonZeroU32, buffer: &'a [u8] ) -> Result<Self, ImageBufferError>
pub fn from_pixels( width: NonZeroU32, height: NonZeroU32, pixels: &'a [P] ) -> Result<Self, ImageBufferError>
pub fn pixel_type(&self) -> PixelType
pub fn width(&self) -> NonZeroU32
pub fn height(&self) -> NonZeroU32
pub fn crop_box(&self) -> CropBox
pub fn set_crop_box(&mut self, crop_box: CropBox) -> Result<(), CropBoxError>
sourcepub fn set_crop_box_to_fit_dst_size(
&mut self,
dst_width: NonZeroU32,
dst_height: NonZeroU32,
centering: Option<(f64, f64)>
)
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> From<ImageViewMut<'a, P>> for ImageView<'a, P>where
P: PixelExt,
impl<'a, P> From<ImageViewMut<'a, P>> for ImageView<'a, P>where
P: PixelExt,
source§fn from(view: ImageViewMut<'a, P>) -> Self
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more