51 lines
1.1 KiB
Rust
Executable File
51 lines
1.1 KiB
Rust
Executable File
#[cfg(windows)]
|
|
use windows::Win32::{
|
|
Foundation::RECT,
|
|
Graphics::Direct2D::Common::{D2D_RECT_F, D2D_RECT_U},
|
|
};
|
|
|
|
// fixme: consider splitting this into two types (f32 and u32) or make this generic
|
|
#[derive(Copy, Clone, Debug)]
|
|
pub struct Rect {
|
|
pub left: f32,
|
|
pub right: f32,
|
|
pub top: f32,
|
|
pub bottom: f32,
|
|
}
|
|
|
|
#[cfg(windows)]
|
|
impl From<Rect> for RECT {
|
|
fn from(rect: Rect) -> Self {
|
|
Self {
|
|
left: rect.left as i32,
|
|
right: rect.right as i32,
|
|
top: rect.top as i32,
|
|
bottom: rect.bottom as i32,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(windows)]
|
|
impl From<Rect> for D2D_RECT_U {
|
|
fn from(rect: Rect) -> Self {
|
|
Self {
|
|
left: rect.left as u32,
|
|
right: rect.right as u32,
|
|
top: rect.top as u32,
|
|
bottom: rect.bottom as u32,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(windows)]
|
|
impl From<Rect> for D2D_RECT_F {
|
|
fn from(rect: Rect) -> Self {
|
|
Self {
|
|
left: rect.left,
|
|
right: rect.right,
|
|
top: rect.top,
|
|
bottom: rect.bottom,
|
|
}
|
|
}
|
|
}
|