add From<Point> and From<Size> for [f32; 2]

This commit is contained in:
Azorlogh 2020-10-08 09:54:22 +02:00
parent 2e0ba65a20
commit e6bcb7211f
2 changed files with 12 additions and 0 deletions

View File

@ -46,6 +46,12 @@ impl From<[u16; 2]> for Point {
}
}
impl From<Point> for [f32; 2] {
fn from(point: Point) -> [f32; 2] {
[point.x, point.y]
}
}
impl std::ops::Add<Vector> for Point {
type Output = Self;

View File

@ -56,3 +56,9 @@ impl From<[u16; 2]> for Size {
Size::new(width.into(), height.into())
}
}
impl From<Size> for [f32; 2] {
fn from(size: Size) -> [f32; 2] {
[size.width, size.height]
}
}