use crate::draw::texture::Texture;
use crate::types::{Color, Fixed, Opa, Point, Rect, Transform};
pub enum DrawCommand<'a> {
Fill {
area: Rect,
transform: Transform,
quad: Option<[Point; 4]>,
color: Color,
radius: Fixed,
opa: Opa,
},
Border {
area: Rect,
transform: Transform,
quad: Option<[Point; 4]>,
color: Color,
width: Fixed,
radius: Fixed,
opa: Opa,
},
Label {
pos: Point,
transform: Transform,
text: &'a [u8],
color: Color,
opa: Opa,
},
Line {
p1: Point,
p2: Point,
transform: Transform,
color: Color,
width: Fixed,
opa: Opa,
},
Arc {
center: Point,
transform: Transform,
radius: Fixed,
start_angle: Fixed,
end_angle: Fixed,
color: Color,
width: Fixed,
opa: Opa,
},
Blit {
pos: Point,
size: Point,
transform: Transform,
quad: Option<[Point; 4]>,
texture: &'a Texture<'a>,
},
}
impl DrawCommand<'_> {
#[inline]
pub fn transform(&self) -> Transform {
match *self {
Self::Fill { transform, .. }
| Self::Border { transform, .. }
| Self::Label { transform, .. }
| Self::Line { transform, .. }
| Self::Arc { transform, .. }
| Self::Blit { transform, .. } => transform,
}
}
}