1 // Licensed under the Apache License, Version 2.0 2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 4 // All files in the project carrying such notice may not be copied, modified, or distributed 5 // except according to those terms. 6 //! Mappings for the contents of dcommon.h 7 use ctypes::c_void; 8 use shared::basetsd::UINT32; 9 use shared::dxgiformat::DXGI_FORMAT; 10 use shared::minwindef::FLOAT; 11 use shared::windef::{POINT, RECT}; 12 ENUM!{enum DWRITE_MEASURING_MODE { 13 DWRITE_MEASURING_MODE_NATURAL = 0, 14 DWRITE_MEASURING_MODE_GDI_CLASSIC = 1, 15 DWRITE_MEASURING_MODE_GDI_NATURAL = 2, 16 }} 17 ENUM!{enum DWRITE_GLYPH_IMAGE_FORMATS { 18 DWRITE_GLYPH_IMAGE_FORMATS_NONE = 0x00000000, 19 DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE = 0x00000001, 20 DWRITE_GLYPH_IMAGE_FORMATS_CFF = 0x00000002, 21 DWRITE_GLYPH_IMAGE_FORMATS_COLR = 0x00000004, 22 DWRITE_GLYPH_IMAGE_FORMATS_SVG = 0x00000008, 23 DWRITE_GLYPH_IMAGE_FORMATS_PNG = 0x00000010, 24 DWRITE_GLYPH_IMAGE_FORMATS_JPEG = 0x00000020, 25 DWRITE_GLYPH_IMAGE_FORMATS_TIFF = 0x00000040, 26 DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8 = 0x00000080, 27 }} 28 STRUCT!{struct DWRITE_GLYPH_IMAGE_DATA { 29 imageData: *const c_void, 30 imageDataSize: UINT32, 31 uniqueDataId: UINT32, 32 pixelsPerEm: UINT32, 33 pixelSize: D2D1_SIZE_U, 34 horizontalLeftOrigin: D2D1_POINT_2L, 35 horizontalRightOrigin: D2D1_POINT_2L, 36 verticalTopOrigin: D2D1_POINT_2L, 37 verticalBottomOrigin: D2D1_POINT_2L, 38 }} 39 ENUM!{enum D2D1_ALPHA_MODE { 40 D2D1_ALPHA_MODE_UNKNOWN = 0, 41 D2D1_ALPHA_MODE_PREMULTIPLIED = 1, 42 D2D1_ALPHA_MODE_STRAIGHT = 2, 43 D2D1_ALPHA_MODE_IGNORE = 3, 44 }} 45 STRUCT!{struct D2D1_PIXEL_FORMAT { 46 format: DXGI_FORMAT, 47 alphaMode: D2D1_ALPHA_MODE, 48 }} 49 STRUCT!{struct D2D_POINT_2U { 50 x: UINT32, 51 y: UINT32, 52 }} 53 STRUCT!{struct D2D_POINT_2F { 54 x: FLOAT, 55 y: FLOAT, 56 }} 57 pub type D2D_POINT_2L = POINT; 58 STRUCT!{struct D2D_VECTOR_2F { 59 x: FLOAT, 60 y: FLOAT, 61 }} 62 STRUCT!{struct D2D_VECTOR_3F { 63 x: FLOAT, 64 y: FLOAT, 65 z: FLOAT, 66 }} 67 STRUCT!{struct D2D_VECTOR_4F { 68 x: FLOAT, 69 y: FLOAT, 70 z: FLOAT, 71 w: FLOAT, 72 }} 73 STRUCT!{struct D2D_RECT_F { 74 left: FLOAT, 75 top: FLOAT, 76 right: FLOAT, 77 bottom: FLOAT, 78 }} 79 STRUCT!{struct D2D_RECT_U { 80 left: UINT32, 81 top: UINT32, 82 right: UINT32, 83 bottom: UINT32, 84 }} 85 pub type D2D_RECT_L = RECT; 86 STRUCT!{struct D2D_SIZE_F { 87 width: FLOAT, 88 height: FLOAT, 89 }} 90 STRUCT!{struct D2D_SIZE_U { 91 width: UINT32, 92 height: UINT32, 93 }} 94 STRUCT!{struct D2D_MATRIX_3X2_F { 95 matrix: [[FLOAT; 2]; 3], 96 }} 97 STRUCT!{struct D2D_MATRIX_4X3_F { 98 matrix: [[FLOAT; 3]; 4], 99 }} 100 STRUCT!{struct D2D_MATRIX_4X4_F { 101 matrix: [[FLOAT; 4]; 4], 102 }} 103 STRUCT!{struct D2D_MATRIX_5X4_F { 104 matrix: [[FLOAT; 4]; 5], 105 }} 106 pub type D2D1_POINT_2F = D2D_POINT_2F; 107 pub type D2D1_POINT_2U = D2D_POINT_2U; 108 pub type D2D1_POINT_2L = D2D_POINT_2L; 109 pub type D2D1_RECT_F = D2D_RECT_F; 110 pub type D2D1_RECT_U = D2D_RECT_U; 111 pub type D2D1_RECT_L = D2D_RECT_L; 112 pub type D2D1_SIZE_F = D2D_SIZE_F; 113 pub type D2D1_SIZE_U = D2D_SIZE_U; 114 pub type D2D1_MATRIX_3X2_F = D2D_MATRIX_3X2_F; 115