2 * Copyright 2017 Lucian Poston
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 interface ID2D1DeviceContext
;
22 interface ID2D1StrokeStyle1
;
23 interface ID2D1PathGeometry1
;
24 interface ID2D1DrawingStateBlock1
;
25 interface ID2D1GdiMetafile
;
26 interface ID2D1Properties
;
27 interface IPrintDocumentPackageTarget
;
28 interface ID2D1PrintControl
;
29 interface IWICImagingFactory
;
30 interface IWICColorContext
;
31 interface ID2D1ColorContext
;
32 interface ID2D1Effect
;
33 interface ID2D1GradientStopCollection1
;
34 interface ID2D1ImageBrush
;
35 interface ID2D1BitmapBrush1
;
36 interface ID2D1CommandList
;
38 cpp_quote
("#ifndef __dwrite_h__")
39 /* already defined in dwrite.h but needed for WIDL */
40 typedef struct DWRITE_GLYPH_RUN_DESCRIPTION DWRITE_GLYPH_RUN_DESCRIPTION
;
41 cpp_quote
("#endif /* __dwrite_h__ */")
43 typedef enum D2D1_DEVICE_CONTEXT_OPTIONS
45 D2D1_DEVICE_CONTEXT_OPTIONS_NONE
= 0x0,
46 D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS
= 0x1,
47 D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD
= 0xffffffff,
48 } D2D1_DEVICE_CONTEXT_OPTIONS
;
50 typedef enum D2D1_STROKE_TRANSFORM_TYPE
52 D2D1_STROKE_TRANSFORM_TYPE_NORMAL
= 0x0,
53 D2D1_STROKE_TRANSFORM_TYPE_FIXED
= 0x1,
54 D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE
= 0x2,
55 D2D1_STROKE_TRANSFORM_TYPE_FORCE_DWORD
= 0xffffffff,
56 } D2D1_STROKE_TRANSFORM_TYPE
;
58 typedef enum D2D1_PRIMITIVE_BLEND
60 D2D1_PRIMITIVE_BLEND_SOURCE_OVER
= 0x0,
61 D2D1_PRIMITIVE_BLEND_COPY
= 0x1,
62 D2D1_PRIMITIVE_BLEND_MIN
= 0x2,
63 D2D1_PRIMITIVE_BLEND_ADD
= 0x3,
64 D2D1_PRIMITIVE_BLEND_MAX
= 0x4,
65 D2D1_PRIMITIVE_BLEND_FORCE_DWORD
= 0xffffffff,
66 } D2D1_PRIMITIVE_BLEND
;
68 typedef enum D2D1_UNIT_MODE
70 D2D1_UNIT_MODE_DIPS
= 0x0,
71 D2D1_UNIT_MODE_PIXELS
= 0x1,
72 D2D1_UNIT_MODE_FORCE_DWORD
= 0xffffffff,
75 typedef enum D2D1_PRINT_FONT_SUBSET_MODE
77 D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT
= 0x0,
78 D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE
= 0x1,
79 D2D1_PRINT_FONT_SUBSET_MODE_NONE
= 0x2,
80 D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD
= 0xffffffff,
81 } D2D1_PRINT_FONT_SUBSET_MODE
;
83 typedef enum D2D1_COLOR_SPACE
85 D2D1_COLOR_SPACE_CUSTOM
= 0x0,
86 D2D1_COLOR_SPACE_SRGB
= 0x1,
87 D2D1_COLOR_SPACE_SCRGB
= 0x2,
88 D2D1_COLOR_SPACE_FORCE_DWORD
= 0xffffffff,
91 typedef enum D2D1_BITMAP_OPTIONS
93 D2D1_BITMAP_OPTIONS_NONE
= 0x0,
94 D2D1_BITMAP_OPTIONS_TARGET
= 0x1,
95 D2D1_BITMAP_OPTIONS_CANNOT_DRAW
= 0x2,
96 D2D1_BITMAP_OPTIONS_CPU_READ
= 0x4,
97 D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
= 0x8,
98 D2D1_BITMAP_OPTIONS_FORCE_DWORD
= 0xffffffff,
99 } D2D1_BITMAP_OPTIONS
;
101 typedef enum D2D1_MAP_OPTIONS
103 D2D1_MAP_OPTIONS_NONE
= 0x0,
104 D2D1_MAP_OPTIONS_READ
= 0x1,
105 D2D1_MAP_OPTIONS_WRITE
= 0x2,
106 D2D1_MAP_OPTIONS_DISCARD
= 0x4,
107 D2D1_MAP_OPTIONS_FORCE_DWORD
= 0xffffffff,
110 typedef enum D2D1_BUFFER_PRECISION
112 D2D1_BUFFER_PRECISION_UNKNOWN
= 0x0,
113 D2D1_BUFFER_PRECISION_8BPC_UNORM
= 0x1,
114 D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB
= 0x2,
115 D2D1_BUFFER_PRECISION_16BPC_UNORM
= 0x3,
116 D2D1_BUFFER_PRECISION_16BPC_FLOAT
= 0x4,
117 D2D1_BUFFER_PRECISION_32BPC_FLOAT
= 0x5,
118 D2D1_BUFFER_PRECISION_FORCE_DWORD
= 0xffffffff,
119 } D2D1_BUFFER_PRECISION
;
121 typedef enum D2D1_COLOR_INTERPOLATION_MODE
123 D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT
= 0x0,
124 D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED
= 0x1,
125 D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD
= 0xffffffff,
126 } D2D1_COLOR_INTERPOLATION_MODE
;
128 typedef enum D2D1_INTERPOLATION_MODE
130 D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR
= D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR
,
131 D2D1_INTERPOLATION_MODE_LINEAR
= D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR
,
132 D2D1_INTERPOLATION_MODE_CUBIC
= D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC
,
133 D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR
= D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR
,
134 D2D1_INTERPOLATION_MODE_ANISOTROPIC
= D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC
,
135 D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC
= D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC
,
136 D2D1_INTERPOLATION_MODE_FORCE_DWORD
= 0xffffffff,
137 } D2D1_INTERPOLATION_MODE
;
139 typedef enum D2D1_COMPOSITE_MODE
141 D2D1_COMPOSITE_MODE_SOURCE_OVER
= 0x0,
142 D2D1_COMPOSITE_MODE_DESTINATION_OVER
= 0x1,
143 D2D1_COMPOSITE_MODE_SOURCE_IN
= 0x2,
144 D2D1_COMPOSITE_MODE_DESTINATION_IN
= 0x3,
145 D2D1_COMPOSITE_MODE_SOURCE_OUT
= 0x4,
146 D2D1_COMPOSITE_MODE_DESTINATION_OUT
= 0x5,
147 D2D1_COMPOSITE_MODE_SOURCE_ATOP
= 0x6,
148 D2D1_COMPOSITE_MODE_DESTINATION_ATOP
= 0x7,
149 D2D1_COMPOSITE_MODE_XOR
= 0x8,
150 D2D1_COMPOSITE_MODE_PLUS
= 0x9,
151 D2D1_COMPOSITE_MODE_SOURCE_COPY
= 0xa,
152 D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY
= 0xb,
153 D2D1_COMPOSITE_MODE_MASK_INVERT
= 0xc,
154 D2D1_COMPOSITE_MODE_FORCE_DWORD
= 0xffffffff,
155 } D2D1_COMPOSITE_MODE
;
157 typedef enum D2D1_LAYER_OPTIONS1
159 D2D1_LAYER_OPTIONS1_NONE
= 0x0,
160 D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND
= 0x1,
161 D2D1_LAYER_OPTIONS1_IGNORE_ALPHA
= 0x2,
162 D2D1_LAYER_OPTIONS1_FORCE_DWORD
= 0xffffffff,
163 } D2D1_LAYER_OPTIONS1
;
165 typedef struct D2D1_PROPERTY_BINDING D2D1_PROPERTY_BINDING
;
166 typedef D2D_MATRIX_4X4_F D2D1_MATRIX_4X4_F
;
168 typedef struct D2D1_STROKE_STYLE_PROPERTIES1
170 D2D1_CAP_STYLE startCap
;
171 D2D1_CAP_STYLE endCap
;
172 D2D1_CAP_STYLE dashCap
;
173 D2D1_LINE_JOIN lineJoin
;
175 D2D1_DASH_STYLE dashStyle
;
177 D2D1_STROKE_TRANSFORM_TYPE transformType
;
178 } D2D1_STROKE_STYLE_PROPERTIES1
;
180 typedef struct D2D1_DRAWING_STATE_DESCRIPTION1
182 D2D1_ANTIALIAS_MODE antialiasMode
;
183 D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode
;
186 D2D1_MATRIX_3X2_F transform
;
187 D2D1_PRIMITIVE_BLEND primitiveBlend
;
188 D2D1_UNIT_MODE unitMode
;
189 } D2D1_DRAWING_STATE_DESCRIPTION1
;
191 typedef struct D2D1_PRINT_CONTROL_PROPERTIES
193 D2D1_PRINT_FONT_SUBSET_MODE fontSubset
;
195 D2D1_COLOR_SPACE colorSpace
;
196 } D2D1_PRINT_CONTROL_PROPERTIES
;
198 typedef struct D2D1_MAPPED_RECT
204 typedef struct D2D1_BITMAP_PROPERTIES1
206 D2D1_PIXEL_FORMAT pixelFormat
;
209 D2D1_BITMAP_OPTIONS bitmapOptions
;
210 ID2D1ColorContext
*colorContext
;
211 } D2D1_BITMAP_PROPERTIES1
;
213 typedef struct D2D1_IMAGE_BRUSH_PROPERTIES
215 D2D1_RECT_F sourceRectangle
;
216 D2D1_EXTEND_MODE extendModeX
;
217 D2D1_EXTEND_MODE extendModeY
;
218 D2D1_INTERPOLATION_MODE interpolationMode
;
219 } D2D1_IMAGE_BRUSH_PROPERTIES
;
221 typedef struct D2D1_BITMAP_BRUSH_PROPERTIES1
223 D2D1_EXTEND_MODE extendModeX
;
224 D2D1_EXTEND_MODE extendModeY
;
225 D2D1_INTERPOLATION_MODE interpolationMode
;
226 } D2D1_BITMAP_BRUSH_PROPERTIES1
;
228 typedef struct D2D1_RENDERING_CONTROLS
230 D2D1_BUFFER_PRECISION bufferPrecision
;
231 D2D1_SIZE_U tileSize
;
232 } D2D1_RENDERING_CONTROLS
;
234 typedef struct D2D1_LAYER_PARAMETERS1
236 D2D1_RECT_F contentBounds
;
237 ID2D1Geometry
*geometricMask
;
238 D2D1_ANTIALIAS_MODE maskAntialiasMode
;
239 D2D1_MATRIX_3X2_F maskTransform
;
241 ID2D1Brush
*opacityBrush
;
242 D2D1_LAYER_OPTIONS1 layerOptions
;
243 } D2D1_LAYER_PARAMETERS1
;
245 typedef struct D2D1_EFFECT_INPUT_DESCRIPTION
249 D2D1_RECT_F inputRectangle
;
250 } D2D1_EFFECT_INPUT_DESCRIPTION
;
252 typedef HRESULT (__stdcall
*PD2D1_EFFECT_FACTORY
)(IUnknown
**effect
);
256 uuid(a898a84c
-3873-4588-b08b
-ebbf978df041
),
259 interface ID2D1Bitmap1
: ID2D1Bitmap
261 void GetColorContext
(
262 [out] ID2D1ColorContext
**context
264 D2D1_BITMAP_OPTIONS GetOptions
();
266 [out] IDXGISurface
**surface
269 [in] D2D1_MAP_OPTIONS options
,
270 [out] D2D1_MAPPED_RECT
*mapped_rect
277 uuid(47dd575d
-ac05
-4cdd
-8049-9b02cd16f44c
),
280 interface ID2D1Device
: ID2D1Resource
282 HRESULT CreateDeviceContext
(
283 [in] D2D1_DEVICE_CONTEXT_OPTIONS options
,
284 [out] ID2D1DeviceContext
**context
286 HRESULT CreatePrintControl
(
287 [in] IWICImagingFactory
*wic_factory
,
288 [in] IPrintDocumentPackageTarget
*document_target
,
289 [in] const D2D1_PRINT_CONTROL_PROPERTIES
*desc
,
290 [out] ID2D1PrintControl
**print_control
292 void SetMaximumTextureMemory
(
293 [in] UINT64 max_texture_memory
295 UINT64 GetMaximumTextureMemory
();
296 HRESULT ClearResources
(
297 [in, defaultvalue(0)] UINT msec_since_use
303 uuid(e8f7fe7a
-191c
-466d
-ad95
-975678bda998
),
306 interface ID2D1DeviceContext
: ID2D1RenderTarget
308 HRESULT CreateBitmap
(
309 [in] D2D1_SIZE_U size
,
310 [in] const void *src_data
,
312 [in] const D2D1_BITMAP_PROPERTIES1
*desc
,
313 [out] ID2D1Bitmap1
**bitmap
315 HRESULT CreateBitmapFromWicBitmap
(
316 [in] IWICBitmapSource
*bitmap_source
,
317 [in] const D2D1_BITMAP_PROPERTIES1
*desc
,
318 [out] ID2D1Bitmap1
**bitmap
320 HRESULT CreateColorContext
(
321 [in] D2D1_COLOR_SPACE space
,
322 [in] const BYTE *profile
,
323 [in] UINT32 profile_size
,
324 [out] ID2D1ColorContext
**color_context
326 HRESULT CreateColorContextFromFilename
(
327 [in] const WCHAR
*filename
,
328 [out] ID2D1ColorContext
**color_context
330 HRESULT CreateColorContextFromWicColorContext
(
331 [in] IWICColorContext
*wic_color_context
,
332 [out] ID2D1ColorContext
**color_context
334 HRESULT CreateBitmapFromDxgiSurface
(
335 [in] IDXGISurface
*surface
,
336 [in] const D2D1_BITMAP_PROPERTIES1
*desc
,
337 [out] ID2D1Bitmap1
**bitmap
339 HRESULT CreateEffect
(
340 [in] REFCLSID effect_id
,
341 [out] ID2D1Effect
**effect
343 HRESULT CreateGradientStopCollection
(
344 [in] const D2D1_GRADIENT_STOP
*stops
,
345 [in] UINT32 stop_count
,
346 [in] D2D1_COLOR_SPACE preinterpolation_space
,
347 [in] D2D1_COLOR_SPACE postinterpolation_space
,
348 [in] D2D1_BUFFER_PRECISION buffer_precision
,
349 [in] D2D1_EXTEND_MODE extend_mode
,
350 [in] D2D1_COLOR_INTERPOLATION_MODE color_interpolation_mode
,
351 [out] ID2D1GradientStopCollection1
**gradient
353 HRESULT CreateImageBrush
(
354 [in] ID2D1Image
*image
,
355 [in] const D2D1_IMAGE_BRUSH_PROPERTIES
*image_brush_desc
,
356 [in] const D2D1_BRUSH_PROPERTIES
*brush_desc
,
357 [out] ID2D1ImageBrush
**brush
359 HRESULT CreateBitmapBrush
(
360 [in] ID2D1Bitmap
*bitmap
,
361 [in] const D2D1_BITMAP_BRUSH_PROPERTIES1
*bitmap_brush_desc
,
362 [in] const D2D1_BRUSH_PROPERTIES
*brush_desc
,
363 [out] ID2D1BitmapBrush1
**bitmap_brush
365 HRESULT CreateCommandList
(
366 [out] ID2D1CommandList
**command_list
368 BOOL IsDxgiFormatSupported
(
369 [in] DXGI_FORMAT format
371 BOOL IsBufferPrecisionSupported
(
372 [in] D2D1_BUFFER_PRECISION buffer_precision
374 void GetImageLocalBounds
(
375 [in] ID2D1Image
*image
,
376 [out] D2D1_RECT_F
*local_bounds
378 HRESULT GetImageWorldBounds
(
379 [in] ID2D1Image
*image
,
380 [out] D2D1_RECT_F
*world_bounds
382 HRESULT GetGlyphRunWorldBounds
(
383 [in] D2D1_POINT_2F baseline_origin
,
384 [in] const DWRITE_GLYPH_RUN
*glyph_run
,
385 [in] DWRITE_MEASURING_MODE measuring_mode
,
386 [out] D2D1_RECT_F
*bounds
389 [out] ID2D1Device
**device
392 [in] ID2D1Image
*target
395 [out] ID2D1Image
**target
397 void SetRenderingControls
(
398 [in] const D2D1_RENDERING_CONTROLS
*rendering_controls
400 void GetRenderingControls
(
401 [out] D2D1_RENDERING_CONTROLS
*rendering_controls
403 void SetPrimitiveBlend
(
404 [in] D2D1_PRIMITIVE_BLEND primitive_blend
406 D2D1_PRIMITIVE_BLEND GetPrimitiveBlend
();
408 [in] D2D1_UNIT_MODE unit_mode
410 D2D1_UNIT_MODE GetUnitMode
();
412 [in] D2D1_POINT_2F baseline_origin
,
413 [in] const DWRITE_GLYPH_RUN
*glyph_run
,
414 [in] const DWRITE_GLYPH_RUN_DESCRIPTION
*glyph_run_desc
,
415 [in] ID2D1Brush
*brush
,
416 [in] DWRITE_MEASURING_MODE measuring_mode
419 [in] ID2D1Image
*image
,
420 [in] const D2D1_POINT_2F
*target_offset
,
421 [in] const D2D1_RECT_F
*image_rect
,
422 [in] D2D1_INTERPOLATION_MODE interpolation_mode
,
423 [in] D2D1_COMPOSITE_MODE composite_mode
425 void DrawGdiMetafile
(
426 [in] ID2D1GdiMetafile
*metafile
,
427 [in] const D2D1_POINT_2F
*target_offset
430 [in] ID2D1Bitmap
*bitmap
,
431 [in] const D2D1_RECT_F
*dst_rect
,
433 [in] D2D1_INTERPOLATION_MODE interpolation_mode
,
434 [in] const D2D1_RECT_F
*src_rect
,
435 [in] const D2D1_MATRIX_4X4_F
*perspective_transform
438 [in] const D2D1_LAYER_PARAMETERS1
*layer_parameters
,
439 [in] ID2D1Layer
*layer
441 HRESULT InvalidateEffectInputRectangle
(
442 [in] ID2D1Effect
*effect
,
444 [in] const D2D1_RECT_F
*input_rect
446 HRESULT GetEffectInvalidRectangleCount
(
447 [in] ID2D1Effect
*effect
,
448 [out] UINT32
*rect_count
450 HRESULT GetEffectInvalidRectangles
(
451 [in] ID2D1Effect
*effect
,
452 [out] D2D1_RECT_F
*rectangles
,
453 [in] UINT32 rect_count
455 HRESULT GetEffectRequiredInputRectangles
(
456 [in] ID2D1Effect
*effect
,
457 [in] const D2D1_RECT_F
*image_rect
,
458 [in] const D2D1_EFFECT_INPUT_DESCRIPTION
*desc
,
459 [out] D2D1_RECT_F
*input_rect
,
460 [in] UINT32 input_count
462 void FillOpacityMask
(
463 [in] ID2D1Bitmap
*mask
,
464 [in] ID2D1Brush
*brush
,
465 [in] const D2D1_RECT_F
*dst_rect
,
466 [in] const D2D1_RECT_F
*src_rect
472 uuid(bb12d362
-daee
-4b9a
-aa1d
-14ba401cfa1f
),
475 interface ID2D1Factory1
: ID2D1Factory
477 HRESULT CreateDevice
(
478 [in] IDXGIDevice
*dxgi_device
,
479 [out] ID2D1Device
**device
481 HRESULT CreateStrokeStyle
(
482 [in] const D2D1_STROKE_STYLE_PROPERTIES1
*desc
,
483 [in, size_is(dash_count
)] const float *dashes
,
484 [in] UINT32 dash_count
,
485 [out] ID2D1StrokeStyle1
**stroke_style
487 HRESULT CreatePathGeometry
(
488 [out] ID2D1PathGeometry1
**geometry
490 HRESULT CreateDrawingStateBlock
(
491 [in] const D2D1_DRAWING_STATE_DESCRIPTION1
*desc
,
492 [in] IDWriteRenderingParams
*text_rendering_params
,
493 [out] ID2D1DrawingStateBlock1
**state_block
495 HRESULT CreateGdiMetafile
(
496 [in] IStream
*stream
,
497 [out] ID2D1GdiMetafile
**metafile
499 HRESULT RegisterEffectFromStream
(
500 [in] REFCLSID effect_id
,
501 [in] IStream
*property_xml
,
502 [in, size_is(binding_count
)] const D2D1_PROPERTY_BINDING
*bindings
,
503 [in] UINT32 binding_count
,
504 [in] PD2D1_EFFECT_FACTORY effect_factory
506 HRESULT RegisterEffectFromString
(
507 [in] REFCLSID effect_id
,
508 [in] const WCHAR
*property_xml
,
509 [in, size_is(binding_count
)] const D2D1_PROPERTY_BINDING
*bindings
,
510 [in] UINT32 binding_count
,
511 [in] PD2D1_EFFECT_FACTORY effect_factory
513 HRESULT UnregisterEffect
(
514 [in] REFCLSID effect_id
516 HRESULT GetRegisteredEffects
(
517 [out, size_is(effect_count
)] CLSID
*effects
,
518 [in] UINT32 effect_count
,
519 [out] UINT32
*returned
,
520 [out] UINT32
*registered
522 HRESULT GetEffectProperties
(
523 [in] REFCLSID effect_id
,
524 [out] ID2D1Properties
**props