[−][src]Struct ffimage::packed::image::generic::GenericFlatBuffer
Implementations
impl<'a, T: Pixel> GenericFlatBuffer<'a, T>
[src]
pub fn new(raw: &'a mut [T::T], width: u32, height: u32) -> Option<Self>
[src]
Returns a flat image buffer with pixel accessors
'Flat' means that the backing memory of the image is not allocated by the struct. Thus, this struct allows for reusing existing (mutable) buffers and still having images defined by their pixel types.
Arguments
raw
- Raw memory regionwidth
- Width in pixelsheight
- Height in pixels
Example
use ffimage::color::rgb::*; use ffimage::core::ImageBuffer; use ffimage::packed::GenericImageFlatBuffer; let mut mem = vec![0; 3]; let mut buf = GenericImageFlatBuffer::<Rgb<u8>>::new(&mut mem, 1, 1) .expect("Memory region too small"); let pix = Rgb::<u8>::new([255, 255, 255]); buf.set_pixel(0, 0, &pix).unwrap();
pub fn raw(&self) -> &[T::T]
[src]
pub fn raw_mut(&mut self) -> &mut [T::T]
[src]
Trait Implementations
impl<'a, T: Pixel> AccessPixel for GenericFlatBuffer<'a, T>
[src]
type PixelType = T
fn pixel_row(&self, y: u32) -> Option<&[Self::PixelType]>
[src]
fn pixel(&self, x: u32, y: u32) -> Option<&Self::PixelType>
[src]
impl<'a, T: Pixel> AccessPixelMut for GenericFlatBuffer<'a, T>
[src]
type PixelType = T
fn pixel_row_mut(&mut self, y: u32) -> Option<&mut [Self::PixelType]>
[src]
fn pixel_mut(&mut self, x: u32, y: u32) -> Option<&mut Self::PixelType>
[src]
impl<'a, T: Pixel> CloneImage for GenericFlatBuffer<'a, T>
[src]
type Output = GenericBuffer<T>
fn clone_into(&self, output: &mut Self::Output)
[src]
fn clone(&self) -> Self::Output
[src]
impl<'a, SP, DP> Convert<GenericBuffer<DP>> for GenericFlatBuffer<'a, SP> where
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
[src]
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
fn convert(&self, output: &mut GenericBuffer<DP>)
[src]
impl<'a, T: Pixel> ImageBuffer for GenericFlatBuffer<'a, T>
[src]
impl<'a, T: Pixel> ImageView for GenericFlatBuffer<'a, T>
[src]
type T = T
Pixel type
fn width(&self) -> u32
[src]
fn height(&self) -> u32
[src]
fn stride(&self) -> usize
[src]
fn get_pixel(&self, x: u32, y: u32) -> Option<Self::T>
[src]
impl<'a, T: Pixel> IntoIterator for &'a GenericFlatBuffer<'a, T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = PixelIter<'a, GenericFlatBuffer<'a, T>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: Pixel> IntoIterator for &'a mut GenericFlatBuffer<'a, T>
[src]
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = PixelIterMut<'a, GenericFlatBuffer<'a, T>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, 'b, SP, DP> TryConvert<GenericFlatBuffer<'b, DP>> for GenericView<'a, SP> where
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
[src]
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
type Error = ()
fn try_convert(
&self,
output: &mut GenericFlatBuffer<'b, DP>
) -> Result<(), Self::Error>
[src]
&self,
output: &mut GenericFlatBuffer<'b, DP>
) -> Result<(), Self::Error>
impl<'a, 'b, SP, DP> TryConvert<GenericFlatBuffer<'b, DP>> for GenericFlatBuffer<'a, SP> where
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
[src]
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
type Error = ()
fn try_convert(
&self,
output: &mut GenericFlatBuffer<'b, DP>
) -> Result<(), Self::Error>
[src]
&self,
output: &mut GenericFlatBuffer<'b, DP>
) -> Result<(), Self::Error>
impl<'b, SP, DP> TryConvert<GenericFlatBuffer<'b, DP>> for GenericBuffer<SP> where
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
[src]
SP: Pixel,
DP: Pixel,
[SP]: TryConvertSlice<DP>,
type Error = ()
fn try_convert(
&self,
output: &mut GenericFlatBuffer<'b, DP>
) -> Result<(), Self::Error>
[src]
&self,
output: &mut GenericFlatBuffer<'b, DP>
) -> Result<(), Self::Error>
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for GenericFlatBuffer<'a, T> where
<T as Pixel>::T: RefUnwindSafe,
<T as Pixel>::T: RefUnwindSafe,
impl<'a, T> Send for GenericFlatBuffer<'a, T> where
<T as Pixel>::T: Send,
<T as Pixel>::T: Send,
impl<'a, T> Sync for GenericFlatBuffer<'a, T> where
<T as Pixel>::T: Sync,
<T as Pixel>::T: Sync,
impl<'a, T> Unpin for GenericFlatBuffer<'a, T>
impl<'a, T> !UnwindSafe for GenericFlatBuffer<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<B, V> TryConvert<B> for V where
B: ImageBuffer + Resize,
V: ImageView + Convert<B>,
[src]
B: ImageBuffer + Resize,
V: ImageView + Convert<B>,
type Error = ()
fn try_convert(&Self, &mut B) -> Result<(), <V as TryConvert<B>>::Error>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,