export some builtin traits,

brightness conversion fails for invalid values,

macros for wrapping attrs
This commit is contained in:
Vinzenz Schroeter 2025-06-16 14:56:24 +02:00
parent bffc905261
commit f4c7519658
21 changed files with 210 additions and 133 deletions

View file

@ -1,4 +1,7 @@
use crate::macros::*;
use crate::{
containers::{wrap_get_set_fill_2d, wrap_width_height},
macros::wrap_object,
};
use servicepoint::Grid;
use std::{ops::Deref, sync::Arc};
@ -22,18 +25,13 @@ impl Bitmap {
#[uniffi::constructor]
pub fn load(width: u64, height: u64, data: Vec<u8>) -> Arc<Self> {
// TODO: throw exception
Self::internal_new(
servicepoint::Bitmap::load(width as usize, height as usize, &data)
.unwrap(),
)
}
pub fn equals(&self, other: &Bitmap) -> bool {
let a = self.read();
let b = other.read();
*a == *b
}
pub fn copy_raw(&self) -> Vec<u8> {
self.read().deref().into()
}