color picker and palette editor
git clone https://git.lucas.co/cce-color-editor.git
Update and align interface features
src/main.rs | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 9a57b41..84beb9d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -38,12 +38,14 @@ use calloop_wayland_source::WaylandSource;
struct Vertex {
position: [f32; 2],
color: [f32; 4],
+ clip_circle: [f32; 3],
}
impl Vertex {
- const ATTRIBS: [wgpu::VertexAttribute; 2] = wgpu::vertex_attr_array![
+ const ATTRIBS: [wgpu::VertexAttribute; 3] = wgpu::vertex_attr_array![
0 => Float32x2,
1 => Float32x4,
+ 2 => Float32x3,
];
fn desc() -> wgpu::VertexBufferLayout<'static> {
@@ -61,12 +63,12 @@ fn quad_vertices(x: f32, y: f32, w: f32, h: f32, sw: f32, sh: f32, c: [f32; 4])
let x1 = ((x + w) / sw) * 2.0 - 1.0;
let y1 = 1.0 - ((y + h) / sh) * 2.0;
[
- Vertex { position: [x0, y0], color: c },
- Vertex { position: [x1, y0], color: c },
- Vertex { position: [x0, y1], color: c },
- Vertex { position: [x1, y0], color: c },
- Vertex { position: [x1, y1], color: c },
- Vertex { position: [x0, y1], color: c },
+ Vertex { position: [x0, y0], color: c, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x1, y0], color: c, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x0, y1], color: c, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x1, y0], color: c, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x1, y1], color: c, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x0, y1], color: c, clip_circle: [0.0, 0.0, 0.0] },
]
}
@@ -76,12 +78,12 @@ fn gradient_quad_vertices(x: f32, y: f32, w: f32, h: f32, sw: f32, sh: f32, c0:
let x1 = ((x + w) / sw) * 2.0 - 1.0;
let y1 = 1.0 - ((y + h) / sh) * 2.0;
[
- Vertex { position: [x0, y0], color: c0 },
- Vertex { position: [x1, y0], color: c1 },
- Vertex { position: [x0, y1], color: c0 },
- Vertex { position: [x1, y0], color: c1 },
- Vertex { position: [x1, y1], color: c1 },
- Vertex { position: [x0, y1], color: c0 },
+ Vertex { position: [x0, y0], color: c0, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x1, y0], color: c1, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x0, y1], color: c0, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x1, y0], color: c1, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x1, y1], color: c1, clip_circle: [0.0, 0.0, 0.0] },
+ Vertex { position: [x0, y1], color: c0, clip_circle: [0.0, 0.0, 0.0] },
]
}
@@ -1324,4 +1326,5 @@ fn main() {
}
}
}
+ drop(app);
}