| 1 |
pub(crate) type LONG = i32; |
| 2 |
pub(crate) type INT = i32; |
| 3 |
pub(crate) type UINT = u32; |
| 4 |
pub(crate) type ULONG = u32; |
| 5 |
pub(crate) type DWORD = ULONG; |
| 6 |
pub(crate) type WORD = u16; |
| 7 |
pub(crate) type LONGLONG = i64; |
| 8 |
pub(crate) type ULONGLONG = u64; |
| 9 |
pub(crate) type BYTE = u8; |
| 10 |
pub(crate) type FLOAT = f32; |
| 11 |
pub(crate) type REAL = FLOAT; |
| 12 |
pub(crate) type HRESULT = LONG; |
| 13 |
|
| 14 |
pub(crate) const S_OK: HRESULT = 0; |
| 15 |
pub(crate) const INTSAFE_E_ARITHMETIC_OVERFLOW: HRESULT = 0x80070216; |
| 16 |
pub(crate) const WGXERR_VALUEOVERFLOW: HRESULT = INTSAFE_E_ARITHMETIC_OVERFLOW; |
| 17 |
pub(crate) const WINCODEC_ERR_VALUEOVERFLOW: HRESULT = INTSAFE_E_ARITHMETIC_OVERFLOW; |
| 18 |
const fn MAKE_HRESULT(sev: LONG,fac: LONG,code: LONG) -> HRESULT { |
| 19 |
( (((sev)<<31) | ((fac)<<16) | ((code))) ) |
| 20 |
} |
| 21 |
|
| 22 |
const FACILITY_WGX: LONG = 0x898; |
| 23 |
|
| 24 |
|
| 25 |
const fn MAKE_WGXHR( sev: LONG, code: LONG) -> HRESULT { |
| 26 |
MAKE_HRESULT( sev, FACILITY_WGX, (code) ) |
| 27 |
} |
| 28 |
|
| 29 |
const fn MAKE_WGXHR_ERR( code: LONG ) -> HRESULT |
| 30 |
{ |
| 31 |
MAKE_WGXHR( 1, code ) |
| 32 |
} |
| 33 |
|
| 34 |
pub const WGXHR_CLIPPEDTOEMPTY: HRESULT = MAKE_WGXHR(0, 1); |
| 35 |
pub const WGXHR_EMPTYFILL: HRESULT = MAKE_WGXHR(0, 2); |
| 36 |
pub const WGXHR_INTERNALTEMPORARYSUCCESS: HRESULT = MAKE_WGXHR(0, 3); |
| 37 |
pub const WGXHR_RESETSHAREDHANDLEMANAGER: HRESULT = MAKE_WGXHR(0, 4); |
| 38 |
|
| 39 |
pub const WGXERR_BADNUMBER: HRESULT = MAKE_WGXHR_ERR(0x00A); // 4438 |
| 40 |
|
| 41 |
pub fn FAILED(hr: HRESULT) -> bool { |
| 42 |
hr != S_OK |
| 43 |
} |
| 44 |
pub trait NullPtr { |
| 45 |
fn make() -> Self; |
| 46 |
} |
| 47 |
|
| 48 |
impl<T> NullPtr for *mut T { |
| 49 |
fn make() -> Self { |
| 50 |
std::ptr::null_mut() |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
impl<T> NullPtr for *const T { |
| 55 |
fn make() -> Self { |
| 56 |
std::ptr::null() |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
pub fn NULL<T: NullPtr>() -> T { |
| 61 |
T::make() |
| 62 |
} |
| 63 |
#[derive(Default, Clone)] |
| 64 |
pub struct RECT { |
| 65 |
pub left: LONG, |
| 66 |
pub top: LONG, |
| 67 |
pub right: LONG, |
| 68 |
pub bottom: LONG, |
| 69 |
} |
| 70 |
#[derive(Default, Clone, Copy, PartialEq, Eq)] |
| 71 |
pub struct POINT { |
| 72 |
pub x: LONG, |
| 73 |
pub y: LONG |
| 74 |
} |
| 75 |
#[derive(Clone, Copy)] |
| 76 |
pub struct MilPoint2F |
| 77 |
{ |
| 78 |
pub X: FLOAT, |
| 79 |
pub Y: FLOAT, |
| 80 |
} |
| 81 |
|
| 82 |
#[derive(Default, Clone)] |
| 83 |
pub struct MilPointAndSizeL |
| 84 |
{ |
| 85 |
pub X: INT, |
| 86 |
pub Y: INT, |
| 87 |
pub Width: INT, |
| 88 |
pub Height: INT, |
| 89 |
} |
| 90 |
|
| 91 |
pub type CMILSurfaceRect = RECT; |
| 92 |
|
| 93 |
#[derive(PartialEq)] |
| 94 |
pub enum MilAntiAliasMode { |
| 95 |
None = 0, |
| 96 |
EightByEight = 1, |
| 97 |
} |
| 98 |
#[derive(PartialEq, Clone, Copy)] |
| 99 |
pub enum MilFillMode { |
| 100 |
Alternate = 0, |
| 101 |
Winding = 1, |
| 102 |
} |
| 103 |
|
| 104 |
pub const PathPointTypeStart: u8 = 0; // move, 1 point |
| 105 |
pub const PathPointTypeLine: u8 = 1; // line, 1 point |
| 106 |
pub const PathPointTypeBezier: u8 = 3; // default Bezier (= cubic Bezier), 3 points |
| 107 |
pub const PathPointTypePathTypeMask: u8 = 0x07; // type mask (lowest 3 bits). |
| 108 |
pub const PathPointTypeCloseSubpath: u8 = 0x80; // closed flag |
| 109 |
|
| 110 |
|
| 111 |
pub type DynArray<T> = Vec<T>; |
| 112 |
|
| 113 |
pub trait DynArrayExts<T> { |
| 114 |
fn Reset(&mut self, shrink: bool); |
| 115 |
fn GetCount(&self) -> usize; |
| 116 |
fn SetCount(&mut self, count: usize); |
| 117 |
fn GetDataBuffer(&self) -> &[T]; |
| 118 |
} |
| 119 |
|
| 120 |
impl<T> DynArrayExts<T> for DynArray<T> { |
| 121 |
fn Reset(&mut self, shrink: bool) { |
| 122 |
self.clear(); |
| 123 |
if shrink { |
| 124 |
self.shrink_to_fit(); |
| 125 |
} |
| 126 |
} |
| 127 |
fn GetCount(&self) -> usize { |
| 128 |
self.len() |
| 129 |
} |
| 130 |
fn SetCount(&mut self, count: usize) { |
| 131 |
assert!(count <= self.len()); |
| 132 |
self.truncate(count); |
| 133 |
} |
| 134 |
|
| 135 |
fn GetDataBuffer(&self) -> &[T] { |
| 136 |
self |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
pub struct CHwPipelineBuilder; |
| 141 |
|
| 142 |
pub mod CoordinateSpace { |
| 143 |
#[derive(Default, Clone)] |
| 144 |
pub struct Shape; |
| 145 |
#[derive(Default, Clone)] |
| 146 |
pub struct Device; |
| 147 |
} |
| 148 |
|
| 149 |
pub trait IShapeData { |
| 150 |
fn GetFillMode(&self) -> MilFillMode; |
| 151 |
} |
| 152 |
|
| 153 |
pub type MilVertexFormat = DWORD; |
| 154 |
|
| 155 |
pub enum MilVertexFormatAttribute { |
| 156 |
MILVFAttrNone = 0x0, |
| 157 |
MILVFAttrXY = 0x1, |
| 158 |
MILVFAttrZ = 0x2, |
| 159 |
MILVFAttrXYZ = 0x3, |
| 160 |
MILVFAttrNormal = 0x4, |
| 161 |
MILVFAttrDiffuse = 0x8, |
| 162 |
MILVFAttrSpecular = 0x10, |
| 163 |
MILVFAttrUV1 = 0x100, |
| 164 |
MILVFAttrUV2 = 0x300, |
| 165 |
MILVFAttrUV3 = 0x700, |
| 166 |
MILVFAttrUV4 = 0xf00, |
| 167 |
MILVFAttrUV5 = 0x1f00, |
| 168 |
MILVFAttrUV6 = 0x3f00, |
| 169 |
MILVFAttrUV7 = 0x7f00, |
| 170 |
MILVFAttrUV8 = 0xff00, // Vertex fields that are pre-generated |
| 171 |
|
| 172 |
} |
| 173 |
|
| 174 |
pub struct CHwPipeline; |
| 175 |
|
| 176 |
pub struct CBufferDispenser; |
| 177 |
#[derive(Default)] |
| 178 |
pub struct PointXYA |
| 179 |
{ |
| 180 |
pub x: f32,pub y: f32, pub a: f32, |
| 181 |
} |