[][src]Struct native_windows_gui::ImageData

pub struct ImageData {
    pub frame: *mut IWICBitmapSource,
}

Represents a source of pixel that can be read, but cannot be written back to.

Fields

frame: *mut IWICBitmapSource

Implementations

impl ImageData[src]

pub fn resolution(&self) -> (f64, f64)[src]

Retrieves the sampling rate between pixels and physical world measurements.

pub fn size(&self) -> (u32, u32)[src]

Retrieves the pixel width and height of the bitmap.

pub fn pixel_format(&self) -> WICPixelFormatGUID[src]

pub fn pixels(&self, pixel_size: u32) -> Result<Vec<u8>, NwgError>[src]

Copy the frame pixels into a buffer.

Parameters: pixel_size: defines the size of a pixel in bytes. In a typical RGBA image, this would be 4 (1 byte for each component). If unsure, use the pixel_format.

May return an error if the pixel data could not be read

pub fn region_pixels(
    &self,
    offset: [i32; 2],
    size: [i32; 2],
    pixel_size: u32
) -> Result<Vec<u8>, NwgError>
[src]

Copy a region of the frames pixel into a buffer.

Parameters: offset: The [x,y] offset at which the region begins size: The [width, height] size of the region pixel_size: defines the size of a pixel in bytes. In a typical RGBA image, this would be 4 (1 byte for each component). If unsure, use the pixel_format.

May return an error if the pixel data could not be read

pub fn as_bitmap(&self) -> Result<Bitmap, NwgError>[src]

Create a bitmap resource the the image data. This resource can then be used in the other NWG component. The bitmap returned is considered "owned".

Trait Implementations

impl Drop for ImageData[src]

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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.