mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
f19dbdb1b5
This adds a new dependency on peniko, reintroduces kurbo for geometry (!), removes the now defunct types from piet-scene and updates all the test scenes to use the new types.
29 lines
587 B
Rust
29 lines
587 B
Rust
use peniko::kurbo::{Affine, Point};
|
|
|
|
pub fn affine_to_f32(affine: &Affine) -> [f32; 6] {
|
|
let c = affine.as_coeffs();
|
|
[
|
|
c[0] as f32,
|
|
c[1] as f32,
|
|
c[2] as f32,
|
|
c[3] as f32,
|
|
c[4] as f32,
|
|
c[5] as f32,
|
|
]
|
|
}
|
|
|
|
pub fn affine_from_f32(coeffs: &[f32; 6]) -> Affine {
|
|
Affine::new([
|
|
coeffs[0] as f64,
|
|
coeffs[1] as f64,
|
|
coeffs[2] as f64,
|
|
coeffs[3] as f64,
|
|
coeffs[4] as f64,
|
|
coeffs[5] as f64,
|
|
])
|
|
}
|
|
|
|
pub fn point_to_f32(point: Point) -> [f32; 2] {
|
|
[point.x as f32, point.y as f32]
|
|
}
|