pub struct MaaImageBuffer { /* private fields */ }Expand description
Image buffer for storing and manipulating image data.
Supports raw BGR data and encoded formats (PNG/JPEG). Compatible with OpenCV image types.
Implementations§
Source§impl MaaImageBuffer
impl MaaImageBuffer
Sourcepub unsafe fn from_raw(handle: *mut MaaImageBuffer) -> Self
pub unsafe fn from_raw(handle: *mut MaaImageBuffer) -> Self
Create from an existing handle.
§Safety
This function assumes the handle is valid. The returned buffer will NOT take ownership of the handle (it won’t be destroyed on drop). Use this when you are borrowing a handle from the C API.
Sourcepub fn from_handle(handle: *mut MaaImageBuffer) -> Option<Self>
pub fn from_handle(handle: *mut MaaImageBuffer) -> Option<Self>
Create from an existing handle safely (checks for null).
Returns None if handle is null.
Sourcepub fn as_ptr(&self) -> *mut MaaImageBuffer
pub fn as_ptr(&self) -> *mut MaaImageBuffer
Get the underlying raw handle.
Sourcepub fn raw(&self) -> *mut MaaImageBuffer
pub fn raw(&self) -> *mut MaaImageBuffer
Get the underlying raw handle (alias for as_ptr).
Source§impl MaaImageBuffer
impl MaaImageBuffer
Sourcepub fn image_type(&self) -> i32
pub fn image_type(&self) -> i32
Get the OpenCV image type constant.
Sourcepub fn to_vec(&self) -> Option<Vec<u8>>
pub fn to_vec(&self) -> Option<Vec<u8>>
Get the encoded image data as a byte vector (PNG format).
Sourcepub fn set_raw_data(
&mut self,
data: &[u8],
width: i32,
height: i32,
img_type: i32,
) -> MaaResult<()>
pub fn set_raw_data( &mut self, data: &[u8], width: i32, height: i32, img_type: i32, ) -> MaaResult<()>
Set the image from raw BGR data.
Sourcepub fn set(&mut self, data: &[u8], width: i32, height: i32) -> MaaResult<()>
pub fn set(&mut self, data: &[u8], width: i32, height: i32) -> MaaResult<()>
Set the image from raw BGR data (assuming 3 channels, CV_8UC3).
Sourcepub fn set_encoded(&mut self, data: &[u8]) -> MaaResult<()>
pub fn set_encoded(&mut self, data: &[u8]) -> MaaResult<()>
Set the image from encoded data (PNG/JPEG).