pub struct UnimageProcessor { /* private fields */ }
Expand description
A image processor. it can load image, resize it or clip it.
Implementations§
Source§impl UnimageProcessor
impl UnimageProcessor
Sourcepub fn new() -> UnimageProcessor
pub fn new() -> UnimageProcessor
Create a UnimageProcessor instance.
Sourcepub unsafe fn get_instance(&self) -> *mut c_void
pub unsafe fn get_instance(&self) -> *mut c_void
Get the instance pointer
Sourcepub fn load_raw(
&mut self,
data: *mut u8,
width: i32,
height: i32,
format: UnimageFormat,
)
pub fn load_raw( &mut self, data: *mut u8, width: i32, height: i32, format: UnimageFormat, )
Load pixels from a pointer.
Sourcepub fn load_raw_from_vec(
&mut self,
data: &mut Vec<u8>,
width: i32,
height: i32,
format: UnimageFormat,
)
pub fn load_raw_from_vec( &mut self, data: &mut Vec<u8>, width: i32, height: i32, format: UnimageFormat, )
Load pixels from a Vec<u8>
.
Sourcepub fn load_raw_from_slice(
&mut self,
data: &mut [u8],
width: i32,
height: i32,
format: UnimageFormat,
)
pub fn load_raw_from_slice( &mut self, data: &mut [u8], width: i32, height: i32, format: UnimageFormat, )
Load pixels from a Slice.
Sourcepub fn load(&mut self, data: *mut u8, len: u32) -> Result<(), UnimageError>
pub fn load(&mut self, data: *mut u8, len: u32) -> Result<(), UnimageError>
Load an image from data, if there is something wrong, it will return an error.
Sourcepub fn load_from_vec(&mut self, data: &mut Vec<u8>) -> Result<(), UnimageError>
pub fn load_from_vec(&mut self, data: &mut Vec<u8>) -> Result<(), UnimageError>
Load an image from data, if there is something wrong, it will return an error.
Sourcepub fn load_from_slice(&mut self, data: &mut [u8]) -> Result<(), UnimageError>
pub fn load_from_slice(&mut self, data: &mut [u8]) -> Result<(), UnimageError>
Load an image from data, if there is something wrong, it will return an error.
Sourcepub fn get_height(&self) -> i32
pub fn get_height(&self) -> i32
Get the height of image.
Sourcepub fn get_format(&self) -> UnimageFormat
pub fn get_format(&self) -> UnimageFormat
Get the pixel format of image.
Sourcepub fn get_error_message(&self) -> String
pub fn get_error_message(&self) -> String
Get the last error message.
Sourcepub fn resize(&mut self, width: i32, height: i32) -> Result<(), UnimageError>
pub fn resize(&mut self, width: i32, height: i32) -> Result<(), UnimageError>
Resize the image.
Sourcepub unsafe fn get_buffer_as_mut(&mut self) -> *mut u8
pub unsafe fn get_buffer_as_mut(&mut self) -> *mut u8
Get the buffer of processor, it will return a pointer that points to pixels data. If it doesn’t load any image, it will return a nullptr.
Sourcepub unsafe fn get_buffer(&self) -> *const u8
pub unsafe fn get_buffer(&self) -> *const u8
Get the buffer of processor, it will return a pointer that points to pixels data. If it doesn’t load any image, it will return a nullptr.
Sourcepub fn try_clone(&self) -> Result<Self, UnimageError>
pub fn try_clone(&self) -> Result<Self, UnimageError>
Clone the processor instance and the image buffer in it. If there is something wrong, it will return a error.