Struct OImage

Source
pub struct OImage<FMT: PixelFormat> { /* private fields */ }
Expand description

An owned image buffer with strided pixel format FMT.

Implementations§

Source§

impl<FMT: PixelFormat> OImage<FMT>

Source

pub fn new(width: u32, height: u32, stride: usize, buf: Vec<u8>) -> Option<Self>

Move a Vec<u8> buffer as the backing store for an ImageStruct for image.

Returns None if the buffer is not large enough to store an image of the desired properties.

Source

pub fn zeros(width: u32, height: u32, stride: usize) -> Option<Self>

Allocate minimum size buffer for image and fill with zeros

Source

pub fn from_owned(orig: impl OwnedImageStride<FMT>) -> Self

Source§

impl<F: PixelFormat> OImage<F>

Source

pub fn copy_from<FRAME: ImageStride<F>>(frame: &FRAME) -> OImage<F>

Trait Implementations§

Source§

impl<FMT: Clone + PixelFormat> Clone for OImage<FMT>

Source§

fn clone(&self) -> OImage<FMT>

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<F: PixelFormat> Debug for OImage<F>

Source§

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

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

impl<'a, F: PixelFormat> From<OImage<F>> for CowImage<'a, F>

Source§

fn from(frame: OImage<F>) -> CowImage<'a, F>

Creates a CowImage::Owned from an OImage.

§Examples
let owned_image = OImage::<Mono8>::new(20, 15, 20, vec![128u8; 300]).unwrap();
let cow_image = CowImage::from(owned_image);
Source§

impl<F: PixelFormat> From<OImage<F>> for Vec<u8>

Source§

fn from(orig: OImage<F>) -> Vec<u8>

Converts to this type from the input type.
Source§

impl<FMT: PixelFormat> ImageData<FMT> for OImage<FMT>

Source§

fn width(&self) -> u32

Number of pixel columns in the image. Note: this is not the stride.
Source§

fn height(&self) -> u32

Number of pixel rows in the image.
Source§

fn buffer_ref(&self) -> ImageBufferRef<'_, FMT>

Returns the image buffer specified by pixel format F. Read more
Source§

fn buffer(self) -> ImageBuffer<FMT>

Returns the image buffer specified by pixel format F. Read more
Source§

fn image_data(&self) -> &[u8]

Returns the raw image data as specified by pixel format F. Read more
Source§

impl<FMT: PixelFormat> ImageMutData<FMT> for OImage<FMT>

Source§

fn buffer_mut_ref(&mut self) -> ImageBufferMutRef<'_, FMT>

Returns the image mutable buffer specified by pixel format F. Read more
Source§

impl<FMT: PixelFormat> Stride for OImage<FMT>

Source§

fn stride(&self) -> usize

the width (in bytes) of each row of image data Read more

Auto Trait Implementations§

§

impl<FMT> Freeze for OImage<FMT>

§

impl<FMT> RefUnwindSafe for OImage<FMT>
where FMT: RefUnwindSafe,

§

impl<FMT> Send for OImage<FMT>
where FMT: Send,

§

impl<FMT> Sync for OImage<FMT>
where FMT: Sync,

§

impl<FMT> Unpin for OImage<FMT>
where FMT: Unpin,

§

impl<FMT> UnwindSafe for OImage<FMT>
where FMT: UnwindSafe,

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<S, F> AsImageData<F> for S
where S: ImageData<F>,

Source§

fn as_image_data(&self) -> &dyn ImageData<F>

Source§

impl<S, F> AsImageMutStride<F> for S
where S: ImageMutStride<F>,

Source§

impl<S, F> AsImageStride<F> for S
where S: ImageStride<F>,

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S, F> HasRowChunksExact<F> for S
where S: ImageStride<F>, F: PixelFormat,

Source§

impl<S, F> HasRowChunksExactMut<F> for S
where S: ImageMutStride<F>, F: PixelFormat,

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,

Source§

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

Source§

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

Source§

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.
Source§

impl<S, F> ImageMutStride<F> for S
where S: ImageMutData<F> + Stride,

Source§

impl<S, F> ImageStride<F> for S
where S: ImageData<F> + Stride,

Source§

impl<S, F> OwnedImage<F> for S
where S: AsImageData<F> + ImageData<F>, Vec<u8>: From<S>,

Source§

impl<S, F> OwnedImageStride<F> for S
where S: AsImageStride<F> + ImageStride<F>, Vec<u8>: From<S>,