1 // Copyright © 2015, Connor Hilarides
2 // Licensed under the MIT License <LICENSE.md>
3 //! Mappings for the contents of d2d1.h
4 // Types confirmed affected by the ABI issue:
5 // D2D1_SIZE_F, D2D1_SIZE_U, D2D1_COLOR_F, D2D1_PIXEL_FORMAT,
6 // D2D1_POINT_2F
7 pub const D2D1_DEFAULT_FLATTENING_TOLERANCE: ::FLOAT = 0.25;
8 pub const D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR: ::DWORD = 0;
9 pub const D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR: ::DWORD = 1;
10 pub const D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC: ::DWORD = 2;
11 pub const D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR: ::DWORD = 3;
12 pub const D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC: ::DWORD = 4;
13 pub const D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC: ::DWORD = 5;
14 pub const D2D1_INTERPOLATION_MODE_DEFINITION_FANT: ::DWORD = 6;
15 pub const D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR: ::DWORD = 7;
16 ENUM!{enum D2D1_GAMMA {
17     D2D1_GAMMA_2_2 = 0,
18     D2D1_GAMMA_1_0 = 1,
19 }}
20 ENUM!{enum D2D1_OPACITY_MASK_CONTENT {
21     D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0,
22     D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1,
23     D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2,
24 }}
25 ENUM!{enum D2D1_EXTEND_MODE {
26     D2D1_EXTEND_MODE_CLAMP = 0,
27     D2D1_EXTEND_MODE_WRAP = 1,
28     D2D1_EXTEND_MODE_MIRROR = 2,
29 }}
30 ENUM!{enum D2D1_ANTIALIAS_MODE {
31     D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0,
32     D2D1_ANTIALIAS_MODE_ALIASED = 1,
33 }}
34 ENUM!{enum D2D1_TEXT_ANTIALIAS_MODE {
35     D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0,
36     D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1,
37     D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2,
38     D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3,
39 }}
40 ENUM!{enum D2D1_BITMAP_INTERPOLATION_MODE {
41     D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR =
42         D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR,
43     D2D1_BITMAP_INTERPOLATION_MODE_LINEAR =
44         D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR,
45 }}
46 FLAGS!{enum D2D1_DRAW_TEXT_OPTIONS {
47     D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001,
48     D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002,
49     D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004,
50     D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000,
51 }}
52 pub type D2D1_POINT_2U = ::D2D_POINT_2U;
53 pub type D2D1_POINT_2F = ::D2D_POINT_2F;
54 pub type D2D1_RECT_F = ::D2D_RECT_F;
55 pub type D2D1_RECT_U = ::D2D_RECT_U;
56 pub type D2D1_SIZE_F = ::D2D_SIZE_F;
57 pub type D2D1_SIZE_U = ::D2D_SIZE_U;
58 pub type D2D1_COLOR_F = ::D2D_COLOR_F;
59 pub type D2D1_MATRIX_3X2_F = ::D2D_MATRIX_3X2_F;
60 pub type D2D1_TAG = ::UINT64;
61 STRUCT!{struct D2D1_BITMAP_PROPERTIES {
62     pixelFormat: ::D2D1_PIXEL_FORMAT,
63     dpiX: ::FLOAT,
64     dpiY: ::FLOAT,
65 }}
66 STRUCT!{struct D2D1_GRADIENT_STOP {
67     position: ::FLOAT,
68     color: D2D1_COLOR_F,
69 }}
70 STRUCT!{struct D2D1_BRUSH_PROPERTIES {
71     opacity: ::FLOAT,
72     transform: D2D1_MATRIX_3X2_F,
73 }}
74 STRUCT!{struct D2D1_BITMAP_BRUSH_PROPERTIES {
75     extendModeX: D2D1_EXTEND_MODE,
76     extendModeY: D2D1_EXTEND_MODE,
77     interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE,
78 }}
79 STRUCT!{struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES {
80     startPoint: ::D2D1_POINT_2F,
81     endPoint: ::D2D1_POINT_2F,
82 }}
83 STRUCT!{struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES {
84     center: ::D2D1_POINT_2F,
85     gradientOriginOffset: ::D2D1_POINT_2F,
86     radiusX: ::FLOAT,
87     radiusY: ::FLOAT,
88 }}
89 ENUM!{enum D2D1_ARC_SIZE {
90     D2D1_ARC_SIZE_SMALL = 0,
91     D2D1_ARC_SIZE_LARGE = 1,
92 }}
93 ENUM!{enum D2D1_CAP_STYLE {
94     D2D1_CAP_STYLE_FLAT = 0,
95     D2D1_CAP_STYLE_SQUARE = 1,
96     D2D1_CAP_STYLE_ROUND = 2,
97     D2D1_CAP_STYLE_TRIANGLE = 3,
98 }}
99 ENUM!{enum D2D1_DASH_STYLE {
100     D2D1_DASH_STYLE_SOLID = 0,
101     D2D1_DASH_STYLE_DASH = 1,
102     D2D1_DASH_STYLE_DOT = 2,
103     D2D1_DASH_STYLE_DASH_DOT = 3,
104     D2D1_DASH_STYLE_DASH_DOT_DOT = 4,
105     D2D1_DASH_STYLE_CUSTOM = 5,
106 }}
107 ENUM!{enum D2D1_LINE_JOIN {
108     D2D1_LINE_JOIN_MITER = 0,
109     D2D1_LINE_JOIN_BEVEL = 1,
110     D2D1_LINE_JOIN_ROUND = 2,
111     D2D1_LINE_JOIN_MITER_OR_BEVEL = 3,
112 }}
113 ENUM!{enum D2D1_COMBINE_MODE {
114     D2D1_COMBINE_MODE_UNION = 0,
115     D2D1_COMBINE_MODE_INTERSECT = 1,
116     D2D1_COMBINE_MODE_XOR = 2,
117     D2D1_COMBINE_MODE_EXCLUDE = 3,
118 }}
119 ENUM!{enum D2D1_GEOMETRY_RELATION {
120     D2D1_GEOMETRY_RELATION_UNKNOWN = 0,
121     D2D1_GEOMETRY_RELATION_DISJOINT = 1,
122     D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2,
123     D2D1_GEOMETRY_RELATION_CONTAINS = 3,
124     D2D1_GEOMETRY_RELATION_OVERLAP = 4,
125 }}
126 ENUM!{enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION {
127     D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0,
128     D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1,
129 }}
130 ENUM!{enum D2D1_FIGURE_BEGIN {
131     D2D1_FIGURE_BEGIN_FILLED = 0,
132     D2D1_FIGURE_BEGIN_HOLLOW = 1,
133 }}
134 ENUM!{enum D2D1_FIGURE_END {
135     D2D1_FIGURE_END_OPEN = 0,
136     D2D1_FIGURE_END_CLOSED = 1,
137 }}
138 STRUCT!{struct D2D1_BEZIER_SEGMENT {
139     point1: ::D2D1_POINT_2F,
140     point2: ::D2D1_POINT_2F,
141     point3: ::D2D1_POINT_2F,
142 }}
143 STRUCT!{struct D2D1_TRIANGLE {
144     point1: ::D2D1_POINT_2F,
145     point2: ::D2D1_POINT_2F,
146     point3: ::D2D1_POINT_2F,
147 }}
148 FLAGS!{enum D2D1_PATH_SEGMENT {
149     D2D1_PATH_SEGMENT_NONE = 0x00000000,
150     D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001,
151     D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002,
152 }}
153 ENUM!{enum D2D1_SWEEP_DIRECTION {
154     D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0,
155     D2D1_SWEEP_DIRECTION_CLOCKWISE = 1,
156 }}
157 ENUM!{enum D2D1_FILL_MODE {
158     D2D1_FILL_MODE_ALTERNATE = 0,
159     D2D1_FILL_MODE_WINDING = 1,
160 }}
161 STRUCT!{struct D2D1_ARC_SEGMENT {
162     point: ::D2D1_POINT_2F,
163     size: D2D1_SIZE_F,
164     rotationAngle: ::FLOAT,
165     sweepDirection: D2D1_SWEEP_DIRECTION,
166     arcSize: D2D1_ARC_SIZE,
167 }}
168 STRUCT!{struct D2D1_QUADRATIC_BEZIER_SEGMENT {
169     point1: ::D2D1_POINT_2F,
170     point2: ::D2D1_POINT_2F,
171 }}
172 STRUCT!{struct D2D1_ELLIPSE {
173     point: ::D2D1_POINT_2F,
174     radiusX: ::FLOAT,
175     radiusY: ::FLOAT,
176 }}
177 STRUCT!{struct D2D1_ROUNDED_RECT {
178     rect: ::D2D1_RECT_F,
179     radiusX: ::FLOAT,
180     radiusY: ::FLOAT,
181 }}
182 STRUCT!{struct D2D1_STROKE_STYLE_PROPERTIES {
183     startCap: D2D1_CAP_STYLE,
184     endCap: D2D1_CAP_STYLE,
185     dashCap: D2D1_CAP_STYLE,
186     lineJoin: D2D1_LINE_JOIN,
187     miterLimit: ::FLOAT,
188     dashStyle: D2D1_DASH_STYLE,
189     dashOffset: ::FLOAT,
190 }}
191 FLAGS!{enum D2D1_LAYER_OPTIONS {
192     D2D1_LAYER_OPTIONS_NONE = 0x00000000,
193     D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001,
194 }}
195 STRUCT!{struct D2D1_LAYER_PARAMETERS {
196     contentBounds: ::D2D1_RECT_F,
197     geometricMask: *mut ID2D1Geometry,
198     maskAntialiasMode: D2D1_ANTIALIAS_MODE,
199     maskTransform: D2D1_MATRIX_3X2_F,
200     opacity: ::FLOAT,
201     opacityBrush: *mut ID2D1Brush,
202     layerOptions: D2D1_LAYER_OPTIONS,
203 }}
204 ENUM!{enum D2D1_WINDOW_STATE {
205     D2D1_WINDOW_STATE_NONE = 0x0000000,
206     D2D1_WINDOW_STATE_OCCLUDED = 0x0000001,
207 }}
208 ENUM!{enum D2D1_RENDER_TARGET_TYPE {
209     D2D1_RENDER_TARGET_TYPE_DEFAULT = 0,
210     D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1,
211     D2D1_RENDER_TARGET_TYPE_HARDWARE = 2,
212 }}
213 ENUM!{enum D2D1_FEATURE_LEVEL {
214     D2D1_FEATURE_LEVEL_DEFAULT = 0,
215     D2D1_FEATURE_LEVEL_9 = ::D3D_FEATURE_LEVEL_9_1.0,
216     D2D1_FEATURE_LEVEL_10 = ::D3D_FEATURE_LEVEL_10_0.0,
217 }}
218 FLAGS!{enum D2D1_RENDER_TARGET_USAGE {
219     D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000,
220     D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001,
221     D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002,
222 }}
223 FLAGS!{enum D2D1_PRESENT_OPTIONS {
224     D2D1_PRESENT_OPTIONS_NONE = 0x00000000,
225     D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001,
226     D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002,
227 }}
228 STRUCT!{struct D2D1_RENDER_TARGET_PROPERTIES {
229     _type: D2D1_RENDER_TARGET_TYPE,
230     pixelFormat: ::D2D1_PIXEL_FORMAT,
231     dpiX: ::FLOAT,
232     dpiY: ::FLOAT,
233     usage: D2D1_RENDER_TARGET_USAGE,
234     minLevel: D2D1_FEATURE_LEVEL,
235 }}
236 STRUCT!{struct D2D1_HWND_RENDER_TARGET_PROPERTIES {
237     hwnd: ::HWND,
238     pixelSize: D2D1_SIZE_U,
239     presentOptions: D2D1_PRESENT_OPTIONS,
240 }}
241 FLAGS!{enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS {
242     D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000,
243     D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001,
244 }}
245 STRUCT!{struct D2D1_DRAWING_STATE_DESCRIPTION {
246     antialiasMode: D2D1_ANTIALIAS_MODE,
247     textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE,
248     tag1: D2D1_TAG,
249     tag2: D2D1_TAG,
250     transform: D2D1_MATRIX_3X2_F,
251 }}
252 ENUM!{enum D2D1_DC_INITIALIZE_MODE {
253     D2D1_DC_INITIALIZE_MODE_COPY = 0,
254     D2D1_DC_INITIALIZE_MODE_CLEAR = 1,
255 }}
256 ENUM!{enum D2D1_DEBUG_LEVEL {
257     D2D1_DEBUG_LEVEL_NONE = 0,
258     D2D1_DEBUG_LEVEL_ERROR = 1,
259     D2D1_DEBUG_LEVEL_WARNING = 2,
260     D2D1_DEBUG_LEVEL_INFORMATION = 3,
261 }}
262 ENUM!{enum D2D1_FACTORY_TYPE {
263     D2D1_FACTORY_TYPE_SINGLE_THREADED = 0,
264     D2D1_FACTORY_TYPE_MULTI_THREADED = 1,
265 }}
266 STRUCT!{struct D2D1_FACTORY_OPTIONS {
267     debugLevel: D2D1_DEBUG_LEVEL,
268 }}
269 RIDL!(
270 interface ID2D1Resource(ID2D1ResourceVtbl): IUnknown(IUnknownVtbl) {
271     fn GetFactory(&mut self, factory: *mut *mut ID2D1Factory) -> ()
272 });
273 RIDL!(
274 interface ID2D1Image(ID2D1ImageVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
275 });
276 RIDL!(
277 interface ID2D1Bitmap(ID2D1BitmapVtbl): ID2D1Image(ID2D1ImageVtbl) {
278     fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F, // FIXME: ABI issue
279     fn GetPixelSize(&mut self, ret: *mut D2D1_SIZE_U) -> *mut D2D1_SIZE_U, // FIXME: ABI issue
280     fn GetPixelFormat(
281         &mut self, ret: *mut ::D2D1_PIXEL_FORMAT
282     ) -> *mut ::D2D1_PIXEL_FORMAT, // FIXME: ABI issue
283     fn GetDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (),
284     fn CopyFromBitmap(
285         &mut self, destPoint: *const ::D2D1_POINT_2U, bitmap: *mut ID2D1Bitmap,
286         srcRect: *const ::D2D1_RECT_U
287     ) -> ::HRESULT,
288     fn CopyFromRenderTarget(
289         &mut self, destPoint: *const ::D2D1_POINT_2U, renderTarget: *mut ID2D1RenderTarget,
290         srcRect: *const ::D2D1_RECT_U
291     ) -> ::HRESULT,
292     fn CopyFromMemory(
293         &mut self, dstRect: *const ::D2D1_RECT_U, srcData: *const ::c_void, pitch: ::UINT32
294     ) -> ::HRESULT
295 });
296 RIDL!(
297 interface ID2D1GradientStopCollection(ID2D1GradientStopCollectionVtbl)
298     : ID2D1Resource(ID2D1ResourceVtbl) {
299     fn GetGradientStopCount(&mut self) -> ::UINT32,
300     fn GetGradientStops(
301         &mut self, gradientStops: *mut D2D1_GRADIENT_STOP, gradientStopsCount: ::UINT32
302     ) -> (),
303     fn GetColorInterpolationGamma(&mut self) -> D2D1_GAMMA,
304     fn GetExtendMode(&mut self) -> D2D1_EXTEND_MODE
305 });
306 RIDL!(
307 interface ID2D1Brush(ID2D1BrushVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
308     fn SetOpacity(&mut self, opacity: ::FLOAT) -> (),
309     fn SetTransform(&mut self, transform: *const D2D1_MATRIX_3X2_F) -> (),
310     fn GetOpacity(&mut self) -> ::FLOAT,
311     fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> ()
312 });
313 RIDL!(
314 interface ID2D1BitmapBrush(ID2D1BitmapBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) {
315     fn SetExtendModeX(&mut self, extendModeX: D2D1_EXTEND_MODE) -> (),
316     fn SetExtendModeY(&mut self, extendModeY: D2D1_EXTEND_MODE) -> (),
317     fn SetInterpolationMode(&mut self, interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE) -> (),
318     fn SetBitmap(&mut self, bitmap: *mut ID2D1Bitmap) -> (),
319     fn GetExtendModeX(&mut self) -> D2D1_EXTEND_MODE,
320     fn GetExtendModeY(&mut self) -> D2D1_EXTEND_MODE,
321     fn GetInterpolationMode(&mut self) -> D2D1_BITMAP_INTERPOLATION_MODE,
322     fn GetBitmap(&mut self, bitmap: *mut *mut ID2D1Bitmap) -> ()
323 });
324 RIDL!(
325 interface ID2D1SolidColorBrush(ID2D1SolidColorBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) {
326     fn SetColor(&mut self, color: *const D2D1_COLOR_F) -> (),
327     fn GetColor(&mut self, color: *mut D2D1_COLOR_F) -> *mut D2D1_COLOR_F
328 });
329 RIDL!(
330 interface ID2D1LinearGradientBrush(ID2D1LinearGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) {
331     fn SetStartPoint(&mut self, startPoint: ::D2D1_POINT_2F) -> (),
332     fn SetEndPoint(&mut self, endPoint: ::D2D1_POINT_2F) -> (),
333     fn GetStartPoint(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue
334     fn GetEndPoint(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue
335     fn GetGradientStopCollection(
336         &mut self, gradientStopCollection: *mut *mut ID2D1GradientStopCollection
337     ) -> ()
338 });
339 RIDL!(
340 interface ID2D1RadialGradientBrush(ID2D1RadialGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) {
341     fn SetCenter(&mut self, center: ::D2D1_POINT_2F) -> (),
342     fn SetGradientOriginOffset(&mut self, gradientOriginOffset: ::D2D1_POINT_2F) -> (),
343     fn SetRadiusX(&mut self, radiusX: ::FLOAT) -> (),
344     fn SetRadiusY(&mut self, radiusY: ::FLOAT) -> (),
345     fn GetCenter(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue
346     fn GetGradientOriginOffset(
347         &mut self, ret: *mut D2D1_POINT_2F
348     ) -> *mut D2D1_POINT_2F, // FIXME ABI issue
349     fn GetRadiusX(&mut self) -> ::FLOAT,
350     fn GetRadiusY(&mut self) -> ::FLOAT,
351     fn GetGradientStopCollection(
352         &mut self, gradientStopCollection: *mut *mut ID2D1GradientStopCollection
353     ) -> ()
354 });
355 RIDL!(
356 interface ID2D1StrokeStyle(ID2D1StrokeStyleVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
357     fn GetStartCap(&mut self) -> D2D1_CAP_STYLE,
358     fn GetEndCap(&mut self) -> D2D1_CAP_STYLE,
359     fn GetDashCap(&mut self) -> D2D1_CAP_STYLE,
360     fn GetMiterLimit(&mut self) -> ::FLOAT,
361     fn GetLineJoin(&mut self) -> D2D1_LINE_JOIN,
362     fn GetDashOffset(&mut self) -> ::FLOAT,
363     fn GetDashStyle(&mut self) -> D2D1_DASH_STYLE,
364     fn GetDashesCount(&mut self) -> ::UINT32,
365     fn GetDashes(&mut self, dashes: *mut ::FLOAT, dashesCount: ::UINT32) -> ()
366 });
367 RIDL!(
368 interface ID2D1Geometry(ID2D1GeometryVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
369     fn GetBounds(
370         &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, bounds: *mut ::D2D1_RECT_F
371     ) -> ::HRESULT,
372     fn GetWidenedBounds(
373         &mut self, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle,
374         worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
375         bounds: *mut ::D2D1_RECT_F
376     ) -> ::HRESULT,
377     fn StrokeContainsPoint(
378         &mut self, point: ::D2D1_POINT_2F, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle,
379         worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
380         contains: *mut ::BOOL
381     ) -> ::HRESULT,
382     fn FillContainsPoint(
383         &mut self, point: ::D2D1_POINT_2F, worldTransform: *const D2D1_MATRIX_3X2_F,
384         flatteningTolerance: ::FLOAT, contains: *mut ::BOOL
385     ) -> ::HRESULT,
386     fn CompareWithGeometry(
387         &mut self, inputGeometry: *mut ID2D1Geometry,
388         inputGeometryTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
389         relation: *mut D2D1_GEOMETRY_RELATION
390     ) -> ::HRESULT,
391     fn Simplify(
392         &mut self, simplificationOption: D2D1_GEOMETRY_SIMPLIFICATION_OPTION,
393         worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
394         geometrySink: *mut ID2D1SimplifiedGeometrySink
395     ) -> ::HRESULT,
396     fn Tessellate(
397         &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
398         tessellationSink: *mut ID2D1TessellationSink
399     ) -> ::HRESULT,
400     fn CombineWithGeometry(
401         &mut self, inputGeometry: *mut ID2D1Geometry, combineMode: D2D1_COMBINE_MODE,
402         inputGeometryTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
403         geometrySink: *mut ID2D1SimplifiedGeometrySink
404     ) -> ::HRESULT,
405     fn Outline(
406         &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
407         geometrySink: *mut ID2D1SimplifiedGeometrySink
408     ) -> ::HRESULT,
409     fn ComputeArea(
410         &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
411         area: *mut ::FLOAT
412     ) -> ::HRESULT,
413     fn ComputeLength(
414         &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
415         length: *mut ::FLOAT
416     ) -> ::HRESULT,
417     fn ComputePointAtLength(
418         &mut self, length: ::FLOAT, worldTransform: *const D2D1_MATRIX_3X2_F,
419         flatteningTolerance: ::FLOAT, point: *mut ::D2D1_POINT_2F,
420         unitTangentVector: *mut ::D2D1_POINT_2F
421     ) -> ::HRESULT,
422     fn Widen(
423         &mut self, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle,
424         worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT,
425         geometrySink: *mut ID2D1SimplifiedGeometrySink
426     ) -> ::HRESULT
427 });
428 RIDL!(
429 interface ID2D1RectangleGeometry(ID2D1RectangleGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) {
430     fn GetRect(&mut self, rect: *mut ::D2D1_RECT_F) -> ()
431 });
432 RIDL!(
433 interface ID2D1RoundedRectangleGeometry(ID2D1RoundedRectangleGeometryVtbl)
434     : ID2D1Geometry(ID2D1GeometryVtbl) {
435     fn GetRoundedRect(&mut self, roundedRect: *mut D2D1_ROUNDED_RECT) -> ()
436 });
437 RIDL!(
438 interface ID2D1EllipseGeometry(ID2D1EllipseGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) {
439     fn GetEllipse(&mut self, ellipse: *mut D2D1_ELLIPSE) -> ()
440 });
441 RIDL!(
442 interface ID2D1GeometryGroup(ID2D1GeometryGroupVtbl): ID2D1Geometry(ID2D1GeometryVtbl) {
443     fn GetFillMode(&mut self) -> D2D1_FILL_MODE,
444     fn GetSourceGeometryCount(&mut self) -> ::UINT32,
445     fn GetSourceGeometries(
446         &mut self, geometries: *mut *mut ID2D1Geometry, geometriesCount: ::UINT32
447     ) -> ()
448 });
449 RIDL!(
450 interface ID2D1TransformedGeometry(ID2D1TransformedGeometryVtbl)
451     : ID2D1Geometry(ID2D1GeometryVtbl) {
452     fn GetSourceGeometry(&mut self, sourceGeometry: *mut *mut ID2D1Geometry) -> (),
453     fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> ()
454 });
455 RIDL!(
456 interface ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl): IUnknown(IUnknownVtbl) {
457     fn SetFillMode(&mut self, fillMode: D2D1_FILL_MODE) -> (),
458     fn SetSegmentFlags(&mut self, vertexFlags: D2D1_PATH_SEGMENT) -> (),
459     fn BeginFigure(&mut self, startPoint: ::D2D1_POINT_2F, figureBegin: D2D1_FIGURE_BEGIN) -> (),
460     fn AddLines(&mut self, points: *const ::D2D1_POINT_2F, pointsCount: ::UINT32) -> (),
461     fn AddBeziers(&mut self, beziers: *const D2D1_BEZIER_SEGMENT, beziersCount: ::UINT32) -> (),
462     fn EndFigure(&mut self, figureEnd: D2D1_FIGURE_END) -> (),
463     fn Close(&mut self) -> ::HRESULT
464 });
465 RIDL!(
466 interface ID2D1GeometrySink(ID2D1GeometrySinkVtbl)
467     : ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl) {
468     fn AddLine(&mut self, point: ::D2D1_POINT_2F) -> (),
469     fn AddBezier(&mut self, bezier: *const D2D1_BEZIER_SEGMENT) -> (),
470     fn AddQuadraticBezier(&mut self, bezier: *const D2D1_QUADRATIC_BEZIER_SEGMENT) -> (),
471     fn AddQuadraticBeziers(
472         &mut self, beziers: *const D2D1_QUADRATIC_BEZIER_SEGMENT, beziersCount: ::UINT32
473     ) -> (),
474     fn AddArc(&mut self, arc: *const D2D1_ARC_SEGMENT) -> ()
475 });
476 RIDL!(
477 interface ID2D1TessellationSink(ID2D1TessellationSinkVtbl): IUnknown(IUnknownVtbl) {
478     fn AddTriangles(&mut self, triangles: *const D2D1_TRIANGLE, triangleCount: ::UINT32) -> (),
479     fn Close(&mut self) -> ::HRESULT
480 });
481 RIDL!(
482 interface ID2D1PathGeometry(ID2D1PathGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) {
483     fn Open(&mut self, geometrySink: *mut *mut ID2D1GeometrySink) -> ::HRESULT,
484     fn Stream(&mut self, geometrySink: *mut ID2D1GeometrySink) -> ::HRESULT,
485     fn GetSegmentCount(&mut self, count: *mut ::UINT32) -> ::HRESULT,
486     fn GetFigureCount(&mut self, count: *mut ::UINT32) -> ::HRESULT
487 });
488 RIDL!(
489 interface ID2D1Mesh(ID2D1MeshVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
490     fn Open(&mut self, tessellationSink: *mut *mut ID2D1TessellationSink) -> ::HRESULT
491 });
492 RIDL!(
493 interface ID2D1Layer(ID2D1LayerVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
494     fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F // FIXME: ABI issue
495 });
496 RIDL!(
497 interface ID2D1DrawingStateBlock(ID2D1DrawingStateBlockVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
498     fn GetDescription(&mut self, stateDescription: *mut D2D1_DRAWING_STATE_DESCRIPTION) -> (),
499     fn SetDescription(&mut self, stateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION) -> (),
500     fn SetTextRenderingParams(
501         &mut self, textRenderingParams: *mut ::IDWriteRenderingParams
502     ) -> (),
503     fn GetTextRenderingParams(
504         &mut self, textRenderingParams: *mut *mut ::IDWriteRenderingParams
505     ) -> ()
506 });
507 RIDL!(
508 interface ID2D1RenderTarget(ID2D1RenderTargetVtbl): ID2D1Resource(ID2D1ResourceVtbl) {
509     fn CreateBitmap(
510         &mut self, size: D2D1_SIZE_U, srcData: *const ::c_void, pitch: ::UINT32,
511         bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap
512     ) -> ::HRESULT,
513     fn CreateBitmapFromWicBitmap(
514         &mut self, wicBitmapSource: *mut ::IWICBitmapSource,
515         bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap
516     ) -> ::HRESULT,
517     fn CreateSharedBitmap(
518         &mut self, riid: ::REFIID, data: *const ::c_void,
519         bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap
520     ) -> ::HRESULT,
521     fn CreateBitmapBrush(
522         &mut self, bitmap: *mut ID2D1Bitmap,
523         bitmapBrushProperties: *const D2D1_BITMAP_BRUSH_PROPERTIES,
524         brushProperties: *const D2D1_BRUSH_PROPERTIES, bitmapBrush: *mut *mut ID2D1BitmapBrush
525     ) -> ::HRESULT,
526     fn CreateSolidColorBrush(
527         &mut self, color: *const D2D1_COLOR_F, brushProperties: *const D2D1_BRUSH_PROPERTIES,
528         solidColorBrush: *mut *mut ID2D1SolidColorBrush
529     ) -> ::HRESULT,
530     fn CreateGradientStopCollection(
531         &mut self, gradientStops: *const D2D1_GRADIENT_STOP, gradientStopsCount: ::UINT32,
532         colorInterpolationGamma: D2D1_GAMMA, extendMode: D2D1_EXTEND_MODE,
533         gradientStopCollection: *mut *mut ID2D1GradientStopCollection
534     ) -> ::HRESULT,
535     fn CreateLinearGradientBrush(
536         &mut self, linearGradientBrushProperties: *const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES,
537         brushProperties: *const D2D1_BRUSH_PROPERTIES,
538         gradientStopCollection: *mut ID2D1GradientStopCollection,
539         linearGradientBrush: *mut *mut ID2D1LinearGradientBrush
540     ) -> ::HRESULT,
541     fn CreateRadialGradientBrush(
542         &mut self, radialGradientBrushProperties: *const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES,
543         brushProperties: *const D2D1_BRUSH_PROPERTIES,
544         gradientStopCollection: *mut ID2D1GradientStopCollection,
545         radialGradientBrush: *mut *mut ID2D1RadialGradientBrush
546     ) -> ::HRESULT,
547     fn CreateCompatibleRenderTarget(
548         &mut self, desiredSize: *const D2D1_SIZE_F, desiredPixelSize: *const D2D1_SIZE_U,
549         desiredFormat: *const ::D2D1_PIXEL_FORMAT, options: D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS,
550         bitmapRenderTarget: *mut *mut ID2D1BitmapRenderTarget
551     ) -> ::HRESULT,
552     fn CreateLayer(&mut self, size: *const D2D1_SIZE_F, layer: *mut *mut ID2D1Layer) -> ::HRESULT,
553     fn CreateMesh(&mut self, mesh: *mut *mut ID2D1Mesh) -> ::HRESULT,
554     fn DrawLine(
555         &mut self, point0: ::D2D1_POINT_2F, point1: ::D2D1_POINT_2F, brush: *mut ID2D1Brush,
556         strokeWidth: ::FLOAT, strokeStype: *mut ID2D1StrokeStyle
557     ) -> (),
558     fn DrawRectangle(
559         &mut self, rect: *const ::D2D1_RECT_F, brush: *mut ID2D1Brush,
560         strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle
561     ) -> (),
562     fn FillRectangle(
563         &mut self, rect: *const ::D2D1_RECT_F, brush: *mut ID2D1Brush
564     ) -> (),
565     fn DrawRoundedRectangle(
566         &mut self, roundedRect: *const D2D1_ROUNDED_RECT, brush: *mut ID2D1Brush,
567         strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle
568     ) -> (),
569     fn FillRoundedRectangle(
570         &mut self, roundedRect: *const D2D1_ROUNDED_RECT, brush: *mut ID2D1Brush
571     ) -> (),
572     fn DrawEllipse(
573         &mut self, ellipse: *const D2D1_ELLIPSE, brush: *mut ID2D1Brush,
574         strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle
575     ) -> (),
576     fn FillEllipse(
577         &mut self, ellipse: *const D2D1_ELLIPSE, brush: *mut ID2D1Brush
578     ) -> (),
579     fn DrawGeometry(
580         &mut self, geometry: *mut ID2D1Geometry, brush: *mut ID2D1Brush,
581         strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle
582     ) -> (),
583     fn FillGeometry(
584         &mut self, geometry: *mut ID2D1Geometry, brush: *mut ID2D1Brush,
585         opacityBrush: *mut ID2D1Brush
586     ) -> (),
587     fn FillMesh(
588         &mut self, mesh: *mut ID2D1Mesh, brush: *const ID2D1Brush
589     ) -> (),
590     fn FillOpacityMask(
591         &mut self, opacityMask: *mut ID2D1Bitmap, brush: *mut ID2D1Brush,
592         content: D2D1_OPACITY_MASK_CONTENT, destinationRectangle: *const ::D2D1_RECT_F,
593         sourceRectangle: *const ::D2D1_RECT_F
594     ) -> (),
595     fn DrawBitmap(
596         &mut self, bitmap: *mut ID2D1Bitmap, destinationRectangle: *const ::D2D1_RECT_F,
597         opacity: ::FLOAT, interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE,
598         sourceRectangle: *const ::D2D1_RECT_F
599     ) -> (),
600     fn DrawText(
601         &mut self, string: *const ::WCHAR, stringLength: ::UINT32,
602         textFormat: *mut ::IDWriteTextFormat, layoutRect: *const ::D2D1_RECT_F,
603         defaultForegroundBrush: *mut ID2D1Brush, options: D2D1_DRAW_TEXT_OPTIONS,
604         measuringMode: ::DWRITE_MEASURING_MODE
605     ) -> (),
606     fn DrawTextLayout(
607         &mut self, origin: ::D2D1_POINT_2F, textLayout: *mut ::IDWriteTextLayout,
608         defaultForegroundBrush: *mut ID2D1Brush, options: D2D1_DRAW_TEXT_OPTIONS
609     ) -> (),
610     fn DrawGlyphRun(
611         &mut self, baselineOrigin: ::D2D1_POINT_2F, glyphRun: *const ::DWRITE_GLYPH_RUN,
612         foregroundBrush: *mut ID2D1Brush, measuringMode: ::DWRITE_MEASURING_MODE
613     ) -> (),
614     fn SetTransform(&mut self, transform: *const D2D1_MATRIX_3X2_F) -> (),
615     fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> (),
616     fn SetAntialiasMode(&mut self, antialiasMode: D2D1_ANTIALIAS_MODE) -> (),
617     fn GetAntialiasMode(&mut self) -> D2D1_ANTIALIAS_MODE,
618     fn SetTextAntialiasMode(&mut self, textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE) -> (),
619     fn GetTextAntialiasMode(&mut self) -> D2D1_TEXT_ANTIALIAS_MODE,
620     fn SetTextRenderingParams(
621         &mut self, textRenderingParams: *mut ::IDWriteRenderingParams
622     ) -> (),
623     fn GetTextRenderingParams(
624         &mut self, textRenderingParams: *mut *mut ::IDWriteRenderingParams
625     ) -> (),
626     fn SetTags(&mut self, tag1: D2D1_TAG, tag2: D2D1_TAG) -> (),
627     fn GetTags(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> (),
628     fn PushLayer(
629         &mut self, layerParameters: *const D2D1_LAYER_PARAMETERS, layer: *mut ID2D1Layer
630     ) -> (),
631     fn PopLayer(&mut self) -> (),
632     fn Flush(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> ::HRESULT,
633     fn SaveDrawingState(&mut self, drawingStateBlock: *mut ID2D1DrawingStateBlock) -> (),
634     fn RestoreDrawingState(&mut self, drawingStateBlock: *mut ID2D1DrawingStateBlock) -> (),
635     fn PushAxisAlignedClip(
636         &mut self, clipRect: *const ::D2D1_RECT_F, antialiasMode: D2D1_ANTIALIAS_MODE
637     ) -> (),
638     fn PopAxisAlignedClip(&mut self) -> (),
639     fn Clear(&mut self, clearColor: *const D2D1_COLOR_F) -> (),
640     fn BeginDraw(&mut self) -> (),
641     fn EndDraw(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> ::HRESULT,
642     fn GetPixelFormat(
643         &mut self, ret: *mut ::D2D1_PIXEL_FORMAT
644     ) -> *mut ::D2D1_PIXEL_FORMAT, // FIXME: ABI issue
645     fn SetDpi(&mut self, dpiX: ::FLOAT, dpiY: ::FLOAT) -> (),
646     fn GetDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (),
647     fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F, // FIXME: ABI issue
648     fn GetPixelSize(&mut self, ret: *mut D2D1_SIZE_U) -> *mut D2D1_SIZE_U, // FIXME: ABI issue
649     fn GetMaximumBitmapSize(&mut self) -> ::UINT32,
650     fn IsSupported(
651         &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES
652     ) -> ::BOOL
653 });
654 RIDL!(
655 interface ID2D1BitmapRenderTarget(ID2D1BitmapRenderTargetVtbl)
656     : ID2D1RenderTarget(ID2D1RenderTargetVtbl) {
657     fn GetBitmap(&mut self, bitmap: *mut *mut ID2D1Bitmap) -> ::HRESULT
658 });
659 RIDL!(
660 interface ID2D1HwndRenderTarget(ID2D1HwndRenderTargetVtbl)
661     : ID2D1RenderTarget(ID2D1RenderTargetVtbl) {
662     fn CheckWindowState(&mut self) -> D2D1_WINDOW_STATE,
663     fn Resize(&mut self, pixelSize: *const D2D1_SIZE_U) -> ::HRESULT,
664     fn GetHwnd(&mut self) -> ::HWND
665 });
666 RIDL!(
667 interface ID2D1GdiInteropRenderTarget(ID2D1GdiInteropRenderTargetVtbl): IUnknown(IUnknownVtbl) {
668     fn GetDC(&mut self, mode: D2D1_DC_INITIALIZE_MODE, hdc: *mut ::HDC) -> ::HRESULT,
669     fn ReleaseDC(&mut self, update: *const ::RECT) -> ::HRESULT
670 });
671 RIDL!(
672 interface ID2D1DCRenderTarget(ID2D1DCRenderTargetVtbl): ID2D1RenderTarget(ID2D1RenderTargetVtbl) {
673     fn BindDC(&mut self, hDC: ::HDC, pSubRect: *const ::RECT) -> ::HRESULT
674 });
675 RIDL!(
676 interface ID2D1Factory(ID2D1FactoryVtbl): IUnknown(IUnknownVtbl) {
677     fn ReloadSystemMetrics(&mut self) -> ::HRESULT,
678     fn GetDesktopDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (),
679     fn CreateRectangleGeometry(
680         &mut self, rectangle: *const ::D2D1_RECT_F,
681         rectangleGeometry: *mut *mut ID2D1RectangleGeometry
682     ) -> ::HRESULT,
683     fn CreateRoundedRectangleGeometry(
684         &mut self, roundedRectangle: *const D2D1_ROUNDED_RECT,
685         roundedRectangleGeometry: *mut *mut ID2D1RoundedRectangleGeometry
686     ) -> ::HRESULT,
687     fn CreateEllipseGeometry(
688         &mut self, ellipse: *const D2D1_ELLIPSE,
689         ellipseGeometry: *mut *mut ID2D1EllipseGeometry
690     ) -> ::HRESULT,
691     fn CreateGeometryGroup(
692         &mut self, fillMode: D2D1_FILL_MODE, geometries: *mut *mut ID2D1Geometry,
693         geometriesCount: ::UINT32, geometryGroup: *mut *mut ID2D1GeometryGroup
694     ) -> ::HRESULT,
695     fn CreateTransformedGeometry(
696         &mut self, sourceGeometry: *mut ID2D1Geometry, transform: *const D2D1_MATRIX_3X2_F,
697         transformedGeometry: *mut *mut ID2D1TransformedGeometry
698     ) -> ::HRESULT,
699     fn CreatePathGeometry(
700         &mut self, pathGeometry: *mut *mut ID2D1PathGeometry
701     ) -> ::HRESULT,
702     fn CreateStrokeStyle(
703         &mut self, strokeStyleProperties: *const D2D1_STROKE_STYLE_PROPERTIES,
704         dashes: *const ::FLOAT, dashesCount: ::UINT32, strokeStyle: *mut *mut ID2D1StrokeStyle
705     ) -> ::HRESULT,
706     fn CreateDrawingStateBlock(
707         &mut self, drawingStateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION,
708         textRenderingParams: *mut ::IDWriteRenderingParams,
709         drawingStateBlock: *mut *mut ID2D1DrawingStateBlock
710     ) -> ::HRESULT,
711     fn CreateWicBitmapRenderTarget(
712         &mut self, target: *mut ::IWICBitmap,
713         renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES,
714         renderTarget: *mut *mut ID2D1RenderTarget
715     ) -> ::HRESULT,
716     fn CreateHwndRenderTarget(
717         &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES,
718         hwndRenderTargetProperties: *const D2D1_HWND_RENDER_TARGET_PROPERTIES,
719         hwndRenderTarget: *mut *mut ID2D1HwndRenderTarget
720     ) -> ::HRESULT,
721     fn CreateDxgiSurfaceRenderTarget(
722         &mut self, dxgiSurface: *mut ::IDXGISurface,
723         renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES,
724         renderTarget: *mut *mut ID2D1RenderTarget
725     ) -> ::HRESULT,
726     fn CreateDCRenderTarget(
727         &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES,
728         dcRenderTarget: *mut *mut ID2D1DCRenderTarget
729     ) -> ::HRESULT
730 });
731 DEFINE_GUID!(
732     UuidOfID2D1Factory,
733     0x06152247, 0x6f50, 0x465a, 0x92, 0x45, 0x11, 0x8b, 0xfd, 0x3b, 0x60, 0x07
734 );
735