Struct native_windows_gui::ImageData
source · [−]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
sourceimpl 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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ImageData
impl !Send for ImageData
impl !Sync for ImageData
impl Unpin for ImageData
impl UnwindSafe for ImageData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more