Introduce Svg struct in core::svg

This commit is contained in:
Héctor Ramón Jiménez 2024-08-04 04:52:55 +02:00
parent 8708101c89
commit d4b08462e5
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
18 changed files with 146 additions and 257 deletions

View file

@ -3,8 +3,7 @@ use crate::core::image;
use crate::core::renderer;
use crate::core::svg;
use crate::core::{
self, Background, Color, Image, Point, Radians, Rectangle, Size,
Transformation,
self, Background, Color, Image, Point, Rectangle, Size, Svg, Transformation,
};
use crate::graphics;
use crate::graphics::compositor;
@ -164,19 +163,8 @@ where
delegate!(self, renderer, renderer.measure_svg(handle))
}
fn draw_svg(
&mut self,
handle: svg::Handle,
color: Option<Color>,
bounds: Rectangle,
rotation: Radians,
opacity: f32,
) {
delegate!(
self,
renderer,
renderer.draw_svg(handle, color, bounds, rotation, opacity)
);
fn draw_svg(&mut self, svg: Svg, bounds: Rectangle) {
delegate!(self, renderer, renderer.draw_svg(svg, bounds));
}
}
@ -425,8 +413,7 @@ where
#[cfg(feature = "geometry")]
mod geometry {
use super::Renderer;
use crate::core::svg;
use crate::core::{Color, Point, Radians, Rectangle, Size, Vector};
use crate::core::{Point, Radians, Rectangle, Size, Svg, Vector};
use crate::graphics::cache::{self, Cached};
use crate::graphics::geometry::{self, Fill, Image, Path, Stroke, Text};
@ -561,19 +548,8 @@ mod geometry {
delegate!(self, frame, frame.draw_image(bounds, image));
}
fn draw_svg(
&mut self,
handle: &svg::Handle,
bounds: Rectangle,
color: Option<Color>,
rotation: Radians,
opacity: f32,
) {
delegate!(
self,
frame,
frame.draw_svg(handle, bounds, color, rotation, opacity)
);
fn draw_svg(&mut self, bounds: Rectangle, svg: impl Into<Svg>) {
delegate!(self, frame, frame.draw_svg(bounds, svg));
}
fn push_transform(&mut self) {