Struct simple_frame::SimpleFrame

source ·
pub struct SimpleFrame<F> {
    pub width: u32,
    pub height: u32,
    pub stride: u32,
    pub fmt: PhantomData<F>,
    /* private fields */
}

Fields§

§width: u32

width in pixels

§height: u32

height in pixels

§stride: u32

number of bytes in an image row

§fmt: PhantomData<F>

format of the data

Implementations§

source§

impl<F> SimpleFrame<F>
where F: PixelFormat,

source

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

Move a Vec<u8> buffer as the backing store for a SimpleFrame 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: u32) -> Option<Self>

Allocate minimium size buffer for image and fill with zeros

source§

impl<F> SimpleFrame<F>

source

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

Trait Implementations§

source§

impl<F: Clone> Clone for SimpleFrame<F>

source§

fn clone(&self) -> SimpleFrame<F>

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> Debug for SimpleFrame<F>

source§

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

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

impl<FRAME, FMT> From<Box<FRAME>> for SimpleFrame<FMT>
where FRAME: OwnedImageStride<FMT>, Vec<u8>: From<Box<FRAME>>,

source§

fn from(frame: Box<FRAME>) -> SimpleFrame<FMT>

Converts to this type from the input type.
source§

impl<F> From<SimpleFrame<F>> for Vec<u8>

source§

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

Converts to this type from the input type.
source§

impl<F> ImageData<F> for SimpleFrame<F>

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<'_, F>

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

fn buffer(self) -> ImageBuffer<F>

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<F> ImageMutData<F> for SimpleFrame<F>

source§

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

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

impl<F> Stride for SimpleFrame<F>

source§

fn stride(&self) -> usize

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

Auto Trait Implementations§

§

impl<F> Freeze for SimpleFrame<F>

§

impl<F> RefUnwindSafe for SimpleFrame<F>
where F: RefUnwindSafe,

§

impl<F> Send for SimpleFrame<F>
where F: Send,

§

impl<F> Sync for SimpleFrame<F>
where F: Sync,

§

impl<F> Unpin for SimpleFrame<F>
where F: Unpin,

§

impl<F> UnwindSafe for SimpleFrame<F>
where F: 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> 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> 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.
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>,