1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#ifndef _D2D1_1_H_
8#define _D2D1_1_H_
9
10#include <d2d1.h>
11#include <d2d1effects.h>
12#include <dxgi.h>
13
14#include <winapifamily.h>
15
16#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
17
18typedef interface ID2D1ColorContext ID2D1ColorContext;
19typedef interface IWICColorContext IWICColorContext;
20typedef interface IWICImagingFactory IWICImagingFactory;
21typedef interface IPrintDocumentPackageTarget IPrintDocumentPackageTarget;
22typedef interface IDWriteFactory IDWriteFactory;
23
24typedef struct D2D1_PROPERTY_BINDING D2D1_PROPERTY_BINDING;
25
26#ifndef D2D_USE_C_DEFINITIONS
27interface ID2D1Device;
28interface ID2D1Effect;
29#else
30typedef interface ID2D1Device ID2D1Device;
31typedef interface ID2D1Effect ID2D1Effect;
32#endif
33
34typedef struct DWRITE_GLYPH_RUN_DESCRIPTION DWRITE_GLYPH_RUN_DESCRIPTION;
35
36typedef HRESULT (CALLBACK *PD2D1_EFFECT_FACTORY)(IUnknown**);
37
38typedef D2D_RECT_L D2D1_RECT_L;
39typedef D2D_POINT_2L D2D1_POINT_2L;
40
41typedef enum D2D1_PROPERTY_TYPE {
42    D2D1_PROPERTY_TYPE_UNKNOWN       = 0,
43    D2D1_PROPERTY_TYPE_STRING        = 1,
44    D2D1_PROPERTY_TYPE_BOOL          = 2,
45    D2D1_PROPERTY_TYPE_UINT32        = 3,
46    D2D1_PROPERTY_TYPE_INT32         = 4,
47    D2D1_PROPERTY_TYPE_FLOAT         = 5,
48    D2D1_PROPERTY_TYPE_VECTOR2       = 6,
49    D2D1_PROPERTY_TYPE_VECTOR3       = 7,
50    D2D1_PROPERTY_TYPE_VECTOR4       = 8,
51    D2D1_PROPERTY_TYPE_BLOB          = 9,
52    D2D1_PROPERTY_TYPE_IUNKNOWN      = 10,
53    D2D1_PROPERTY_TYPE_ENUM          = 11,
54    D2D1_PROPERTY_TYPE_ARRAY         = 12,
55    D2D1_PROPERTY_TYPE_CLSID         = 13,
56    D2D1_PROPERTY_TYPE_MATRIX_3X2    = 14,
57    D2D1_PROPERTY_TYPE_MATRIX_4X3    = 15,
58    D2D1_PROPERTY_TYPE_MATRIX_4X4    = 16,
59    D2D1_PROPERTY_TYPE_MATRIX_5X4    = 17,
60    D2D1_PROPERTY_TYPE_COLOR_CONTEXT = 18,
61    D2D1_PROPERTY_TYPE_FORCE_DWORD   = 0xffffffff
62} D2D1_PROPERTY_TYPE;
63
64typedef enum D2D1_CHANNEL_DEPTH {
65    D2D1_CHANNEL_DEPTH_DEFAULT = 0,
66    D2D1_CHANNEL_DEPTH_1       = 1,
67    D2D1_CHANNEL_DEPTH_4       = 4,
68    D2D1_CHANNEL_DEPTH_FORCE_DWORD = 0xffffffff
69} D2D1_CHANNEL_DEPTH;
70
71typedef enum D2D1_BUFFER_PRECISION {
72    D2D1_BUFFER_PRECISION_UNKNOWN         = 0,
73    D2D1_BUFFER_PRECISION_8BPC_UNORM      = 1,
74    D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2,
75    D2D1_BUFFER_PRECISION_16BPC_UNORM     = 3,
76    D2D1_BUFFER_PRECISION_16BPC_FLOAT     = 4,
77    D2D1_BUFFER_PRECISION_32BPC_FLOAT     = 5,
78    D2D1_BUFFER_PRECISION_FORCE_DWORD     = 0xffffffff
79} D2D1_BUFFER_PRECISION;
80
81typedef enum D2D1_COLOR_SPACE {
82    D2D1_COLOR_SPACE_CUSTOM = 0,
83    D2D1_COLOR_SPACE_SRGB   = 1,
84    D2D1_COLOR_SPACE_SCRGB  = 2,
85    D2D1_COLOR_SPACE_FORCE_DWORD = 0xffffffff
86} D2D1_COLOR_SPACE;
87
88typedef enum D2D1_DEVICE_CONTEXT_OPTIONS {
89    D2D1_DEVICE_CONTEXT_OPTIONS_NONE                               = 0,
90    D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = 1,
91    D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD = 0xffffffff
92} D2D1_DEVICE_CONTEXT_OPTIONS;
93
94DEFINE_ENUM_FLAG_OPERATORS(D2D1_DEVICE_CONTEXT_OPTIONS);
95
96typedef enum D2D1_BITMAP_OPTIONS {
97    D2D1_BITMAP_OPTIONS_NONE           = 0x00000000,
98    D2D1_BITMAP_OPTIONS_TARGET         = 0x00000001,
99    D2D1_BITMAP_OPTIONS_CANNOT_DRAW    = 0x00000002,
100    D2D1_BITMAP_OPTIONS_CPU_READ       = 0x00000004,
101    D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = 0x00000008,
102    D2D1_BITMAP_OPTIONS_FORCE_DWORD = 0xffffffff
103} D2D1_BITMAP_OPTIONS;
104
105DEFINE_ENUM_FLAG_OPERATORS(D2D1_BITMAP_OPTIONS);
106
107typedef enum D2D1_MAP_OPTIONS {
108    D2D1_MAP_OPTIONS_NONE    = 0,
109    D2D1_MAP_OPTIONS_READ    = 1,
110    D2D1_MAP_OPTIONS_WRITE   = 2,
111    D2D1_MAP_OPTIONS_DISCARD = 4,
112    D2D1_MAP_OPTIONS_FORCE_DWORD = 0xffffffff
113} D2D1_MAP_OPTIONS;
114
115DEFINE_ENUM_FLAG_OPERATORS(D2D1_MAP_OPTIONS);
116
117typedef enum D2D1_COLOR_INTERPOLATION_MODE {
118    D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT      = 0,
119    D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED = 1,
120    D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
121} D2D1_COLOR_INTERPOLATION_MODE;
122
123typedef enum D2D1_INTERPOLATION_MODE {
124    D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR    = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR,
125    D2D1_INTERPOLATION_MODE_LINEAR              = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR,
126    D2D1_INTERPOLATION_MODE_CUBIC               = D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC,
127    D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR,
128    D2D1_INTERPOLATION_MODE_ANISOTROPIC         = D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC,
129    D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC  = D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC,
130    D2D1_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
131} D2D1_INTERPOLATION_MODE;
132
133typedef enum D2D1_COMPOSITE_MODE {
134    D2D1_COMPOSITE_MODE_SOURCE_OVER         = 0,
135    D2D1_COMPOSITE_MODE_DESTINATION_OVER    = 1,
136    D2D1_COMPOSITE_MODE_SOURCE_IN           = 2,
137    D2D1_COMPOSITE_MODE_DESTINATION_IN      = 3,
138    D2D1_COMPOSITE_MODE_SOURCE_OUT          = 4,
139    D2D1_COMPOSITE_MODE_DESTINATION_OUT     = 5,
140    D2D1_COMPOSITE_MODE_SOURCE_ATOP         = 6,
141    D2D1_COMPOSITE_MODE_DESTINATION_ATOP    = 7,
142    D2D1_COMPOSITE_MODE_XOR                 = 8,
143    D2D1_COMPOSITE_MODE_PLUS                = 9,
144    D2D1_COMPOSITE_MODE_SOURCE_COPY         = 10,
145    D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = 11,
146    D2D1_COMPOSITE_MODE_MASK_INVERT         = 12,
147    D2D1_COMPOSITE_MODE_FORCE_DWORD = 0xffffffff
148} D2D1_COMPOSITE_MODE;
149
150typedef enum D2D1_PRIMITIVE_BLEND {
151    D2D1_PRIMITIVE_BLEND_SOURCE_OVER = 0,
152    D2D1_PRIMITIVE_BLEND_COPY        = 1,
153    D2D1_PRIMITIVE_BLEND_MIN         = 2,
154    D2D1_PRIMITIVE_BLEND_ADD         = 3,
155    D2D1_PRIMITIVE_BLEND_FORCE_DWORD = 0xffffffff
156} D2D1_PRIMITIVE_BLEND;
157
158typedef enum D2D1_UNIT_MODE {
159    D2D1_UNIT_MODE_DIPS   = 0,
160    D2D1_UNIT_MODE_PIXELS = 1,
161    D2D1_UNIT_MODE_FORCE_DWORD = 0xffffffff
162} D2D1_UNIT_MODE;
163
164typedef enum D2D1_LAYER_OPTIONS1 {
165    D2D1_LAYER_OPTIONS1_NONE                       = 0,
166    D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND = 1,
167    D2D1_LAYER_OPTIONS1_IGNORE_ALPHA               = 2,
168    D2D1_LAYER_OPTIONS1_FORCE_DWORD = 0xffffffff
169} D2D1_LAYER_OPTIONS1;
170
171DEFINE_ENUM_FLAG_OPERATORS(D2D1_LAYER_OPTIONS1);
172
173typedef enum D2D1_PRINT_FONT_SUBSET_MODE {
174    D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT  = 0,
175    D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE = 1,
176    D2D1_PRINT_FONT_SUBSET_MODE_NONE     = 2,
177    D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD = 0xffffffff
178} D2D1_PRINT_FONT_SUBSET_MODE;
179
180typedef enum D2D1_STROKE_TRANSFORM_TYPE {
181    D2D1_STROKE_TRANSFORM_TYPE_NORMAL   = 0,
182    D2D1_STROKE_TRANSFORM_TYPE_FIXED    = 1,
183    D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE = 2,
184    D2D1_STROKE_TRANSFORM_TYPE_FORCE_DWORD = 0xffffffff
185} D2D1_STROKE_TRANSFORM_TYPE;
186
187typedef struct D2D1_BITMAP_PROPERTIES1 {
188    D2D1_PIXEL_FORMAT pixelFormat;
189    FLOAT dpiX;
190    FLOAT dpiY;
191    D2D1_BITMAP_OPTIONS bitmapOptions;
192    ID2D1ColorContext *colorContext;
193} D2D1_BITMAP_PROPERTIES1;
194
195typedef struct D2D1_MAPPED_RECT {
196    UINT32 pitch;
197    BYTE *bits;
198} D2D1_MAPPED_RECT;
199
200typedef struct D2D1_IMAGE_BRUSH_PROPERTIES {
201    D2D1_RECT_F sourceRectangle;
202    D2D1_EXTEND_MODE extendModeX;
203    D2D1_EXTEND_MODE extendModeY;
204    D2D1_INTERPOLATION_MODE interpolationMode;
205} D2D1_IMAGE_BRUSH_PROPERTIES;
206
207typedef struct D2D1_BITMAP_BRUSH_PROPERTIES1 {
208    D2D1_EXTEND_MODE extendModeX;
209    D2D1_EXTEND_MODE extendModeY;
210    D2D1_INTERPOLATION_MODE interpolationMode;
211} D2D1_BITMAP_BRUSH_PROPERTIES1;
212
213typedef D2D_MATRIX_4X3_F D2D1_MATRIX_4X3_F;
214typedef D2D_MATRIX_4X4_F D2D1_MATRIX_4X4_F;
215typedef D2D_MATRIX_5X4_F D2D1_MATRIX_5X4_F;
216typedef D2D_VECTOR_2F D2D1_VECTOR_2F;
217typedef D2D_VECTOR_3F D2D1_VECTOR_3F;
218typedef D2D_VECTOR_4F D2D1_VECTOR_4F;
219
220typedef struct D2D1_LAYER_PARAMETERS1 {
221    D2D1_RECT_F contentBounds;
222    ID2D1Geometry *geometricMask;
223    D2D1_ANTIALIAS_MODE maskAntialiasMode;
224    D2D1_MATRIX_3X2_F maskTransform;
225    FLOAT opacity;
226    ID2D1Brush *opacityBrush;
227    D2D1_LAYER_OPTIONS1 layerOptions;
228} D2D1_LAYER_PARAMETERS1;
229
230typedef struct D2D1_RENDERING_CONTROLS {
231    D2D1_BUFFER_PRECISION bufferPrecision;
232    D2D1_SIZE_U tileSize;
233} D2D1_RENDERING_CONTROLS;
234
235typedef struct D2D1_EFFECT_INPUT_DESCRIPTION {
236    ID2D1Effect *effect;
237    UINT32 inputIndex;
238    D2D1_RECT_F inputRectangle;
239} D2D1_EFFECT_INPUT_DESCRIPTION;
240
241typedef struct D2D1_PRINT_CONTROL_PROPERTIES {
242    D2D1_PRINT_FONT_SUBSET_MODE fontSubset;
243    FLOAT rasterDPI;
244    D2D1_COLOR_SPACE colorSpace;
245} D2D1_PRINT_CONTROL_PROPERTIES;
246
247typedef struct D2D1_STROKE_STYLE_PROPERTIES1 {
248    D2D1_CAP_STYLE startCap;
249    D2D1_CAP_STYLE endCap;
250    D2D1_CAP_STYLE dashCap;
251    D2D1_LINE_JOIN lineJoin;
252    FLOAT miterLimit;
253    D2D1_DASH_STYLE dashStyle;
254    FLOAT dashOffset;
255    D2D1_STROKE_TRANSFORM_TYPE transformType;
256} D2D1_STROKE_STYLE_PROPERTIES1;
257
258typedef struct D2D1_DRAWING_STATE_DESCRIPTION1 {
259    D2D1_ANTIALIAS_MODE antialiasMode;
260    D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode;
261    D2D1_TAG tag1;
262    D2D1_TAG tag2;
263    D2D1_MATRIX_3X2_F transform;
264    D2D1_PRIMITIVE_BLEND primitiveBlend;
265    D2D1_UNIT_MODE unitMode;
266} D2D1_DRAWING_STATE_DESCRIPTION1;
267
268typedef struct D2D1_POINT_DESCRIPTION {
269    D2D1_POINT_2F point;
270    D2D1_POINT_2F unitTangentVector;
271    UINT32 endSegment;
272    UINT32 endFigure;
273    FLOAT lengthToEndSegment;
274} D2D1_POINT_DESCRIPTION;
275
276#ifndef D2D_USE_C_DEFINITIONS
277
278interface ID2D1Properties : public IUnknown
279{
280    STDMETHOD_(UINT32, GetPropertyCount)() CONST PURE;
281    STDMETHOD(GetPropertyName)(UINT32 index, PWSTR name, UINT32 nameCount) CONST PURE;
282    STDMETHOD_(UINT32, GetPropertyNameLength)(UINT32 index) CONST PURE;
283    STDMETHOD_(D2D1_PROPERTY_TYPE, GetType)(UINT32 index) CONST PURE;
284    STDMETHOD_(UINT32, GetPropertyIndex)(PCWSTR name) CONST PURE;
285    STDMETHOD(SetValueByName)(PCWSTR name, D2D1_PROPERTY_TYPE type, CONST BYTE *data, UINT32 dataSize) PURE;
286    STDMETHOD(SetValue)(UINT32 index, D2D1_PROPERTY_TYPE type, CONST BYTE *data, UINT32 dataSize) PURE;
287    STDMETHOD(GetValueByName)(PCWSTR name, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize) CONST PURE;
288    STDMETHOD(GetValue)(UINT32 index, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize) CONST PURE;
289    STDMETHOD_(UINT32, GetValueSize)(UINT32 index) CONST PURE;
290    STDMETHOD(GetSubProperties)(UINT32 index, ID2D1Properties **subProperties) CONST PURE;
291
292    HRESULT SetValueByName(PCWSTR name, CONST BYTE *data, UINT32 dataSize) {
293        return SetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
294    }
295
296    HRESULT SetValue(UINT32 index, CONST BYTE *data, UINT32 dataSize) {
297        return SetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
298    }
299
300    HRESULT GetValueByName(PCWSTR name, BYTE *data, UINT32 dataSize) CONST {
301        return GetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
302    }
303
304    HRESULT GetValue(UINT32 index, BYTE *data, UINT32 dataSize) CONST {
305        return GetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize);
306    }
307
308    template<typename T>
309    HRESULT GetValueByName(PCWSTR propertyName, T *value) const {
310        return GetValueByName(propertyName, reinterpret_cast<BYTE*>(value), sizeof(*value));
311    }
312
313    template<typename T>
314    T GetValueByName(PCWSTR propertyName) const {
315        T ret;
316        GetValueByName(propertyName, reinterpret_cast<BYTE*>(&ret), sizeof(ret));
317        return ret;
318    }
319
320    template<typename T>
321    HRESULT SetValueByName(PCWSTR propertyName, const T &value) {
322        return SetValueByName(propertyName, reinterpret_cast<const BYTE*>(&value), sizeof(value));
323    }
324
325    template<typename T>
326    HRESULT GetValue(T index, BYTE *data, UINT32 dataSize) CONST {
327        return GetValue(static_cast<UINT32>(index), data, dataSize);
328    }
329
330    template<typename T, typename U>
331    HRESULT GetValue(U index, T *value) const {
332        return GetValue(static_cast<UINT32>(index), reinterpret_cast<BYTE*>(value), sizeof(*value));
333    }
334
335    template<typename T, typename U>
336    T GetValue(U index) const {
337        T ret;
338        GetValue(static_cast<UINT32>(index), reinterpret_cast<BYTE*>(&ret), sizeof(ret));
339        return ret;
340    }
341
342    template<typename T>
343    HRESULT SetValue(T index, CONST BYTE *data, UINT32 dataSize) {
344        return SetValue(static_cast<UINT32>(index), data, dataSize);
345    }
346
347    template<typename T, typename U>
348    HRESULT SetValue(U index, const T &value) {
349        return SetValue(static_cast<UINT32>(index), reinterpret_cast<const BYTE*>(&value), sizeof(value));
350    }
351
352    template<typename T>
353    HRESULT GetPropertyName(T index, PWSTR name, UINT32 nameCount) CONST {
354        return GetPropertyName(static_cast<UINT32>(index), name, nameCount);
355    }
356
357    template<typename T>
358    UINT32 GetPropertyNameLength(T index) CONST {
359        return GetPropertyNameLength(static_cast<UINT32>(index));
360    }
361
362    template<typename T>
363    D2D1_PROPERTY_TYPE GetType(T index) CONST {
364        return GetType(static_cast<UINT32>(index));
365    }
366
367    template<typename T>
368    UINT32 GetValueSize(T index) CONST {
369        return GetValueSize(static_cast<UINT32>(index));
370    }
371
372    template<typename T>
373    HRESULT GetSubProperties(T index, ID2D1Properties **subProperties) CONST {
374        return GetSubProperties(static_cast<UINT32>(index), subProperties);
375    }
376};
377
378#else
379
380typedef interface ID2D1Properties ID2D1Properties;
381/* FIXME: Add full C declaration */
382
383#endif
384
385DEFINE_GUID(IID_ID2D1Properties,0x483473d7,0xcd46,0x4f9d,0x9d,0x3a,0x31,0x12,0xaa,0x80,0x15,0x9d);
386__CRT_UUID_DECL(ID2D1Properties,0x483473d7,0xcd46,0x4f9d,0x9d,0x3a,0x31,0x12,0xaa,0x80,0x15,0x9d);
387
388#ifndef D2D_USE_C_DEFINITIONS
389
390interface ID2D1GdiMetafileSink : public IUnknown
391{
392    STDMETHOD(ProcessRecord)(DWORD recordType, CONST void *recordData, DWORD recordDataSize) PURE;
393};
394
395#else
396
397typedef interface ID2D1GdiMetafileSink ID2D1GdiMetafileSink;
398/* FIXME: Add full C declaration */
399
400#endif
401
402DEFINE_GUID(IID_ID2D1GdiMetafileSink, 0x82237326,0x8111,0x4f7c,0xbc,0xf4,0xb5,0xc1,0x17,0x55,0x64,0xfe);
403__CRT_UUID_DECL(ID2D1GdiMetafileSink, 0x82237326,0x8111,0x4f7c,0xbc,0xf4,0xb5,0xc1,0x17,0x55,0x64,0xfe);
404
405#ifndef D2D_USE_C_DEFINITIONS
406
407interface ID2D1GdiMetafile : public ID2D1Resource
408{
409    STDMETHOD(Stream)(ID2D1GdiMetafileSink *sink) PURE;
410    STDMETHOD(GetBounds)(D2D1_RECT_F *bounds) PURE;
411};
412
413#else
414
415typedef interface ID2D1GdiMetafile ID2D1GdiMetafile;
416/* FIXME: Add full C declaration */
417
418#endif
419
420DEFINE_GUID(IID_ID2D1GdiMetafile, 0x2f543dc3,0xcfc1,0x4211,0x86,0x4f,0xcf,0xd9,0x1c,0x6f,0x33,0x95);
421__CRT_UUID_DECL(ID2D1GdiMetafile, 0x2f543dc3,0xcfc1,0x4211,0x86,0x4f,0xcf,0xd9,0x1c,0x6f,0x33,0x95);
422
423#ifndef D2D_USE_C_DEFINITIONS
424
425interface ID2D1StrokeStyle1 : public ID2D1StrokeStyle
426{
427    STDMETHOD_(D2D1_STROKE_TRANSFORM_TYPE, GetStrokeTransformType)() CONST PURE;
428};
429
430#else
431
432typedef interface ID2D1StrokeStyle1 ID2D1StrokeStyle1;
433/* FIXME: Add full C declaration */
434
435#endif
436
437DEFINE_GUID(IID_ID2D1StrokeStyle1, 0x10a72a66,0xe91c,0x43f4,0x99,0x3f,0xdd,0xf4,0xb8,0x2b,0x0b,0x4a);
438__CRT_UUID_DECL(ID2D1StrokeStyle1, 0x10a72a66,0xe91c,0x43f4,0x99,0x3f,0xdd,0xf4,0xb8,0x2b,0x0b,0x4a);
439
440#ifndef D2D_USE_C_DEFINITIONS
441
442interface ID2D1CommandSink : public IUnknown
443{
444    STDMETHOD(BeginDraw)() PURE;
445    STDMETHOD(EndDraw)() PURE;
446    STDMETHOD(SetAntialiasMode)(D2D1_ANTIALIAS_MODE antialiasMode) PURE;
447    STDMETHOD(SetTags)(D2D1_TAG tag1, D2D1_TAG tag2) PURE;
448    STDMETHOD(SetTextAntialiasMode)(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode) PURE;
449    STDMETHOD(SetTextRenderingParams)(IDWriteRenderingParams *textRenderingParams) PURE;
450    STDMETHOD(SetTransform)(CONST D2D1_MATRIX_3X2_F *transform) PURE;
451    STDMETHOD(SetPrimitiveBlend)(D2D1_PRIMITIVE_BLEND primitiveBlend) PURE;
452    STDMETHOD(SetUnitMode)(D2D1_UNIT_MODE unitMode) PURE;
453    STDMETHOD(Clear)(CONST D2D1_COLOR_F *color) PURE;
454    STDMETHOD(DrawGlyphRun)(D2D1_POINT_2F baselineOrigin, CONST DWRITE_GLYPH_RUN *glyphRun,
455            CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, ID2D1Brush *foregroundBrush,
456            DWRITE_MEASURING_MODE measuringMode) PURE;
457    STDMETHOD(DrawLine)(D2D1_POINT_2F point0, D2D1_POINT_2F point1, ID2D1Brush *brush, FLOAT strokeWidth,
458            ID2D1StrokeStyle *strokeStyle) PURE;
459    STDMETHOD(DrawGeometry)(ID2D1Geometry *geometry, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle) PURE;
460    STDMETHOD(DrawRectangle)(CONST D2D1_RECT_F *rect, ID2D1Brush *brush, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle) PURE;
461    STDMETHOD(DrawBitmap)(ID2D1Bitmap *bitmap, CONST D2D1_RECT_F *destinationRectangle, FLOAT opacity,
462            D2D1_INTERPOLATION_MODE interpolationMode, CONST D2D1_RECT_F *sourceRectangle,
463            CONST D2D1_MATRIX_4X4_F *perspectiveTransform) PURE;
464    STDMETHOD(DrawImage)(ID2D1Image *image, CONST D2D1_POINT_2F *targetOffset, CONST D2D1_RECT_F *imageRectangle,
465            D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode) PURE;
466    STDMETHOD(DrawGdiMetafile)(ID2D1GdiMetafile *gdiMetafile, CONST D2D1_POINT_2F *targetOffset) PURE;
467    STDMETHOD(FillMesh)(ID2D1Mesh *mesh, ID2D1Brush *brush) PURE;
468    STDMETHOD(FillOpacityMask)(ID2D1Bitmap *opacityMask, ID2D1Brush *brush, CONST D2D1_RECT_F *destinationRectangle,
469            CONST D2D1_RECT_F *sourceRectangle) PURE;
470    STDMETHOD(FillGeometry)(ID2D1Geometry *geometry, ID2D1Brush *brush, ID2D1Brush *opacityBrush) PURE;
471    STDMETHOD(FillRectangle)(CONST D2D1_RECT_F *rect, ID2D1Brush *brush) PURE;
472    STDMETHOD(PushAxisAlignedClip)(CONST D2D1_RECT_F *clipRect, D2D1_ANTIALIAS_MODE antialiasMode) PURE;
473    STDMETHOD(PushLayer)(CONST D2D1_LAYER_PARAMETERS1 *layerParameters1, ID2D1Layer *layer) PURE;
474    STDMETHOD(PopAxisAlignedClip)() PURE;
475    STDMETHOD(PopLayer)() PURE;
476};
477
478#else
479
480typedef interface ID2D1CommandSink ID2D1CommandSink;
481
482#endif
483
484DEFINE_GUID(IID_ID2D1CommandSink, 0x54d7898a,0xa061,0x40a7,0xbe,0xc7,0xe4,0x65,0xbc,0xba,0x2c,0x4f);
485__CRT_UUID_DECL(ID2D1CommandSink, 0x54d7898a,0xa061,0x40a7,0xbe,0xc7,0xe4,0x65,0xbc,0xba,0x2c,0x4f);
486
487#ifndef D2D_USE_C_DEFINITIONS
488
489interface ID2D1CommandList : public ID2D1Image
490{
491    STDMETHOD(Stream)(ID2D1CommandSink *sink) PURE;
492    STDMETHOD(Close)() PURE;
493};
494
495#else
496
497typedef interface ID2D1CommandList ID2D1CommandList;
498
499#endif
500
501DEFINE_GUID(IID_ID2D1CommandList, 0xb4f34a19,0x2383,0x4d76,0x94,0xf6,0xec,0x34,0x36,0x57,0xc3,0xdc);
502__CRT_UUID_DECL(ID2D1CommandList, 0xb4f34a19,0x2383,0x4d76,0x94,0xf6,0xec,0x34,0x36,0x57,0xc3,0xdc);
503
504#ifndef D2D_USE_C_DEFINITIONS
505
506interface ID2D1PrintControl : public IUnknown
507{
508    STDMETHOD(AddPage)(ID2D1CommandList *commandList, D2D_SIZE_F pageSize, IStream *pagePrintTicketStream,
509            D2D1_TAG *tag1 = NULL, D2D1_TAG *tag2 = NULL) PURE;
510    STDMETHOD(Close)() PURE;
511};
512
513#else
514
515typedef interface ID2D1PrintControl ID2D1PrintControl;
516
517#endif
518
519DEFINE_GUID(IID_ID2D1PrintControl, 0x2c1d867d,0xc290,0x41c8,0xae,0x7e,0x34,0xa9,0x87,0x02,0xe9,0xa5);
520__CRT_UUID_DECL(ID2D1PrintControl, 0x2c1d867d,0xc290,0x41c8,0xae,0x7e,0x34,0xa9,0x87,0x02,0xe9,0xa5);
521
522#ifndef D2D_USE_C_DEFINITIONS
523
524interface ID2D1Effect : public ID2D1Properties
525{
526    STDMETHOD_(void, SetInput)(UINT32 index, ID2D1Image *input, BOOL invalidate=TRUE) PURE;
527    STDMETHOD(SetInputCount)(UINT32 inputCount) PURE;
528    STDMETHOD_(void, GetInput)(UINT32 index, ID2D1Image **input) CONST PURE;
529    STDMETHOD_(UINT32, GetInputCount)() CONST PURE;
530    STDMETHOD_(void, GetOutput)(ID2D1Image **outputImage) CONST PURE;
531
532    void SetInputEffect(UINT32 index, ID2D1Effect *inputEffect, BOOL invalidate=TRUE) {
533        ID2D1Image *output = NULL;
534        if(inputEffect)
535            inputEffect->GetOutput(&output);
536        SetInput(index, output, invalidate);
537        if(output)
538            output->Release();
539    }
540};
541
542#else
543
544typedef interface ID2D1Effect ID2D1Effect;
545/* FIXME: Add full C declaration */
546
547#endif
548
549DEFINE_GUID(IID_ID2D1Effect,0x28211a43,0x7d89,0x476f,0x81,0x81,0x2d,0x61,0x59,0xb2,0x20,0xad);
550__CRT_UUID_DECL(ID2D1Effect,0x28211a43,0x7d89,0x476f,0x81,0x81,0x2d,0x61,0x59,0xb2,0x20,0xad);
551
552#endif
553
554#ifndef D2D_USE_C_DEFINITIONS
555
556interface ID2D1Bitmap1 : public ID2D1Bitmap
557{
558    STDMETHOD_(void, GetColorContext)(ID2D1ColorContext **colorContext) CONST PURE;
559    STDMETHOD_(D2D1_BITMAP_OPTIONS, GetOptions)() CONST PURE;
560    STDMETHOD(GetSurface)(IDXGISurface **dxgiSurface) CONST PURE;
561    STDMETHOD(Map)(D2D1_MAP_OPTIONS options, D2D1_MAPPED_RECT *mappedRect) PURE;
562    STDMETHOD(Unmap)() PURE;
563};
564
565#else
566
567typedef interface ID2D1Bitmap1 ID2D1Bitmap1;
568/* FIXME: Add full C declaration */
569
570#endif
571
572DEFINE_GUID(IID_ID2D1Bitmap1, 0xa898a84c,0x3873,0x4588,0xb0,0x8b,0xeb,0xbf,0x97,0x8d,0xf0,0x41);
573__CRT_UUID_DECL(ID2D1Bitmap1, 0xa898a84c,0x3873,0x4588,0xb0,0x8b,0xeb,0xbf,0x97,0x8d,0xf0,0x41);
574
575#ifndef D2D_USE_C_DEFINITIONS
576
577interface ID2D1ImageBrush : public ID2D1Brush
578{
579    STDMETHOD_(void, SetImage)(ID2D1Image *image) PURE;
580    STDMETHOD_(void, SetExtendModeX)(D2D1_EXTEND_MODE extendModeX) PURE;
581    STDMETHOD_(void, SetExtendModeY)(D2D1_EXTEND_MODE extendModeY) PURE;
582    STDMETHOD_(void, SetInterpolationMode)(D2D1_INTERPOLATION_MODE interpolationMode) PURE;
583    STDMETHOD_(void, SetSourceRectangle)(CONST D2D1_RECT_F *sourceRectangle) PURE;
584    STDMETHOD_(void, GetImage)(ID2D1Image **image) CONST PURE;
585    STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeX)() CONST PURE;
586    STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeY)() CONST PURE;
587    STDMETHOD_(D2D1_INTERPOLATION_MODE, GetInterpolationMode)() CONST PURE;
588    STDMETHOD_(void, GetSourceRectangle)(D2D1_RECT_F *sourceRectangle) CONST PURE;
589};
590
591#else
592
593typedef interface ID2D1ImageBrush ID2D1ImageBrush;
594/* FIXME: Add full C declaration */
595
596#endif
597
598DEFINE_GUID(IID_ID2D1ImageBrush, 0xfe9e984d,0x3f95,0x407c,0xb5,0xdb,0xcb,0x94,0xd4,0xe8,0xf8,0x7c);
599__CRT_UUID_DECL(ID2D1ImageBrush, 0xfe9e984d,0x3f95,0x407c,0xb5,0xdb,0xcb,0x94,0xd4,0xe8,0xf8,0x7c);
600
601#ifndef D2D_USE_C_DEFINITIONS
602
603interface ID2D1BitmapBrush1 : public ID2D1BitmapBrush
604{
605    STDMETHOD_(void, SetInterpolationMode1)(D2D1_INTERPOLATION_MODE interpolationMode) PURE;
606    STDMETHOD_(D2D1_INTERPOLATION_MODE, GetInterpolationMode1)() CONST PURE;
607};
608
609#else
610
611typedef interface ID2D1BitmapBrush1 ID2D1BitmapBrush1;
612/* FIXME: Add full C declaration */
613
614#endif
615
616DEFINE_GUID(IID_ID2D1BitmapBrush1, 0x41343a53,0xe41a,0x49a2,0x91,0xcd,0x21,0x79,0x3b,0xbb,0x62,0xe5);
617__CRT_UUID_DECL(ID2D1BitmapBrush1, 0x41343a53,0xe41a,0x49a2,0x91,0xcd,0x21,0x79,0x3b,0xbb,0x62,0xe5);
618
619#ifndef D2D_USE_C_DEFINITIONS
620
621interface ID2D1GradientStopCollection1 : public ID2D1GradientStopCollection
622{
623    STDMETHOD_(void, GetGradientStops1)(D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount) CONST PURE;
624    STDMETHOD_(D2D1_COLOR_SPACE, GetPreInterpolationSpace)() CONST PURE;
625    STDMETHOD_(D2D1_COLOR_SPACE, GetPostInterpolationSpace)() CONST PURE;
626    STDMETHOD_(D2D1_BUFFER_PRECISION, GetBufferPrecision)() CONST PURE;
627    STDMETHOD_(D2D1_COLOR_INTERPOLATION_MODE, GetColorInterpolationMode)() CONST PURE;
628};
629
630#else
631
632typedef interface ID2D1GradientStopCollection1 ID2D1GradientStopCollection1;
633/* FIXME: Add full C declaration */
634
635#endif
636
637DEFINE_GUID(IID_ID2D1GradientStopCollection1, 0xae1572f4,0x5dd0,0x4777,0x99,0x8b,0x92,0x79,0x47,0x2a,0xe6,0x3b);
638__CRT_UUID_DECL(ID2D1GradientStopCollection1, 0xae1572f4,0x5dd0,0x4777,0x99,0x8b,0x92,0x79,0x47,0x2a,0xe6,0x3b);
639
640#ifndef D2D_USE_C_DEFINITIONS
641
642interface ID2D1ColorContext : public ID2D1Resource
643{
644    STDMETHOD_(D2D1_COLOR_SPACE, GetColorSpace)() CONST PURE;
645    STDMETHOD_(UINT32, GetProfileSize)() CONST PURE;
646    STDMETHOD(GetProfile)(BYTE *profile, UINT32 profileSize) CONST PURE;
647};
648
649#else
650
651typedef interface ID2D1ColorContext ID2D1ColorContext;
652
653#endif
654
655DEFINE_GUID(IID_ID2D1ColorContext, 0x1c4820bb,0x5771,0x4518,0xa5,0x81,0x2f,0xe4,0xdd,0x0e,0xc6,0x57);
656__CRT_UUID_DECL(ID2D1ColorContext, 0x1c4820bb,0x5771,0x4518,0xa5,0x81,0x2f,0xe4,0xdd,0x0e,0xc6,0x57);
657
658#ifndef D2D_USE_C_DEFINITIONS
659
660interface ID2D1DeviceContext : public ID2D1RenderTarget
661{
662    STDMETHOD(CreateBitmap)(D2D1_SIZE_U size, CONST void *sourceData, UINT32 pitch,
663            CONST D2D1_BITMAP_PROPERTIES1 *bitmapProperties, ID2D1Bitmap1 **bitmap) PURE;
664    using ID2D1RenderTarget::CreateBitmap;
665
666    STDMETHOD(CreateBitmapFromWicBitmap)(IWICBitmapSource *wicBitmapSource,
667            CONST D2D1_BITMAP_PROPERTIES1 *bitmapProperties, ID2D1Bitmap1 **bitmap) PURE;
668    using ID2D1RenderTarget::CreateBitmapFromWicBitmap;
669
670    STDMETHOD(CreateColorContext)(D2D1_COLOR_SPACE space, CONST BYTE *profile, UINT32 profileSize,
671            ID2D1ColorContext **colorContext) PURE;
672    STDMETHOD(CreateColorContextFromFilename)(PCWSTR filename, ID2D1ColorContext **colorContext) PURE;
673    STDMETHOD(CreateColorContextFromWicColorContext)(IWICColorContext *wicColorContext, ID2D1ColorContext **colorContext) PURE;
674    STDMETHOD(CreateBitmapFromDxgiSurface)(IDXGISurface *surface, CONST D2D1_BITMAP_PROPERTIES1 *bitmapProperties,
675            ID2D1Bitmap1 **bitmap) PURE;
676    STDMETHOD(CreateEffect)(REFCLSID effectId, ID2D1Effect **effect) PURE;
677
678    STDMETHOD(CreateGradientStopCollection)(CONST D2D1_GRADIENT_STOP *straightAlphaGradientStops,
679        UINT32 straightAlphaGradientStopsCount, D2D1_COLOR_SPACE preInterpolationSpace,
680        D2D1_COLOR_SPACE postInterpolationSpace, D2D1_BUFFER_PRECISION bufferPrecision,
681        D2D1_EXTEND_MODE extendMode, D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode,
682        ID2D1GradientStopCollection1 **gradientStopCollection1) PURE;
683    using ID2D1RenderTarget::CreateGradientStopCollection;
684
685    STDMETHOD(CreateImageBrush)(ID2D1Image *image, CONST D2D1_IMAGE_BRUSH_PROPERTIES *imageBrushProperties,
686            CONST D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1ImageBrush **imageBrush) PURE;
687
688    STDMETHOD(CreateBitmapBrush)(ID2D1Bitmap *bitmap, CONST D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties,
689            CONST D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush) PURE;
690    using ID2D1RenderTarget::CreateBitmapBrush;
691
692    STDMETHOD(CreateCommandList)(ID2D1CommandList **commandList) PURE;
693    STDMETHOD_(BOOL, IsDxgiFormatSupported)(DXGI_FORMAT format) CONST PURE;
694    STDMETHOD_(BOOL, IsBufferPrecisionSupported)(D2D1_BUFFER_PRECISION bufferPrecision) CONST PURE;
695    STDMETHOD(GetImageLocalBounds)(ID2D1Image *image, D2D1_RECT_F *localBounds) CONST PURE;
696    STDMETHOD(GetImageWorldBounds)(ID2D1Image *image, D2D1_RECT_F *worldBounds) CONST PURE;
697    STDMETHOD(GetGlyphRunWorldBounds)(D2D1_POINT_2F baselineOrigin, CONST DWRITE_GLYPH_RUN *glyphRun,
698            DWRITE_MEASURING_MODE measuringMode, D2D1_RECT_F *bounds) CONST PURE;
699    STDMETHOD_(void, GetDevice)(ID2D1Device **device) CONST PURE;
700    STDMETHOD_(void, SetTarget)(ID2D1Image *image) PURE;
701    STDMETHOD_(void, GetTarget)(ID2D1Image **image) CONST PURE;
702    STDMETHOD_(void, SetRenderingControls)(CONST D2D1_RENDERING_CONTROLS *renderingControls) PURE;
703    STDMETHOD_(void, GetRenderingControls)(D2D1_RENDERING_CONTROLS *renderingControls) CONST PURE;
704    STDMETHOD_(void, SetPrimitiveBlend)(D2D1_PRIMITIVE_BLEND primitiveBlend) PURE;
705    STDMETHOD_(D2D1_PRIMITIVE_BLEND, GetPrimitiveBlend)() CONST PURE;
706    STDMETHOD_(void, SetUnitMode)(D2D1_UNIT_MODE unitMode) PURE;
707    STDMETHOD_(D2D1_UNIT_MODE, GetUnitMode)() CONST PURE;
708
709    STDMETHOD_(void, DrawGlyphRun)(D2D1_POINT_2F baselineOrigin, CONST DWRITE_GLYPH_RUN *glyphRun,
710            CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, ID2D1Brush *foregroundBrush,
711            DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL) PURE;
712    using ID2D1RenderTarget::DrawGlyphRun;
713
714    STDMETHOD_(void, DrawImage)(ID2D1Image *image, CONST D2D1_POINT_2F *targetOffset = NULL,
715            CONST D2D1_RECT_F *imageRectangle = NULL, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
716            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) PURE;
717    STDMETHOD_(void, DrawGdiMetafile)(ID2D1GdiMetafile *gdiMetafile, CONST D2D1_POINT_2F *targetOffset = NULL) PURE;
718
719    STDMETHOD_(void, DrawBitmap)(ID2D1Bitmap *bitmap, CONST D2D1_RECT_F *destinationRectangle, FLOAT opacity,
720            D2D1_INTERPOLATION_MODE interpolationMode, CONST D2D1_RECT_F *sourceRectangle = NULL,
721            CONST D2D1_MATRIX_4X4_F *perspectiveTransform = NULL) PURE;
722    using ID2D1RenderTarget::DrawBitmap;
723
724    STDMETHOD_(void, PushLayer)(CONST D2D1_LAYER_PARAMETERS1 *layerParameters, ID2D1Layer *layer) PURE;
725    using ID2D1RenderTarget::PushLayer;
726
727    STDMETHOD(InvalidateEffectInputRectangle)(ID2D1Effect *effect, UINT32 input, CONST D2D1_RECT_F *inputRectangle) PURE;
728    STDMETHOD(GetEffectInvalidRectangleCount)(ID2D1Effect *effect, UINT32 *rectangleCount) PURE;
729    STDMETHOD(GetEffectInvalidRectangles)(ID2D1Effect *effect, D2D1_RECT_F *rectangles, UINT32 rectanglesCount) PURE;
730    STDMETHOD(GetEffectRequiredInputRectangles)(ID2D1Effect *renderEffect, CONST D2D1_RECT_F *renderImageRectangle,
731            CONST D2D1_EFFECT_INPUT_DESCRIPTION *inputDescriptions, D2D1_RECT_F *requiredInputRects, UINT32 inputCount) PURE;
732
733    STDMETHOD_(void, FillOpacityMask)(ID2D1Bitmap *opacityMask, ID2D1Brush *brush, CONST D2D1_RECT_F *destinationRectangle = NULL,
734            CONST D2D1_RECT_F *sourceRectangle = NULL) PURE;
735    using ID2D1RenderTarget::FillOpacityMask;
736
737    HRESULT CreateBitmap(D2D1_SIZE_U size, CONST void *sourceData, UINT32 pitch, CONST D2D1_BITMAP_PROPERTIES1 &bitmapProperties,
738            ID2D1Bitmap1 **bitmap) {
739        return CreateBitmap(size, sourceData, pitch, &bitmapProperties, bitmap);
740    }
741
742    HRESULT CreateBitmapFromWicBitmap(IWICBitmapSource *wicBitmapSource, CONST D2D1_BITMAP_PROPERTIES1 &bitmapProperties,
743            ID2D1Bitmap1 **bitmap) {
744        return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, bitmap);
745    }
746
747    HRESULT CreateBitmapFromWicBitmap(IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap) {
748        return CreateBitmapFromWicBitmap(wicBitmapSource, NULL, bitmap);
749    }
750
751    HRESULT CreateBitmapFromDxgiSurface(IDXGISurface *surface, CONST D2D1_BITMAP_PROPERTIES1 &bitmapProperties,
752        ID2D1Bitmap1 **bitmap) {
753        return CreateBitmapFromDxgiSurface(surface, &bitmapProperties, bitmap);
754    }
755
756    HRESULT CreateImageBrush(ID2D1Image *image, CONST D2D1_IMAGE_BRUSH_PROPERTIES &imageBrushProperties,
757        CONST D2D1_BRUSH_PROPERTIES &brushProperties, ID2D1ImageBrush **imageBrush) {
758        return CreateImageBrush(image, &imageBrushProperties, &brushProperties, imageBrush);
759    }
760
761    HRESULT CreateImageBrush(ID2D1Image *image, CONST D2D1_IMAGE_BRUSH_PROPERTIES &imageBrushProperties,
762        ID2D1ImageBrush **imageBrush) {
763        return CreateImageBrush(image,&imageBrushProperties, NULL, imageBrush);
764    }
765
766    HRESULT CreateBitmapBrush(ID2D1Bitmap *bitmap, ID2D1BitmapBrush1 **bitmapBrush) {
767        return CreateBitmapBrush(bitmap, NULL, NULL, bitmapBrush);
768    }
769
770    HRESULT CreateBitmapBrush(ID2D1Bitmap *bitmap, CONST D2D1_BITMAP_BRUSH_PROPERTIES1 &bitmapBrushProperties,
771            ID2D1BitmapBrush1 **bitmapBrush) {
772        return CreateBitmapBrush(bitmap, &bitmapBrushProperties, NULL, bitmapBrush);
773    }
774
775    HRESULT CreateBitmapBrush(ID2D1Bitmap *bitmap, CONST D2D1_BITMAP_BRUSH_PROPERTIES1 &bitmapBrushProperties,
776            CONST D2D1_BRUSH_PROPERTIES &brushProperties, ID2D1BitmapBrush1 **bitmapBrush) {
777        return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, bitmapBrush);
778    }
779
780    void DrawImage(ID2D1Effect *effect, CONST D2D1_POINT_2F *targetOffset = NULL, CONST D2D1_RECT_F *imageRectangle = NULL,
781            D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
782            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
783        ID2D1Image *output = NULL;
784        effect->GetOutput(&output);
785        DrawImage(output, targetOffset, imageRectangle, interpolationMode, compositeMode);
786        output->Release();
787    }
788
789    void DrawImage(ID2D1Image *image, D2D1_INTERPOLATION_MODE interpolationMode,
790            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
791        DrawImage(image, NULL, NULL, interpolationMode, compositeMode);
792    }
793
794    void DrawImage(ID2D1Effect *effect, D2D1_INTERPOLATION_MODE interpolationMode,
795            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
796        DrawImage(effect, NULL, NULL, interpolationMode, compositeMode);
797    }
798
799    void DrawImage(ID2D1Image *image, D2D1_POINT_2F targetOffset,
800            D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
801            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
802        DrawImage(image, &targetOffset, NULL, interpolationMode, compositeMode);
803    }
804
805    void DrawImage(ID2D1Effect *effect, D2D1_POINT_2F targetOffset,
806            D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
807            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
808        DrawImage(effect, &targetOffset, NULL, interpolationMode, compositeMode);
809    }
810
811    void DrawImage(ID2D1Image *image, D2D1_POINT_2F targetOffset, CONST D2D1_RECT_F &imageRectangle,
812            D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
813            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
814        DrawImage(image, &targetOffset, &imageRectangle, interpolationMode, compositeMode);
815    }
816
817    void DrawImage(ID2D1Effect *effect, D2D1_POINT_2F targetOffset, CONST D2D1_RECT_F &imageRectangle,
818            D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
819            D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER) {
820        DrawImage(effect, &targetOffset, &imageRectangle, interpolationMode, compositeMode);
821    }
822
823    void PushLayer(CONST D2D1_LAYER_PARAMETERS1 &layerParameters, ID2D1Layer *layer) {
824        PushLayer(&layerParameters, layer);
825    }
826
827    void DrawGdiMetafile(ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset) {
828        DrawGdiMetafile(gdiMetafile, &targetOffset);
829    }
830
831    void DrawBitmap(ID2D1Bitmap *bitmap, CONST D2D1_RECT_F &destinationRectangle, FLOAT opacity,
832            D2D1_INTERPOLATION_MODE interpolationMode, CONST D2D1_RECT_F *sourceRectangle = NULL,
833            CONST D2D1_MATRIX_4X4_F *perspectiveTransform = NULL) {
834        DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform);
835    }
836
837    void DrawBitmap(ID2D1Bitmap *bitmap, CONST D2D1_RECT_F &destinationRectangle, FLOAT opacity,
838            D2D1_INTERPOLATION_MODE interpolationMode, CONST D2D1_RECT_F &sourceRectangle,
839            CONST D2D1_MATRIX_4X4_F *perspectiveTransform = NULL) {
840        DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, perspectiveTransform);
841    }
842
843    void DrawBitmap(ID2D1Bitmap *bitmap, CONST D2D1_RECT_F &destinationRectangle, FLOAT opacity,
844            D2D1_INTERPOLATION_MODE interpolationMode, CONST D2D1_RECT_F &sourceRectangle,
845            CONST D2D1_MATRIX_4X4_F &perspectiveTransform) {
846        DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, &perspectiveTransform);
847    }
848
849    void FillOpacityMask(ID2D1Bitmap *opacityMask, ID2D1Brush *brush, CONST D2D1_RECT_F &destinationRectangle,
850            CONST D2D1_RECT_F *sourceRectangle = NULL) {
851        FillOpacityMask(opacityMask, brush, &destinationRectangle, sourceRectangle);
852    }
853
854    void FillOpacityMask(ID2D1Bitmap *opacityMask, ID2D1Brush *brush, CONST D2D1_RECT_F &destinationRectangle,
855            CONST D2D1_RECT_F &sourceRectangle) {
856        FillOpacityMask(opacityMask, brush, &destinationRectangle, &sourceRectangle);
857    }
858
859    void SetRenderingControls(CONST D2D1_RENDERING_CONTROLS &renderingControls) {
860        return SetRenderingControls(&renderingControls);
861    }
862};
863
864
865#else
866
867typedef interface ID2D1DeviceContext ID2D1DeviceContext;
868/* FIXME: Add full C declaration */
869
870#endif
871
872DEFINE_GUID(IID_ID2D1DeviceContext, 0xe8f7fe7a,0x191c,0x466d,0xad,0x95,0x97,0x56,0x78,0xbd,0xa9,0x98);
873__CRT_UUID_DECL(ID2D1DeviceContext, 0xe8f7fe7a,0x191c,0x466d,0xad,0x95,0x97,0x56,0x78,0xbd,0xa9,0x98);
874
875#ifndef D2D_USE_C_DEFINITIONS
876
877interface ID2D1Device : public ID2D1Resource
878{
879    STDMETHOD(CreateDeviceContext)(D2D1_DEVICE_CONTEXT_OPTIONS options, ID2D1DeviceContext **deviceContext) PURE;
880    STDMETHOD(CreatePrintControl)(IWICImagingFactory *wicFactory, IPrintDocumentPackageTarget *documentTarget,
881            CONST D2D1_PRINT_CONTROL_PROPERTIES *printControlProperties, ID2D1PrintControl **printControl) PURE;
882    STDMETHOD_(void, SetMaximumTextureMemory)(UINT64 maximumInBytes) PURE;
883    STDMETHOD_(UINT64, GetMaximumTextureMemory)() CONST PURE;
884    STDMETHOD_(void, ClearResources)(UINT32 millisecondsSinceUse = 0) PURE;
885
886    HRESULT CreatePrintControl(IWICImagingFactory *wicFactory, IPrintDocumentPackageTarget *documentTarget,
887            CONST D2D1_PRINT_CONTROL_PROPERTIES &printControlProperties, ID2D1PrintControl **printControl) {
888        return CreatePrintControl(wicFactory, documentTarget, &printControlProperties, printControl);
889    }
890};
891
892#else
893
894typedef interface ID2D1Device ID2D1Device;
895/* FIXME: Add full C declaration */
896
897#endif
898
899DEFINE_GUID(IID_ID2D1Device, 0x47dd575d,0xac05,0x4cdd,0x80,0x49,0x9b,0x02,0xcd,0x16,0xf4,0x4c);
900__CRT_UUID_DECL(ID2D1Device, 0x47dd575d,0xac05,0x4cdd,0x80,0x49,0x9b,0x02,0xcd,0x16,0xf4,0x4c);
901
902#ifndef D2D_USE_C_DEFINITIONS
903
904interface ID2D1DrawingStateBlock1 : public ID2D1DrawingStateBlock
905{
906    STDMETHOD_(void, GetDescription)(D2D1_DRAWING_STATE_DESCRIPTION1 *stateDescription) CONST PURE;
907    using ID2D1DrawingStateBlock::GetDescription;
908
909    STDMETHOD_(void, SetDescription)(CONST D2D1_DRAWING_STATE_DESCRIPTION1 *stateDescription) PURE;
910    using ID2D1DrawingStateBlock::SetDescription;
911};
912
913#else
914
915typedef interface ID2D1DrawingStateBlock1 ID2D1DrawingStateBlock1;
916/* FIXME: Add full C declaration */
917
918#endif
919
920DEFINE_GUID(IID_ID2D1DrawingStateBlock1, 0x689f1f85,0xc72e,0x4e33,0x8f,0x19,0x85,0x75,0x4e,0xfd,0x5a,0xce);
921__CRT_UUID_DECL(ID2D1DrawingStateBlock1, 0x689f1f85,0xc72e,0x4e33,0x8f,0x19,0x85,0x75,0x4e,0xfd,0x5a,0xce);
922
923#ifndef D2D_USE_C_DEFINITIONS
924
925interface ID2D1PathGeometry1 : public ID2D1PathGeometry
926{
927    STDMETHOD(ComputePointAndSegmentAtLength)(FLOAT length, UINT32 startSegment, CONST D2D1_MATRIX_3X2_F *worldTransform,
928            FLOAT flatteningTolerance, D2D1_POINT_DESCRIPTION *pointDescription) CONST PURE;
929
930    HRESULT ComputePointAndSegmentAtLength(FLOAT length, UINT32 startSegment, CONST D2D1_MATRIX_3X2_F &worldTransform,
931            FLOAT flatteningTolerance, D2D1_POINT_DESCRIPTION *pointDescription) CONST {
932        return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, flatteningTolerance, pointDescription);
933    }
934
935    HRESULT ComputePointAndSegmentAtLength(FLOAT length, UINT32 startSegment, CONST D2D1_MATRIX_3X2_F *worldTransform,
936            D2D1_POINT_DESCRIPTION *pointDescription) CONST {
937        return ComputePointAndSegmentAtLength(length, startSegment, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE,
938                                              pointDescription);
939    }
940
941    HRESULT ComputePointAndSegmentAtLength(FLOAT length, UINT32 startSegment, CONST D2D1_MATRIX_3X2_F &worldTransform,
942            D2D1_POINT_DESCRIPTION *pointDescription) CONST {
943        return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE,
944                                              pointDescription);
945    }
946};
947
948#else
949
950typedef interface ID2D1PathGeometry1 ID2D1PathGeometry1;
951/* FIXME: Add full C declaration */
952
953#endif
954
955DEFINE_GUID(IID_ID2D1PathGeometry1, 0x62baa2d2,0xab54,0x41b7,0xb8,0x72,0x78,0x7e,0x01,0x06,0xa4,0x21);
956__CRT_UUID_DECL(ID2D1PathGeometry1, 0x62baa2d2,0xab54,0x41b7,0xb8,0x72,0x78,0x7e,0x01,0x06,0xa4,0x21);
957
958#ifndef D2D_USE_C_DEFINITIONS
959
960interface ID2D1Factory1 : public ID2D1Factory
961{
962    STDMETHOD(CreateDevice)(IDXGIDevice *dxgiDevice, ID2D1Device **d2dDevice) PURE;
963
964    STDMETHOD(CreateStrokeStyle)(CONST D2D1_STROKE_STYLE_PROPERTIES1 *strokeStyleProperties,
965            CONST FLOAT *dashes, UINT32 dashesCount, ID2D1StrokeStyle1 **strokeStyle) PURE;
966    using ID2D1Factory::CreateStrokeStyle;
967
968    STDMETHOD(CreatePathGeometry)(ID2D1PathGeometry1 **pathGeometry) PURE;
969    using ID2D1Factory::CreatePathGeometry;
970
971    STDMETHOD(CreateDrawingStateBlock)(CONST D2D1_DRAWING_STATE_DESCRIPTION1 *drawingStateDescription,
972            IDWriteRenderingParams *textRenderingParams, ID2D1DrawingStateBlock1 **drawingStateBlock) PURE;
973    using ID2D1Factory::CreateDrawingStateBlock;
974
975    STDMETHOD(CreateGdiMetafile)(IStream *metafileStream, ID2D1GdiMetafile **metafile) PURE;
976    STDMETHOD(RegisterEffectFromStream)(REFCLSID classId, IStream *propertyXml, CONST D2D1_PROPERTY_BINDING *bindings,
977            UINT32 bindingsCount, CONST PD2D1_EFFECT_FACTORY effectFactory) PURE;
978    STDMETHOD(RegisterEffectFromString)(REFCLSID classId, PCWSTR propertyXml, CONST D2D1_PROPERTY_BINDING *bindings,
979            UINT32 bindingsCount, CONST PD2D1_EFFECT_FACTORY effectFactory) PURE;
980    STDMETHOD(UnregisterEffect)(REFCLSID classId) PURE;
981    STDMETHOD(GetRegisteredEffects)(CLSID *effects, UINT32 effectsCount, UINT32 *effectsReturned,
982            UINT32 *effectsRegistered) CONST PURE;
983    STDMETHOD(GetEffectProperties)(REFCLSID effectId, ID2D1Properties **properties) CONST PURE;
984
985    HRESULT CreateStrokeStyle(CONST D2D1_STROKE_STYLE_PROPERTIES1 &strokeStyleProperties, CONST FLOAT *dashes,
986            UINT32 dashesCount, ID2D1StrokeStyle1 **strokeStyle) {
987        return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, strokeStyle);
988    }
989
990    HRESULT CreateDrawingStateBlock(CONST D2D1_DRAWING_STATE_DESCRIPTION1 &drawingStateDescription,
991            ID2D1DrawingStateBlock1 **drawingStateBlock) {
992        return CreateDrawingStateBlock(&drawingStateDescription, NULL, drawingStateBlock);
993    }
994
995    HRESULT CreateDrawingStateBlock(ID2D1DrawingStateBlock1 **drawingStateBlock) {
996        return CreateDrawingStateBlock(NULL, NULL, drawingStateBlock);
997    }
998};
999
1000#else
1001
1002typedef interface ID2D1Factory1 ID2D1Factory1;
1003/* FIXME: Add full C declaration */
1004
1005#endif
1006
1007DEFINE_GUID(IID_ID2D1Factory1, 0xbb12d362,0xdaee,0x4b9a,0xaa,0x1d,0x14,0xba,0x40,0x1c,0xfa,0x1f);
1008__CRT_UUID_DECL(ID2D1Factory1, 0xbb12d362,0xdaee,0x4b9a,0xaa,0x1d,0x14,0xba,0x40,0x1c,0xfa,0x1f);
1009
1010#include <d2d1_1helper.h>
1011
1012#endif
1013