vello/piet-gpu-types/src/annotated.rs
Raph Levien 6f707c4c62 Start work on gradients
WIP. Most of the GPU-side work should be done (though it's not tested
end-to-end and it's certainly possible I missed something), but still
needs work on encoding side.
2021-07-12 06:56:52 -07:00

46 lines
1.2 KiB
Rust

use piet_gpu_derive::piet_gpu;
piet_gpu! {
#[gpu_write]
mod annotated {
struct AnnoImage {
bbox: [f32; 4],
linewidth: f32,
index: u32,
offset: [i16; 2],
}
struct AnnoColor {
bbox: [f32; 4],
// For stroked fills.
// For the nonuniform scale case, this needs to be a 2x2 matrix.
// That's expected to be uncommon, so we could special-case it.
linewidth: f32,
rgba_color: u32,
}
struct AnnoLinGradient {
bbox: [f32; 4],
// For stroked fills.
linewidth: f32,
index: u32,
line_x: f32,
line_y: f32,
line_c: f32,
}
struct AnnoBeginClip {
bbox: [f32; 4],
linewidth: f32,
}
struct AnnoEndClip {
bbox: [f32; 4],
}
enum Annotated {
Nop,
Color(TagFlags, AnnoColor),
LinGradient(TagFlags, AnnoLinGradient),
Image(TagFlags, AnnoImage),
BeginClip(TagFlags, AnnoBeginClip),
EndClip(AnnoEndClip),
}
}
}