Implement image support for canvas widget
This commit is contained in:
parent
87a613edd1
commit
0ceee1cf3a
16 changed files with 485 additions and 29 deletions
|
|
@ -116,6 +116,48 @@ impl Layer {
|
|||
}
|
||||
|
||||
pub fn draw_image(
|
||||
&mut self,
|
||||
image: &Image,
|
||||
transformation: Transformation,
|
||||
) {
|
||||
match image {
|
||||
Image::Raster {
|
||||
handle,
|
||||
filter_method,
|
||||
bounds,
|
||||
rotation,
|
||||
opacity,
|
||||
snap: _,
|
||||
} => {
|
||||
self.draw_raster(
|
||||
handle.clone(),
|
||||
*filter_method,
|
||||
*bounds,
|
||||
transformation,
|
||||
*rotation,
|
||||
*opacity,
|
||||
);
|
||||
}
|
||||
Image::Vector {
|
||||
handle,
|
||||
color,
|
||||
bounds,
|
||||
rotation,
|
||||
opacity,
|
||||
} => {
|
||||
self.draw_svg(
|
||||
handle.clone(),
|
||||
*color,
|
||||
*bounds,
|
||||
transformation,
|
||||
*rotation,
|
||||
*opacity,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_raster(
|
||||
&mut self,
|
||||
handle: image::Handle,
|
||||
filter_method: image::FilterMethod,
|
||||
|
|
@ -130,6 +172,7 @@ impl Layer {
|
|||
bounds: bounds * transformation,
|
||||
rotation,
|
||||
opacity,
|
||||
snap: false,
|
||||
};
|
||||
|
||||
self.images.push(image);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue