use windows::Win32::Graphics::Direct2D::Common::{D2D_POINT_2F, D2D_RECT_F, D2D_SIZE_F};
use crate::geometry::{FPoint, FRect, FSize};
impl From<FPoint> for D2D_POINT_2F {
fn from(point: FPoint) -> Self {
D2D_POINT_2F {
x: point.x,
y: point.y,
}
}
}
impl From<D2D_POINT_2F> for FPoint {
fn from(point: D2D_POINT_2F) -> Self {
FPoint::new(point.x, point.y)
}
}
impl From<FSize> for D2D_SIZE_F {
fn from(size: FSize) -> Self {
D2D_SIZE_F {
width: size.width,
height: size.height,
}
}
}
impl From<D2D_SIZE_F> for FSize {
fn from(size: D2D_SIZE_F) -> Self {
FSize::new(size.width, size.height)
}
}
impl From<FRect> for D2D_RECT_F {
fn from(rect: FRect) -> Self {
D2D_RECT_F {
left: rect.point.x,
top: rect.point.y,
right: rect.point.x + rect.size.width,
bottom: rect.point.y + rect.size.height,
}
}
}
impl From<D2D_RECT_F> for FRect {
fn from(rect: D2D_RECT_F) -> Self {
FRect::new(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)
}
}