2019-11-21 13:47:20 +01:00
|
|
|
use iced_native::{
|
2019-12-15 06:19:07 +01:00
|
|
|
image, svg, Background, Color, Font, HorizontalAlignment, Rectangle,
|
|
|
|
|
Vector, VerticalAlignment,
|
2019-11-21 13:47:20 +01:00
|
|
|
};
|
2019-10-05 19:22:51 +02:00
|
|
|
|
2019-11-22 22:14:24 +01:00
|
|
|
/// A rendering primitive.
|
2019-10-05 19:22:51 +02:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum Primitive {
|
2019-11-22 22:14:24 +01:00
|
|
|
/// An empty primitive
|
2019-10-05 19:22:51 +02:00
|
|
|
None,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// A group of primitives
|
2019-10-05 19:22:51 +02:00
|
|
|
Group {
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The primitives of the group
|
2019-10-05 19:22:51 +02:00
|
|
|
primitives: Vec<Primitive>,
|
|
|
|
|
},
|
2019-11-22 22:14:24 +01:00
|
|
|
/// A text primitive
|
2019-10-05 19:22:51 +02:00
|
|
|
Text {
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The contents of the text
|
2019-10-05 19:22:51 +02:00
|
|
|
content: String,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The bounds of the text
|
2019-10-05 19:22:51 +02:00
|
|
|
bounds: Rectangle,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The color of the text
|
2019-10-08 03:13:41 +02:00
|
|
|
color: Color,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The size of the text
|
2019-10-05 19:22:51 +02:00
|
|
|
size: f32,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The font of the text
|
2019-11-13 07:22:21 +01:00
|
|
|
font: Font,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The horizontal alignment of the text
|
2019-11-21 13:47:20 +01:00
|
|
|
horizontal_alignment: HorizontalAlignment,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The vertical alignment of the text
|
2019-11-21 13:47:20 +01:00
|
|
|
vertical_alignment: VerticalAlignment,
|
2019-10-05 19:22:51 +02:00
|
|
|
},
|
2019-11-22 22:14:24 +01:00
|
|
|
/// A quad primitive
|
2019-10-07 02:17:40 +02:00
|
|
|
Quad {
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The bounds of the quad
|
2019-10-06 19:22:25 +02:00
|
|
|
bounds: Rectangle,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The background of the quad
|
2019-10-06 19:22:25 +02:00
|
|
|
background: Background,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The border radius of the quad
|
2019-10-08 03:13:41 +02:00
|
|
|
border_radius: u16,
|
2019-10-06 19:22:25 +02:00
|
|
|
},
|
2019-11-22 22:14:24 +01:00
|
|
|
/// An image primitive
|
2019-10-23 01:21:23 +02:00
|
|
|
Image {
|
2019-11-29 21:44:39 +01:00
|
|
|
/// The handle of the image
|
|
|
|
|
handle: image::Handle,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The bounds of the image
|
2019-10-23 01:21:23 +02:00
|
|
|
bounds: Rectangle,
|
|
|
|
|
},
|
2019-12-15 06:19:07 +01:00
|
|
|
/// An SVG primitive
|
|
|
|
|
Svg {
|
|
|
|
|
/// The path of the SVG file
|
|
|
|
|
handle: svg::Handle,
|
|
|
|
|
|
|
|
|
|
/// The bounds of the viewport
|
|
|
|
|
bounds: Rectangle,
|
|
|
|
|
},
|
2019-11-22 22:14:24 +01:00
|
|
|
/// A clip primitive
|
2019-10-29 19:50:34 +01:00
|
|
|
Clip {
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The bounds of the clip
|
2019-10-25 03:47:34 +02:00
|
|
|
bounds: Rectangle,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The offset transformation of the clip
|
2019-11-05 03:16:46 +01:00
|
|
|
offset: Vector<u32>,
|
2019-11-22 22:14:24 +01:00
|
|
|
/// The content of the clip
|
2019-10-25 03:47:34 +02:00
|
|
|
content: Box<Primitive>,
|
|
|
|
|
},
|
2019-10-06 19:22:25 +02:00
|
|
|
}
|