x_graphics/direct2d/
geometry.rs1use windows::Win32::Graphics::Direct2D::Common::{D2D_POINT_2F, D2D_RECT_F, D2D_SIZE_F};
2
3use crate::geometry::{FPoint, FRect, FSize};
4
5impl From<FPoint> for D2D_POINT_2F {
6 fn from(point: FPoint) -> Self {
7 D2D_POINT_2F {
8 x: point.x,
9 y: point.y,
10 }
11 }
12}
13
14impl From<D2D_POINT_2F> for FPoint {
15 fn from(point: D2D_POINT_2F) -> Self {
16 FPoint::new(point.x, point.y)
17 }
18}
19
20impl From<FSize> for D2D_SIZE_F {
21 fn from(size: FSize) -> Self {
22 D2D_SIZE_F {
23 width: size.width,
24 height: size.height,
25 }
26 }
27}
28
29impl From<D2D_SIZE_F> for FSize {
30 fn from(size: D2D_SIZE_F) -> Self {
31 FSize::new(size.width, size.height)
32 }
33}
34
35impl From<FRect> for D2D_RECT_F {
36 fn from(rect: FRect) -> Self {
37 D2D_RECT_F {
38 left: rect.point.x,
39 top: rect.point.y,
40 right: rect.point.x + rect.size.width,
41 bottom: rect.point.y + rect.size.height,
42 }
43 }
44}
45
46impl From<D2D_RECT_F> for FRect {
47 fn from(rect: D2D_RECT_F) -> Self {
48 FRect::new(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)
49 }
50}