Serialize image fills in binary

This commit is contained in:
Belén Albeza 2025-04-29 17:30:17 +02:00
parent f30441626e
commit 173d6c23b0
6 changed files with 109 additions and 51 deletions

View file

@ -98,11 +98,20 @@ impl Gradient {
pub struct ImageFill {
id: Uuid,
opacity: u8,
height: i32,
width: i32,
height: i32,
}
impl ImageFill {
pub fn new(id: Uuid, opacity: u8, width: i32, height: i32) -> Self {
Self {
id,
opacity,
width,
height,
}
}
pub fn size(&self) -> (i32, i32) {
(self.width, self.height)
}
@ -124,15 +133,6 @@ pub enum Fill {
}
impl Fill {
pub fn new_image_fill(id: Uuid, opacity: u8, (width, height): (i32, i32)) -> Self {
Self::Image(ImageFill {
id,
opacity,
height,
width,
})
}
pub fn to_paint(&self, rect: &Rect, anti_alias: bool) -> skia::Paint {
match self {
Self::Solid(SolidColor(color)) => {