mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 04:31:30 +11:00
Change color packing to match target format
This commit is contained in:
parent
c95887b4df
commit
a9356cc50b
|
@ -48,10 +48,6 @@ impl Color {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn pack(self) -> u32 {
|
||||
(self.b as u32) << 24 | (self.g as u32) << 16 | (self.r as u32) << 8 | self.a as u32
|
||||
}
|
||||
|
||||
pub fn to_premul_u32(self) -> u32 {
|
||||
let a = self.a as f64 / 255.0;
|
||||
let r = (self.r as f64 * a) as u32;
|
||||
|
|
|
@ -306,7 +306,7 @@ fn test_scene1(scene: &mut Scene, rcx: &mut ResourceContext) {
|
|||
//b.push_transform(Affine::translate(200., 200.) * Affine::rotate(45f32.to_radians()));
|
||||
b.fill(
|
||||
Fill::NonZero,
|
||||
// &Brush::Solid(Color::rgba8(0, 255, 0, 255)),
|
||||
// &Brush::Solid(Color::rgba8(255, 0, 0, 255)),
|
||||
&radial,
|
||||
None, //Some(Affine::rotate(90f32.to_radians())),
|
||||
Rect {
|
||||
|
@ -354,33 +354,3 @@ fn render_info_string(rc: &mut impl RenderContext, info: &str) {
|
|||
rc.draw_text(&layout, Point::new(110.0, 50.0));
|
||||
}
|
||||
|
||||
// use piet_scene::geometry::*;
|
||||
// use piet_scene::path::*;
|
||||
// use piet_scene::scene::*;
|
||||
// use piet_scene::{geometry::*, path::*, resource::ResourceContext, scene::*};
|
||||
|
||||
// fn main() {
|
||||
// let mut scene = Scene::default();
|
||||
// let mut rcx = ResourceContext::new();
|
||||
// let mut sb = build_scene(&mut scene, &mut rcx);
|
||||
|
||||
// sb.push_layer(Blend::default(), Rect::default().elements());
|
||||
|
||||
// // let mut path = Path::new();
|
||||
// // let mut b = PathBuilder::new(&mut path);
|
||||
// // b.move_to(100., 100.);
|
||||
// // b.line_to(200., 200.);
|
||||
// // b.close_path();
|
||||
// // b.move_to(50., 50.);
|
||||
// // b.line_to(600., 150.);
|
||||
// // b.move_to(4., 2.);
|
||||
// // b.quad_to(8., 8., 9., 9.);
|
||||
// // b.close_path();
|
||||
// // println!("{:?}", path);
|
||||
// // for el in path.elements() {
|
||||
// // println!("{:?}", el);
|
||||
// // }
|
||||
// //sb.push_layer(path.elements(), BlendMode::default());
|
||||
|
||||
// sb.push_layer(Blend::default(), [Element::MoveTo((0., 0.).into())]);
|
||||
// }
|
||||
|
|
|
@ -133,6 +133,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;
|
||||
r | (g << 8) | (b << 16) | (a << 24)
|
||||
b | (g << 8) | (r << 16) | (a << 24)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue