mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
fix gradient ramp color packing
This commit is contained in:
parent
a6597af52a
commit
f7b1bca18b
|
@ -124,6 +124,6 @@ impl ColorF64 {
|
||||||
let g = ((self.0[1] * a).min(1.0).max(0.0) * 255.0) as u32;
|
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 b = ((self.0[2] * a).min(1.0).max(0.0) * 255.0) as u32;
|
||||||
let a = (a * 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,9 +206,9 @@ fn render_blend_square(sb: &mut SceneBuilder, blend: BlendMode, transform: Affin
|
||||||
});
|
});
|
||||||
sb.fill(Fill::NonZero, transform, &linear, None, rect.elements());
|
sb.fill(Fill::NonZero, transform, &linear, None, rect.elements());
|
||||||
const GRADIENTS: &[(f32, f32, Color)] = &[
|
const GRADIENTS: &[(f32, f32, Color)] = &[
|
||||||
(150., 0., Color::rgb8(64, 240, 255)),
|
(150., 0., Color::rgb8(255, 240, 64)),
|
||||||
(175., 100., Color::rgb8(240, 96, 255)),
|
(175., 100., Color::rgb8(255, 96, 240)),
|
||||||
(125., 200., Color::rgb8(255, 192, 64)),
|
(125., 200., Color::rgb8(64, 192, 255)),
|
||||||
];
|
];
|
||||||
for (x, y, c) in GRADIENTS {
|
for (x, y, c) in GRADIENTS {
|
||||||
let mut color2 = c.clone();
|
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());
|
sb.fill(Fill::NonZero, transform, &rad, None, rect.elements());
|
||||||
}
|
}
|
||||||
const COLORS: &[Color] = &[
|
const COLORS: &[Color] = &[
|
||||||
Color::rgb8(0, 0, 255),
|
|
||||||
Color::rgb8(0, 255, 0),
|
|
||||||
Color::rgb8(255, 0, 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());
|
sb.push_layer(Mix::Normal.into(), transform, rect.elements());
|
||||||
for (i, c) in COLORS.iter().enumerate() {
|
for (i, c) in COLORS.iter().enumerate() {
|
||||||
|
|
Loading…
Reference in a new issue