create separate types per command
This commit is contained in:
parent
c29482ac56
commit
bffc905261
19 changed files with 306 additions and 200 deletions
30
src/commands/bitmap.rs
Normal file
30
src/commands/bitmap.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use crate::{
|
||||
commands::wrap_command, compression_code::CompressionCode,
|
||||
containers::bitmap::Bitmap, macros::wrap_object,
|
||||
};
|
||||
use servicepoint::Origin;
|
||||
use std::sync::Arc;
|
||||
|
||||
wrap_object!(BitmapCommand);
|
||||
wrap_command!(BitmapCommand);
|
||||
|
||||
#[uniffi::export]
|
||||
impl BitmapCommand {
|
||||
#[uniffi::constructor]
|
||||
pub fn new(
|
||||
offset_x: u64,
|
||||
offset_y: u64,
|
||||
bitmap: &Arc<Bitmap>,
|
||||
compression: CompressionCode,
|
||||
) -> Arc<Self> {
|
||||
let origin = Origin::new(offset_x as usize, offset_y as usize);
|
||||
let bitmap = bitmap.read().clone();
|
||||
let compression = compression.into();
|
||||
let actual = servicepoint::BitmapCommand {
|
||||
origin,
|
||||
bitmap,
|
||||
compression,
|
||||
};
|
||||
Self::internal_new(actual)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue