iced-yoda/wgpu/src/primitive.rs

67 lines
1.7 KiB
Rust
Raw Normal View History

use iced_native::{
image, svg, Background, Color, Font, HorizontalAlignment, Rectangle,
Vector, VerticalAlignment,
};
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
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
font: Font,
2019-11-22 22:14:24 +01:00
/// The horizontal alignment of the text
horizontal_alignment: HorizontalAlignment,
2019-11-22 22:14:24 +01:00
/// The vertical alignment of the text
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
border_radius: u16,
2019-10-06 19:22:25 +02:00
},
2019-11-22 22:14:24 +01:00
/// An image primitive
Image {
/// The handle of the image
handle: image::Handle,
2019-11-22 22:14:24 +01:00
/// The bounds of the image
bounds: Rectangle,
},
/// 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
Clip {
2019-11-22 22:14:24 +01:00
/// The bounds of the clip
bounds: Rectangle,
2019-11-22 22:14:24 +01:00
/// The offset transformation of the clip
offset: Vector<u32>,
2019-11-22 22:14:24 +01:00
/// The content of the clip
content: Box<Primitive>,
},
2019-10-06 19:22:25 +02:00
}