From 6ef154e9b3128b03a573bf4f4bc560d79ec23304 Mon Sep 17 00:00:00 2001 From: Nova Date: Sat, 26 Nov 2022 00:43:04 -0500 Subject: [PATCH] fix(lines): accept f32 colors --- src/nodes/drawable/lines.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nodes/drawable/lines.rs b/src/nodes/drawable/lines.rs index 86359ff..7d236a8 100644 --- a/src/nodes/drawable/lines.rs +++ b/src/nodes/drawable/lines.rs @@ -21,7 +21,7 @@ static LINES_REGISTRY: Registry = Registry::new(); struct LinePointRaw { point: Vector3, thickness: f32, - color: [u8; 4], + color: [f32; 4], } #[derive(Debug, Clone)] @@ -61,7 +61,7 @@ impl Lines { .map(|p| SkLinePoint { point: transform_mat.transform_point3a(Vec3A::from(p.point)).into(), thickness: p.thickness, - color: Color32::from_slice(&p.color), + color: Color32::from_slice(p.color.map(|c| (c / 255.0) as u8).as_slice()), }) .collect(); if data.cyclic && !points.is_empty() {