[][src]Struct image2::ImagePtr

pub struct ImagePtr<'a, T: 'a + Type, C: Color> { /* fields omitted */ }

Image implementation backed by a raw pointer, typically used for storing C pointers allocated using malloc.

Methods

impl<'a, T: 'a + Type, C: Color> ImagePtr<'a, T, C>[src]

pub fn new(width: usize, height: usize, data: *mut T, free: Free<T>) -> Self[src]

Create a new ImagePtr with the given free function used when the image is dropped, if no free function is provided then free from the C stdlib will be used

Trait Implementations

impl<'a, T: Type, C: Color> Image<T, C> for ImagePtr<'a, T, C>[src]

fn buffer(&self) -> &[u8][src]

fn buffer_mut(&self) -> &[u8][src]

fn width(&self) -> usize[src]

fn height(&self) -> usize[src]

fn channels(&self) -> usize[src]

fn len(&self) -> usize[src]

Get the number of total elements in an image

fn total_bytes(&self) -> usize[src]

Get the total number of bytes needed to store the image data

fn index(&self, x: usize, y: usize, c: usize) -> usize[src]

Get the offset of the component at (x, y, c)

fn empty_pixel(&self) -> Vec<T>[src]

Create a new, empty pixel with each component set to 0

fn empty_pixel_f(&self) -> Vec<f64>[src]

Create a new, empty pixel with each component set to 0

fn at_mut(&mut self, x: usize, y: usize) -> &mut [T][src]

Get a vector of mutable references to each component at (x, y)

fn at(&self, x: usize, y: usize) -> &[T][src]

Get a vector of immutable references to each component at (x, y)

fn get_pixel<'a, P: PixelMut<'a, T, C>>(&self, x: usize, y: usize, px: &mut P)[src]

Load data from the pixel at (x, y) into px

fn get_pixel_f<'a, P: PixelMut<'a, f64, C>>(
    &self,
    x: usize,
    y: usize,
    px: &mut P
)
[src]

Load data from the pixel at (x, y) into px and convert to normalized f64

fn set_pixel<'a, P: Pixel<'a, T, C>>(&mut self, x: usize, y: usize, px: &P)[src]

Set data at (x, y) to px

fn set_pixel_f<'a, P: Pixel<'a, f64, C>>(&mut self, x: usize, y: usize, px: &P)[src]

Set data at (x, y) to px after denormalizing

fn get_f(&self, x: usize, y: usize, c: usize) -> f64[src]

Get a single component at (x, y, c) as a noramlized f64 value

fn set_f(&mut self, x: usize, y: usize, c: usize, f: f64)[src]

Set the component at (x, y, c) using a normalized f64 value

fn get(&self, x: usize, y: usize, c: usize) -> T[src]

Get a single component at (x, y, c)

fn set(&mut self, x: usize, y: usize, c: usize, t: T)[src]

Set a single component at (x, y, c)

fn convert_type<U: Type, I: Image<U, C>>(&self, dest: &mut I)[src]

Convert from type T to type U

fn as_image_ref(&mut self) -> ImageRef<T, C>[src]

Convert Image to ImageRef

fn to_image_ptr<'a>(self) -> ImagePtr<'a, T, C>[src]

Consume and convert Image to ImagePtr

fn for_each<F: Sync + Send + Fn((usize, usize), &mut [T])>(&mut self, f: F)[src]

Iterate over each pixel

fn for_each2<F: Sync + Send + Fn((usize, usize), &mut [T], &[T]), I: Image<T, C>>(
    &mut self,
    other: &I,
    f: F
)
[src]

Iterate over each pixel

fn crop(
    &self,
    x: usize,
    y: usize,
    width: usize,
    height: usize
) -> ImageBuf<T, C>
[src]

Create a new image from the region specified by (x, y, width, height)

fn clone(&self) -> ImageBuf<T, C>[src]

fn multiply<'a, P: Pixel<'a, f64, C>>(&mut self, px: &P)[src]

fn add<'a, P: Pixel<'a, f64, C>>(&mut self, px: &P)[src]

fn hash(&self) -> Hash[src]

fn diff<I: Image<T, C>>(&self, other: &I) -> Diff[src]

impl<'a, T: Type, C: Color> Drop for ImagePtr<'a, T, C>[src]

impl<'a, T: PartialEq + 'a + Type, C: PartialEq + Color> PartialEq<ImagePtr<'a, T, C>> for ImagePtr<'a, T, C>[src]

impl<'a, T: Debug + 'a + Type, C: Debug + Color> Debug for ImagePtr<'a, T, C>[src]

Auto Trait Implementations

impl<'a, T, C> Send for ImagePtr<'a, T, C>

impl<'a, T, C> Unpin for ImagePtr<'a, T, C> where
    C: Unpin

impl<'a, T, C> Sync for ImagePtr<'a, T, C>

impl<'a, T, C> !UnwindSafe for ImagePtr<'a, T, C>

impl<'a, T, C> RefUnwindSafe for ImagePtr<'a, T, C> where
    C: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T, U, I> Convert<T, Rgb, U, Rgba> for I where
    I: Image<T, Rgb>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Rgba, U, Rgb> for I where
    I: Image<T, Rgba>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Rgb, U, Gray> for I where
    I: Image<T, Rgb>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Rgba, U, Gray> for I where
    I: Image<T, Rgba>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Gray, U, Rgb> for I where
    I: Image<T, Gray>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Gray, U, Rgba> for I where
    I: Image<T, Gray>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Rgb, U, Bgr> for I where
    I: Image<T, Rgb>,
    T: Type,
    U: Type
[src]

impl<T, U, I> Convert<T, Bgr, U, Rgb> for I where
    I: Image<T, Bgr>,
    T: Type,
    U: Type
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

fn adapt_into(self) -> D[src]

Convert the source color to the destination color using the bradford method by default Read more