iced_tiny_skia/
primitive.rs
1use crate::core::Rectangle;
2
3#[derive(Debug, Clone, PartialEq)]
4pub enum Primitive {
5 Fill {
7 path: tiny_skia::Path,
9 paint: tiny_skia::Paint<'static>,
11 rule: tiny_skia::FillRule,
13 },
14 Stroke {
16 path: tiny_skia::Path,
18 paint: tiny_skia::Paint<'static>,
20 stroke: tiny_skia::Stroke,
22 },
23}
24
25impl Primitive {
26 pub fn visible_bounds(&self) -> Rectangle {
28 let bounds = match self {
29 Primitive::Fill { path, .. } => path.bounds(),
30 Primitive::Stroke { path, .. } => path.bounds(),
31 };
32
33 Rectangle {
34 x: bounds.x(),
35 y: bounds.y(),
36 width: bounds.width(),
37 height: bounds.height(),
38 }
39 }
40}