fix gradient ramp color packing

This commit is contained in:
Chad Brokaw 2022-10-19 14:29:40 -04:00
parent a6597af52a
commit f7b1bca18b
2 changed files with 6 additions and 6 deletions

View file

@ -124,6 +124,6 @@ impl ColorF64 {
let g = ((self.0[1] * a).min(1.0).max(0.0) * 255.0) as u32;
let b = ((self.0[2] * a).min(1.0).max(0.0) * 255.0) as u32;
let a = (a * 255.0) as u32;
b | (g << 8) | (r << 16) | (a << 24)
r | (g << 8) | (b << 16) | (a << 24)
}
}

View file

@ -206,9 +206,9 @@ fn render_blend_square(sb: &mut SceneBuilder, blend: BlendMode, transform: Affin
});
sb.fill(Fill::NonZero, transform, &linear, None, rect.elements());
const GRADIENTS: &[(f32, f32, Color)] = &[
(150., 0., Color::rgb8(64, 240, 255)),
(175., 100., Color::rgb8(240, 96, 255)),
(125., 200., Color::rgb8(255, 192, 64)),
(150., 0., Color::rgb8(255, 240, 64)),
(175., 100., Color::rgb8(255, 96, 240)),
(125., 200., Color::rgb8(64, 192, 255)),
];
for (x, y, c) in GRADIENTS {
let mut color2 = c.clone();
@ -234,9 +234,9 @@ fn render_blend_square(sb: &mut SceneBuilder, blend: BlendMode, transform: Affin
sb.fill(Fill::NonZero, transform, &rad, None, rect.elements());
}
const COLORS: &[Color] = &[
Color::rgb8(0, 0, 255),
Color::rgb8(0, 255, 0),
Color::rgb8(255, 0, 0),
Color::rgb8(0, 255, 0),
Color::rgb8(0, 0, 255),
];
sb.push_layer(Mix::Normal.into(), transform, rect.elements());
for (i, c) in COLORS.iter().enumerate() {