pub struct ImageData {
pub frame: *mut IWICBitmapSource,
}
Expand description
Represents a source of pixel that can be read, but cannot be written back to.
Fields§
§frame: *mut IWICBitmapSource
Implementations§
Source§impl ImageData
impl ImageData
Sourcepub fn resolution(&self) -> (f64, f64)
pub fn resolution(&self) -> (f64, f64)
Retrieves the sampling rate between pixels and physical world measurements.
pub fn pixel_format(&self) -> WICPixelFormatGUID
Sourcepub fn pixels(&self, pixel_size: u32) -> Result<Vec<u8>, NwgError>
pub fn pixels(&self, pixel_size: u32) -> Result<Vec<u8>, NwgError>
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
Sourcepub fn region_pixels(
&self,
offset: [i32; 2],
size: [i32; 2],
pixel_size: u32,
) -> Result<Vec<u8>, NwgError>
pub fn region_pixels( &self, offset: [i32; 2], size: [i32; 2], pixel_size: u32, ) -> Result<Vec<u8>, NwgError>
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