blob: b157781c18ee52b628df589004e80f2083b55018 [file] [log] [blame]
José Fonseca31f2b6e2011-10-10 01:45:04 +01001##########################################################################
2#
Jose Fonsecaf7a71302015-08-13 16:10:06 +01003# Copyright 2015 VMware, Inc
José Fonseca31f2b6e2011-10-10 01:45:04 +01004# Copyright 2011 Jose Fonseca
5# All Rights Reserved.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13#
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16#
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24#
25##########################################################################/
26
27
Piotr Podsiadły0b8b0192019-01-03 20:39:55 +010028from .winapi import *
29from .dxgi import DXGI_FORMAT, IDXGISurface
30from .dwrite import *
José Fonseca31f2b6e2011-10-10 01:45:04 +010031
32
Jose Fonseca25a41c52015-08-13 20:38:40 +010033
34#
35# D2D
36#
37
38HRESULT = MAKE_HRESULT(errors = [
39 "D2DERR_UNSUPPORTED_PIXEL_FORMAT",
40 "D2DERR_INSUFFICIENT_BUFFER",
41 "D2DERR_WRONG_STATE",
42 "D2DERR_NOT_INITIALIZED",
43 "D2DERR_UNSUPPORTED_OPERATION",
44 "D2DERR_SCANNER_FAILED",
45 "D2DERR_SCREEN_ACCESS_DENIED",
46 "D2DERR_DISPLAY_STATE_INVALID",
47 "D2DERR_ZERO_VECTOR",
48 "D2DERR_INTERNAL_ERROR",
49 "D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED",
50 "D2DERR_INVALID_CALL",
51 "D2DERR_NO_HARDWARE_DEVICE",
52 "D2DERR_RECREATE_TARGET",
53 "D2DERR_TOO_MANY_SHADER_ELEMENTS",
54 "D2DERR_SHADER_COMPILE_FAILED",
55 "D2DERR_MAX_TEXTURE_SIZE_EXCEEDED",
56 "D2DERR_UNSUPPORTED_VERSION",
57 "D2DERR_BAD_NUMBER",
58 "D2DERR_WRONG_FACTORY",
59 "D2DERR_LAYER_ALREADY_IN_USE",
60 "D2DERR_POP_CALL_DID_NOT_MATCH_PUSH",
61 "D2DERR_WRONG_RESOURCE_DOMAIN",
62 "D2DERR_PUSH_POP_UNBALANCED",
63 "D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT",
64 "D2DERR_INCOMPATIBLE_BRUSH_TYPES",
65 "D2DERR_WIN32_ERROR",
66 "D2DERR_TARGET_NOT_GDI_COMPATIBLE",
67 "D2DERR_TEXT_EFFECT_IS_WRONG_TYPE",
68 "D2DERR_TEXT_RENDERER_NOT_RELEASED",
69 "D2DERR_EXCEEDS_MAX_BITMAP_SIZE",
70])
71
72D3DCOLORVALUE = Struct("D3DCOLORVALUE", [
73 (FLOAT, "r"),
74 (FLOAT, "g"),
75 (FLOAT, "b"),
76 (FLOAT, "a"),
77])
78
79D2D_POINT_2U = Struct("D2D_POINT_2U", [
80 (UINT32, "x"),
81 (UINT32, "y"),
82])
83
84D2D_POINT_2F = Struct("D2D_POINT_2F", [
85 (FLOAT, "x"),
86 (FLOAT, "y"),
87])
88
Jose Fonsecaf7a71302015-08-13 16:10:06 +010089D2D_POINT_2L = Alias("D2D_POINT_2L", POINT)
90
91D2D_VECTOR_2F = Struct("D2D_VECTOR_2F", [
92 (FLOAT, "x"),
93 (FLOAT, "y"),
94])
95
96D2D_VECTOR_3F = Struct("D2D_VECTOR_3F", [
97 (FLOAT, "x"),
98 (FLOAT, "y"),
99 (FLOAT, "z"),
100])
101
102D2D_VECTOR_4F = Struct("D2D_VECTOR_4F", [
103 (FLOAT, "x"),
104 (FLOAT, "y"),
105 (FLOAT, "z"),
106 (FLOAT, "w"),
107])
108
Jose Fonseca25a41c52015-08-13 20:38:40 +0100109D2D_RECT_F = Struct("D2D_RECT_F", [
110 (FLOAT, "left"),
111 (FLOAT, "top"),
112 (FLOAT, "right"),
113 (FLOAT, "bottom"),
114])
115
116D2D_RECT_U = Struct("D2D_RECT_U", [
117 (UINT32, "left"),
118 (UINT32, "top"),
119 (UINT32, "right"),
120 (UINT32, "bottom"),
121])
122
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100123D2D_RECT_L = Alias("D2D_RECT_L", RECT)
124
Jose Fonseca25a41c52015-08-13 20:38:40 +0100125D2D_SIZE_F = Struct("D2D_SIZE_F", [
126 (FLOAT, "width"),
127 (FLOAT, "height"),
128])
129
130D2D_SIZE_U = Struct("D2D_SIZE_U", [
131 (UINT32, "width"),
132 (UINT32, "height"),
133])
134
135D2D_COLOR_F = Alias("D2D_COLOR_F", D3DCOLORVALUE)
136D2D_MATRIX_3X2_F = Struct("D2D_MATRIX_3X2_F", [
137 (FLOAT, "_11"),
138 (FLOAT, "_12"),
139 (FLOAT, "_21"),
140 (FLOAT, "_22"),
141 (FLOAT, "_31"),
142 (FLOAT, "_32"),
143])
144
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100145D2D_MATRIX_4X3_F = Struct("D2D_MATRIX_4X3_F", [
146 (Array(Array(FLOAT, 3), 4), "m"),
147])
148
149D2D_MATRIX_4X4_F = Struct("D2D_MATRIX_4X4_F", [
150 (Array(Array(FLOAT, 4), 4), "m"),
151])
152
153D2D_MATRIX_5X4_F = Struct("D2D_MATRIX_5X4_F", [
154 (Array(Array(FLOAT, 4), 5), "m"),
155])
156
Jose Fonseca25a41c52015-08-13 20:38:40 +0100157
158
159#
160# D2D1
161#
162
José Fonseca31f2b6e2011-10-10 01:45:04 +0100163ID2D1Resource = Interface("ID2D1Resource", IUnknown)
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100164ID2D1Image = Interface("ID2D1Image", ID2D1Resource)
José Fonseca31f2b6e2011-10-10 01:45:04 +0100165ID2D1Bitmap = Interface("ID2D1Bitmap", ID2D1Resource)
166ID2D1GradientStopCollection = Interface("ID2D1GradientStopCollection", ID2D1Resource)
167ID2D1Brush = Interface("ID2D1Brush", ID2D1Resource)
168ID2D1BitmapBrush = Interface("ID2D1BitmapBrush", ID2D1Brush)
169ID2D1SolidColorBrush = Interface("ID2D1SolidColorBrush", ID2D1Brush)
170ID2D1LinearGradientBrush = Interface("ID2D1LinearGradientBrush", ID2D1Brush)
171ID2D1RadialGradientBrush = Interface("ID2D1RadialGradientBrush", ID2D1Brush)
172ID2D1StrokeStyle = Interface("ID2D1StrokeStyle", ID2D1Resource)
173ID2D1Geometry = Interface("ID2D1Geometry", ID2D1Resource)
174ID2D1RectangleGeometry = Interface("ID2D1RectangleGeometry", ID2D1Geometry)
175ID2D1RoundedRectangleGeometry = Interface("ID2D1RoundedRectangleGeometry", ID2D1Geometry)
176ID2D1EllipseGeometry = Interface("ID2D1EllipseGeometry", ID2D1Geometry)
177ID2D1GeometryGroup = Interface("ID2D1GeometryGroup", ID2D1Geometry)
178ID2D1TransformedGeometry = Interface("ID2D1TransformedGeometry", ID2D1Geometry)
179ID2D1GeometrySink = Interface("ID2D1GeometrySink", ID2D1SimplifiedGeometrySink)
180ID2D1TessellationSink = Interface("ID2D1TessellationSink", IUnknown)
181ID2D1PathGeometry = Interface("ID2D1PathGeometry", ID2D1Geometry)
182ID2D1Mesh = Interface("ID2D1Mesh", ID2D1Resource)
183ID2D1Layer = Interface("ID2D1Layer", ID2D1Resource)
184ID2D1DrawingStateBlock = Interface("ID2D1DrawingStateBlock", ID2D1Resource)
185ID2D1RenderTarget = Interface("ID2D1RenderTarget", ID2D1Resource)
186ID2D1BitmapRenderTarget = Interface("ID2D1BitmapRenderTarget", ID2D1RenderTarget)
187ID2D1HwndRenderTarget = Interface("ID2D1HwndRenderTarget", ID2D1RenderTarget)
188ID2D1GdiInteropRenderTarget = Interface("ID2D1GdiInteropRenderTarget", IUnknown)
189ID2D1DCRenderTarget = Interface("ID2D1DCRenderTarget", ID2D1RenderTarget)
190ID2D1Factory = Interface("ID2D1Factory", IUnknown)
191
192
193D2D1_ALPHA_MODE = Enum("D2D1_ALPHA_MODE", [
194 "D2D1_ALPHA_MODE_UNKNOWN",
195 "D2D1_ALPHA_MODE_PREMULTIPLIED",
196 "D2D1_ALPHA_MODE_STRAIGHT",
197 "D2D1_ALPHA_MODE_IGNORE",
198])
199
200D2D1_GAMMA = Enum("D2D1_GAMMA", [
201 "D2D1_GAMMA_2_2",
202 "D2D1_GAMMA_1_0",
203])
204
205D2D1_OPACITY_MASK_CONTENT = Enum("D2D1_OPACITY_MASK_CONTENT", [
206 "D2D1_OPACITY_MASK_CONTENT_GRAPHICS",
207 "D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL",
208 "D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE",
209])
210
211D2D1_EXTEND_MODE = Enum("D2D1_EXTEND_MODE", [
212 "D2D1_EXTEND_MODE_CLAMP",
213 "D2D1_EXTEND_MODE_WRAP",
214 "D2D1_EXTEND_MODE_MIRROR",
215])
216
217D2D1_ANTIALIAS_MODE = Enum("D2D1_ANTIALIAS_MODE", [
218 "D2D1_ANTIALIAS_MODE_PER_PRIMITIVE",
219 "D2D1_ANTIALIAS_MODE_ALIASED",
220])
221
222D2D1_TEXT_ANTIALIAS_MODE = Enum("D2D1_TEXT_ANTIALIAS_MODE", [
223 "D2D1_TEXT_ANTIALIAS_MODE_DEFAULT",
224 "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE",
225 "D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE",
226 "D2D1_TEXT_ANTIALIAS_MODE_ALIASED",
227])
228
229D2D1_BITMAP_INTERPOLATION_MODE = Enum("D2D1_BITMAP_INTERPOLATION_MODE", [
230 "D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR",
231 "D2D1_BITMAP_INTERPOLATION_MODE_LINEAR",
232])
233
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100234D2D1_DRAW_TEXT_OPTIONS = EnumFlags("D2D1_DRAW_TEXT_OPTIONS", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100235 "D2D1_DRAW_TEXT_OPTIONS_NONE",
236 "D2D1_DRAW_TEXT_OPTIONS_NO_SNAP",
José Fonsecab63c3282011-10-10 14:18:38 +0100237 "D2D1_DRAW_TEXT_OPTIONS_CLIP",
José Fonseca31f2b6e2011-10-10 01:45:04 +0100238])
239
240D2D1_PIXEL_FORMAT = Struct("D2D1_PIXEL_FORMAT", [
241 (DXGI_FORMAT, "format"),
242 (D2D1_ALPHA_MODE, "alphaMode"),
243])
244
245D2D1_POINT_2U = Alias("D2D1_POINT_2U", D2D_POINT_2U)
246D2D1_POINT_2F = Alias("D2D1_POINT_2F", D2D_POINT_2F)
247D2D1_RECT_F = Alias("D2D1_RECT_F", D2D_RECT_F)
248D2D1_RECT_U = Alias("D2D1_RECT_U", D2D_RECT_U)
249D2D1_SIZE_F = Alias("D2D1_SIZE_F", D2D_SIZE_F)
250D2D1_SIZE_U = Alias("D2D1_SIZE_U", D2D_SIZE_U)
251D2D1_COLOR_F = Alias("D2D1_COLOR_F", D2D_COLOR_F)
252D2D1_MATRIX_3X2_F = Alias("D2D1_MATRIX_3X2_F", D2D_MATRIX_3X2_F)
253D2D1_TAG = Alias("D2D1_TAG", UINT64)
254D2D1_BITMAP_PROPERTIES = Struct("D2D1_BITMAP_PROPERTIES", [
255 (D2D1_PIXEL_FORMAT, "pixelFormat"),
256 (FLOAT, "dpiX"),
257 (FLOAT, "dpiY"),
258])
259
260D2D1_GRADIENT_STOP = Struct("D2D1_GRADIENT_STOP", [
261 (FLOAT, "position"),
262 (D2D1_COLOR_F, "color"),
263])
264
265D2D1_BRUSH_PROPERTIES = Struct("D2D1_BRUSH_PROPERTIES", [
266 (FLOAT, "opacity"),
267 (D2D1_MATRIX_3X2_F, "transform"),
268])
269
270D2D1_BITMAP_BRUSH_PROPERTIES = Struct("D2D1_BITMAP_BRUSH_PROPERTIES", [
271 (D2D1_EXTEND_MODE, "extendModeX"),
272 (D2D1_EXTEND_MODE, "extendModeY"),
273 (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"),
274])
275
276D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES", [
277 (D2D1_POINT_2F, "startPoint"),
278 (D2D1_POINT_2F, "endPoint"),
279])
280
281D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES", [
282 (D2D1_POINT_2F, "center"),
283 (D2D1_POINT_2F, "gradientOriginOffset"),
284 (FLOAT, "radiusX"),
285 (FLOAT, "radiusY"),
286])
287
288D2D1_ARC_SIZE = Enum("D2D1_ARC_SIZE", [
289 "D2D1_ARC_SIZE_SMALL",
290 "D2D1_ARC_SIZE_LARGE",
291])
292
293D2D1_CAP_STYLE = Enum("D2D1_CAP_STYLE", [
294 "D2D1_CAP_STYLE_FLAT",
295 "D2D1_CAP_STYLE_SQUARE",
296 "D2D1_CAP_STYLE_ROUND",
297 "D2D1_CAP_STYLE_TRIANGLE",
298])
299
300D2D1_DASH_STYLE = Enum("D2D1_DASH_STYLE", [
301 "D2D1_DASH_STYLE_SOLID",
302 "D2D1_DASH_STYLE_DASH",
303 "D2D1_DASH_STYLE_DOT",
304 "D2D1_DASH_STYLE_DASH_DOT",
305 "D2D1_DASH_STYLE_DASH_DOT_DOT",
306 "D2D1_DASH_STYLE_CUSTOM",
307])
308
309D2D1_LINE_JOIN = Enum("D2D1_LINE_JOIN", [
310 "D2D1_LINE_JOIN_MITER",
311 "D2D1_LINE_JOIN_BEVEL",
312 "D2D1_LINE_JOIN_ROUND",
313 "D2D1_LINE_JOIN_MITER_OR_BEVEL",
314])
315
316D2D1_COMBINE_MODE = Enum("D2D1_COMBINE_MODE", [
317 "D2D1_COMBINE_MODE_UNION",
318 "D2D1_COMBINE_MODE_INTERSECT",
319 "D2D1_COMBINE_MODE_XOR",
320 "D2D1_COMBINE_MODE_EXCLUDE",
321])
322
323D2D1_GEOMETRY_RELATION = Enum("D2D1_GEOMETRY_RELATION", [
324 "D2D1_GEOMETRY_RELATION_UNKNOWN",
325 "D2D1_GEOMETRY_RELATION_DISJOINT",
326 "D2D1_GEOMETRY_RELATION_IS_CONTAINED",
327 "D2D1_GEOMETRY_RELATION_CONTAINS",
328 "D2D1_GEOMETRY_RELATION_OVERLAP",
329])
330
331D2D1_GEOMETRY_SIMPLIFICATION_OPTION = Enum("D2D1_GEOMETRY_SIMPLIFICATION_OPTION", [
332 "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES",
333 "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES",
334])
335
336D2D1_FIGURE_BEGIN = Enum("D2D1_FIGURE_BEGIN", [
337 "D2D1_FIGURE_BEGIN_FILLED",
338 "D2D1_FIGURE_BEGIN_HOLLOW",
339])
340
341D2D1_FIGURE_END = Enum("D2D1_FIGURE_END", [
342 "D2D1_FIGURE_END_OPEN",
343 "D2D1_FIGURE_END_CLOSED",
344])
345
346D2D1_BEZIER_SEGMENT = Struct("D2D1_BEZIER_SEGMENT", [
347 (D2D1_POINT_2F, "point1"),
348 (D2D1_POINT_2F, "point2"),
349 (D2D1_POINT_2F, "point3"),
350])
351
352D2D1_TRIANGLE = Struct("D2D1_TRIANGLE", [
353 (D2D1_POINT_2F, "point1"),
354 (D2D1_POINT_2F, "point2"),
355 (D2D1_POINT_2F, "point3"),
356])
357
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100358D2D1_PATH_SEGMENT = EnumFlags("D2D1_PATH_SEGMENT", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100359 "D2D1_PATH_SEGMENT_NONE",
360 "D2D1_PATH_SEGMENT_FORCE_UNSTROKED",
361 "D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN",
362])
363
364D2D1_SWEEP_DIRECTION = Enum("D2D1_SWEEP_DIRECTION", [
365 "D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE",
366 "D2D1_SWEEP_DIRECTION_CLOCKWISE",
367])
368
369D2D1_FILL_MODE = Enum("D2D1_FILL_MODE", [
370 "D2D1_FILL_MODE_ALTERNATE",
371 "D2D1_FILL_MODE_WINDING",
372])
373
374D2D1_ARC_SEGMENT = Struct("D2D1_ARC_SEGMENT", [
375 (D2D1_POINT_2F, "point"),
376 (D2D1_SIZE_F, "size"),
377 (FLOAT, "rotationAngle"),
378 (D2D1_SWEEP_DIRECTION, "sweepDirection"),
379 (D2D1_ARC_SIZE, "arcSize"),
380])
381
382D2D1_QUADRATIC_BEZIER_SEGMENT = Struct("D2D1_QUADRATIC_BEZIER_SEGMENT", [
383 (D2D1_POINT_2F, "point1"),
384 (D2D1_POINT_2F, "point2"),
385])
386
387D2D1_ELLIPSE = Struct("D2D1_ELLIPSE", [
388 (D2D1_POINT_2F, "point"),
389 (FLOAT, "radiusX"),
390 (FLOAT, "radiusY"),
391])
392
393D2D1_ROUNDED_RECT = Struct("D2D1_ROUNDED_RECT", [
394 (D2D1_RECT_F, "rect"),
395 (FLOAT, "radiusX"),
396 (FLOAT, "radiusY"),
397])
398
399D2D1_STROKE_STYLE_PROPERTIES = Struct("D2D1_STROKE_STYLE_PROPERTIES", [
400 (D2D1_CAP_STYLE, "startCap"),
401 (D2D1_CAP_STYLE, "endCap"),
402 (D2D1_CAP_STYLE, "dashCap"),
403 (D2D1_LINE_JOIN, "lineJoin"),
404 (FLOAT, "miterLimit"),
405 (D2D1_DASH_STYLE, "dashStyle"),
406 (FLOAT, "dashOffset"),
407])
408
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100409D2D1_LAYER_OPTIONS = EnumFlags("D2D1_LAYER_OPTIONS", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100410 "D2D1_LAYER_OPTIONS_NONE",
411 "D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE",
412])
413
414D2D1_LAYER_PARAMETERS = Struct("D2D1_LAYER_PARAMETERS", [
415 (D2D1_RECT_F, "contentBounds"),
José Fonsecae7cb2b92012-09-28 08:40:24 +0100416 (ObjPointer(ID2D1Geometry), "geometricMask"),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100417 (D2D1_ANTIALIAS_MODE, "maskAntialiasMode"),
418 (D2D1_MATRIX_3X2_F, "maskTransform"),
419 (FLOAT, "opacity"),
José Fonsecae7cb2b92012-09-28 08:40:24 +0100420 (ObjPointer(ID2D1Brush), "opacityBrush"),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100421 (D2D1_LAYER_OPTIONS, "layerOptions"),
422])
423
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100424D2D1_WINDOW_STATE = EnumFlags("D2D1_WINDOW_STATE", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100425 "D2D1_WINDOW_STATE_NONE",
426 "D2D1_WINDOW_STATE_OCCLUDED",
427])
428
429D2D1_RENDER_TARGET_TYPE = Enum("D2D1_RENDER_TARGET_TYPE", [
430 "D2D1_RENDER_TARGET_TYPE_DEFAULT",
431 "D2D1_RENDER_TARGET_TYPE_SOFTWARE",
432 "D2D1_RENDER_TARGET_TYPE_HARDWARE",
433])
434
435D2D1_FEATURE_LEVEL = Enum("D2D1_FEATURE_LEVEL", [
436 "D2D1_FEATURE_LEVEL_DEFAULT",
437 "D2D1_FEATURE_LEVEL_9",
438 "D2D1_FEATURE_LEVEL_10",
439])
440
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100441D2D1_RENDER_TARGET_USAGE = EnumFlags("D2D1_RENDER_TARGET_USAGE", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100442 "D2D1_RENDER_TARGET_USAGE_NONE",
443 "D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING",
444 "D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE",
445])
446
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100447D2D1_PRESENT_OPTIONS = EnumFlags("D2D1_PRESENT_OPTIONS", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100448 "D2D1_PRESENT_OPTIONS_NONE",
449 "D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS",
450 "D2D1_PRESENT_OPTIONS_IMMEDIATELY",
451])
452
453D2D1_RENDER_TARGET_PROPERTIES = Struct("D2D1_RENDER_TARGET_PROPERTIES", [
454 (D2D1_RENDER_TARGET_TYPE, "type"),
455 (D2D1_PIXEL_FORMAT, "pixelFormat"),
456 (FLOAT, "dpiX"),
457 (FLOAT, "dpiY"),
458 (D2D1_RENDER_TARGET_USAGE, "usage"),
459 (D2D1_FEATURE_LEVEL, "minLevel"),
460])
461
462D2D1_HWND_RENDER_TARGET_PROPERTIES = Struct("D2D1_HWND_RENDER_TARGET_PROPERTIES", [
463 (HWND, "hwnd"),
464 (D2D1_SIZE_U, "pixelSize"),
465 (D2D1_PRESENT_OPTIONS, "presentOptions"),
466])
467
Jose Fonseca8a4c9af2016-05-18 16:25:35 +0100468D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS = EnumFlags("D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS", [
José Fonseca31f2b6e2011-10-10 01:45:04 +0100469 "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE",
470 "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE",
471])
472
473D2D1_DRAWING_STATE_DESCRIPTION = Struct("D2D1_DRAWING_STATE_DESCRIPTION", [
474 (D2D1_ANTIALIAS_MODE, "antialiasMode"),
475 (D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode"),
476 (D2D1_TAG, "tag1"),
477 (D2D1_TAG, "tag2"),
478 (D2D1_MATRIX_3X2_F, "transform"),
479])
480
481D2D1_DC_INITIALIZE_MODE = Enum("D2D1_DC_INITIALIZE_MODE", [
482 "D2D1_DC_INITIALIZE_MODE_COPY",
483 "D2D1_DC_INITIALIZE_MODE_CLEAR",
484])
485
486D2D1_DEBUG_LEVEL = Enum("D2D1_DEBUG_LEVEL", [
487 "D2D1_DEBUG_LEVEL_NONE",
488 "D2D1_DEBUG_LEVEL_ERROR",
489 "D2D1_DEBUG_LEVEL_WARNING",
490 "D2D1_DEBUG_LEVEL_INFORMATION",
491])
492
493D2D1_FACTORY_TYPE = Enum("D2D1_FACTORY_TYPE", [
494 "D2D1_FACTORY_TYPE_SINGLE_THREADED",
495 "D2D1_FACTORY_TYPE_MULTI_THREADED",
496])
497
498D2D1_FACTORY_OPTIONS = Struct("D2D1_FACTORY_OPTIONS", [
499 (D2D1_DEBUG_LEVEL, "debugLevel"),
500])
501
502ID2D1Resource.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000503 StdMethod(Void, "GetFactory", [Out(Pointer(ObjPointer(ID2D1Factory)), "factory")], const=True),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100504]
505
506ID2D1Bitmap.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100507 StdMethod(D2D1_SIZE_F, "GetSize", [], const=True, sideeffects=False),
508 StdMethod(D2D1_SIZE_U, "GetPixelSize", [], const=True, sideeffects=False),
509 StdMethod(D2D1_PIXEL_FORMAT, "GetPixelFormat", [], const=True, sideeffects=False),
510 StdMethod(Void, "GetDpi", [Out(Pointer(FLOAT), "dpiX"), Out(Pointer(FLOAT), "dpiY")], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000511 StdMethod(HRESULT, "CopyFromBitmap", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
512 StdMethod(HRESULT, "CopyFromRenderTarget", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (ObjPointer(ID2D1RenderTarget), "renderTarget"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
513 StdMethod(HRESULT, "CopyFromMemory", [(Pointer(Const(D2D1_RECT_U)), "dstRect"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100514]
515
516ID2D1GradientStopCollection.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100517 StdMethod(UINT32, "GetGradientStopCount", [], const=True, sideeffects=False),
518 StdMethod(Void, "GetGradientStops", [Out(Pointer(D2D1_GRADIENT_STOP), "gradientStops"), (UINT, "gradientStopsCount")], const=True, sideeffects=False),
519 StdMethod(D2D1_GAMMA, "GetColorInterpolationGamma", [], const=True, sideeffects=False),
520 StdMethod(D2D1_EXTEND_MODE, "GetExtendMode", [], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100521]
522
523ID2D1Brush.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000524 StdMethod(Void, "SetOpacity", [(FLOAT, "opacity")]),
525 StdMethod(Void, "SetTransform", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100526 StdMethod(FLOAT, "GetOpacity", [], const=True, sideeffects=False),
527 StdMethod(Void, "GetTransform", [Out(Pointer(D2D1_MATRIX_3X2_F), "transform")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100528]
529
530ID2D1BitmapBrush.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000531 StdMethod(Void, "SetExtendModeX", [(D2D1_EXTEND_MODE, "extendModeX")]),
532 StdMethod(Void, "SetExtendModeY", [(D2D1_EXTEND_MODE, "extendModeY")]),
533 StdMethod(Void, "SetInterpolationMode", [(D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode")]),
534 StdMethod(Void, "SetBitmap", [(ObjPointer(ID2D1Bitmap), "bitmap")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100535 StdMethod(D2D1_EXTEND_MODE, "GetExtendModeX", [], const=True, sideeffects=False),
536 StdMethod(D2D1_EXTEND_MODE, "GetExtendModeY", [], const=True, sideeffects=False),
537 StdMethod(D2D1_BITMAP_INTERPOLATION_MODE, "GetInterpolationMode", [], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000538 StdMethod(Void, "GetBitmap", [Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")], const=True),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100539]
540
541ID2D1SolidColorBrush.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000542 StdMethod(Void, "SetColor", [(Pointer(Const(D2D1_COLOR_F)), "color")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100543 StdMethod(D2D1_COLOR_F, "GetColor", [], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100544]
545
546ID2D1LinearGradientBrush.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000547 StdMethod(Void, "SetStartPoint", [(D2D1_POINT_2F, "startPoint")]),
548 StdMethod(Void, "SetEndPoint", [(D2D1_POINT_2F, "endPoint")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100549 StdMethod(D2D1_POINT_2F, "GetStartPoint", [], const=True, sideeffects=False),
550 StdMethod(D2D1_POINT_2F, "GetEndPoint", [], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000551 StdMethod(Void, "GetGradientStopCollection", [Out(Pointer(ObjPointer(ID2D1GradientStopCollection)), "gradientStopCollection")], const=True),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100552]
553
554ID2D1RadialGradientBrush.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000555 StdMethod(Void, "SetCenter", [(D2D1_POINT_2F, "center")]),
556 StdMethod(Void, "SetGradientOriginOffset", [(D2D1_POINT_2F, "gradientOriginOffset")]),
557 StdMethod(Void, "SetRadiusX", [(FLOAT, "radiusX")]),
558 StdMethod(Void, "SetRadiusY", [(FLOAT, "radiusY")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100559 StdMethod(D2D1_POINT_2F, "GetCenter", [], const=True, sideeffects=False),
560 StdMethod(D2D1_POINT_2F, "GetGradientOriginOffset", [], const=True, sideeffects=False),
561 StdMethod(FLOAT, "GetRadiusX", [], const=True, sideeffects=False),
562 StdMethod(FLOAT, "GetRadiusY", [], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000563 StdMethod(Void, "GetGradientStopCollection", [Out(Pointer(ObjPointer(ID2D1GradientStopCollection)), "gradientStopCollection")], const=True),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100564]
565
566ID2D1StrokeStyle.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100567 StdMethod(D2D1_CAP_STYLE, "GetStartCap", [], const=True, sideeffects=False),
568 StdMethod(D2D1_CAP_STYLE, "GetEndCap", [], const=True, sideeffects=False),
569 StdMethod(D2D1_CAP_STYLE, "GetDashCap", [], const=True, sideeffects=False),
570 StdMethod(FLOAT, "GetMiterLimit", [], const=True, sideeffects=False),
571 StdMethod(D2D1_LINE_JOIN, "GetLineJoin", [], const=True, sideeffects=False),
572 StdMethod(FLOAT, "GetDashOffset", [], const=True, sideeffects=False),
573 StdMethod(D2D1_DASH_STYLE, "GetDashStyle", [], const=True, sideeffects=False),
574 StdMethod(UINT32, "GetDashesCount", [], const=True, sideeffects=False),
575 StdMethod(Void, "GetDashes", [Out(Array(FLOAT, "dashesCount"), "dashes"), (UINT, "dashesCount")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100576]
577
578ID2D1Geometry.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100579 StdMethod(HRESULT, "GetBounds", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), Out(Pointer(D2D1_RECT_F), "bounds")], const=True, sideeffects=False),
580 StdMethod(HRESULT, "GetWidenedBounds", [(FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_RECT_F), "bounds")], const=True, sideeffects=False),
581 StdMethod(HRESULT, "StrokeContainsPoint", [(D2D1_POINT_2F, "point"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(BOOL), "contains")], const=True, sideeffects=False),
582 StdMethod(HRESULT, "FillContainsPoint", [(D2D1_POINT_2F, "point"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(BOOL), "contains")], const=True, sideeffects=False),
583 StdMethod(HRESULT, "CompareWithGeometry", [(ObjPointer(ID2D1Geometry), "inputGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_GEOMETRY_RELATION), "relation")], const=True, sideeffects=False),
584 StdMethod(HRESULT, "Simplify", [(D2D1_GEOMETRY_SIMPLIFICATION_OPTION, "simplificationOption"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True, sideeffects=False),
585 StdMethod(HRESULT, "Tessellate", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1TessellationSink), "tessellationSink")], const=True, sideeffects=False),
586 StdMethod(HRESULT, "CombineWithGeometry", [(ObjPointer(ID2D1Geometry), "inputGeometry"), (D2D1_COMBINE_MODE, "combineMode"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True, sideeffects=False),
587 StdMethod(HRESULT, "Outline", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True, sideeffects=False),
588 StdMethod(HRESULT, "ComputeArea", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(FLOAT), "area")], const=True, sideeffects=False),
589 StdMethod(HRESULT, "ComputeLength", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(FLOAT), "length")], const=True, sideeffects=False),
590 StdMethod(HRESULT, "ComputePointAtLength", [(FLOAT, "length"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_POINT_2F), "point"), Out(Pointer(D2D1_POINT_2F), "unitTangentVector")], const=True, sideeffects=False),
591 StdMethod(HRESULT, "Widen", [(FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100592]
593
594ID2D1RectangleGeometry.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100595 StdMethod(Void, "GetRect", [Out(Pointer(D2D1_RECT_F), "rect")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100596]
597
598ID2D1RoundedRectangleGeometry.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100599 StdMethod(Void, "GetRoundedRect", [Out(Pointer(D2D1_ROUNDED_RECT), "roundedRect")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100600]
601
602ID2D1EllipseGeometry.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100603 StdMethod(Void, "GetEllipse", [Out(Pointer(D2D1_ELLIPSE), "ellipse")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100604]
605
606ID2D1GeometryGroup.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100607 StdMethod(D2D1_FILL_MODE, "GetFillMode", [], const=True, sideeffects=False),
608 StdMethod(UINT32, "GetSourceGeometryCount", [], const=True, sideeffects=False),
609 StdMethod(Void, "GetSourceGeometries", [Out(Array(ObjPointer(ID2D1Geometry), "geometriesCount"), "geometries"), (UINT, "geometriesCount")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100610]
611
612ID2D1TransformedGeometry.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000613 StdMethod(Void, "GetSourceGeometry", [Out(Pointer(ObjPointer(ID2D1Geometry)), "sourceGeometry")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100614 StdMethod(Void, "GetTransform", [Out(Pointer(D2D1_MATRIX_3X2_F), "transform")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100615]
616
617ID2D1SimplifiedGeometrySink.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000618 StdMethod(Void, "SetFillMode", [(D2D1_FILL_MODE, "fillMode")]),
619 StdMethod(Void, "SetSegmentFlags", [(D2D1_PATH_SEGMENT, "vertexFlags")]),
620 StdMethod(Void, "BeginFigure", [(D2D1_POINT_2F, "startPoint"), (D2D1_FIGURE_BEGIN, "figureBegin")]),
621 StdMethod(Void, "AddLines", [(Array(Const(D2D1_POINT_2F), "pointsCount"), "points"), (UINT, "pointsCount")]),
622 StdMethod(Void, "AddBeziers", [(Array(Const(D2D1_BEZIER_SEGMENT), "beziersCount"), "beziers"), (UINT, "beziersCount")]),
623 StdMethod(Void, "EndFigure", [(D2D1_FIGURE_END, "figureEnd")]),
624 StdMethod(HRESULT, "Close", []),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100625]
626
627ID2D1GeometrySink.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000628 StdMethod(Void, "AddLine", [(D2D1_POINT_2F, "point")]),
629 StdMethod(Void, "AddBezier", [(Pointer(Const(D2D1_BEZIER_SEGMENT)), "bezier")]),
630 StdMethod(Void, "AddQuadraticBezier", [(Pointer(Const(D2D1_QUADRATIC_BEZIER_SEGMENT)), "bezier")]),
631 StdMethod(Void, "AddQuadraticBeziers", [(Array(Const(D2D1_QUADRATIC_BEZIER_SEGMENT), "beziersCount"), "beziers"), (UINT, "beziersCount")]),
632 StdMethod(Void, "AddArc", [(Pointer(Const(D2D1_ARC_SEGMENT)), "arc")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100633]
634
635ID2D1TessellationSink.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000636 StdMethod(Void, "AddTriangles", [(Array(Const(D2D1_TRIANGLE), "trianglesCount"), "triangles"), (UINT, "trianglesCount")]),
637 StdMethod(HRESULT, "Close", []),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100638]
639
640ID2D1PathGeometry.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000641 StdMethod(HRESULT, "Open", [Out(Pointer(ObjPointer(ID2D1GeometrySink)), "geometrySink")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100642 StdMethod(HRESULT, "Stream", [(ObjPointer(ID2D1GeometrySink), "geometrySink")], const=True, sideeffects=False),
643 StdMethod(HRESULT, "GetSegmentCount", [Out(Pointer(UINT32), "count")], const=True, sideeffects=False),
644 StdMethod(HRESULT, "GetFigureCount", [Out(Pointer(UINT32), "count")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100645]
646
647ID2D1Mesh.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000648 StdMethod(HRESULT, "Open", [Out(Pointer(ObjPointer(ID2D1TessellationSink)), "tessellationSink")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100649]
650
651ID2D1Layer.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100652 StdMethod(D2D1_SIZE_F, "GetSize", [], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100653]
654
655ID2D1DrawingStateBlock.methods += [
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100656 StdMethod(Void, "GetDescription", [Out(Pointer(D2D1_DRAWING_STATE_DESCRIPTION), "stateDescription")], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000657 StdMethod(Void, "SetDescription", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "stateDescription")]),
658 StdMethod(Void, "SetTextRenderingParams", [(ObjPointer(IDWriteRenderingParams), "textRenderingParams")]),
659 StdMethod(Void, "GetTextRenderingParams", [Out(Pointer(ObjPointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100660]
661
662ID2D1RenderTarget.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000663 StdMethod(HRESULT, "CreateBitmap", [(D2D1_SIZE_U, "size"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")]),
664 StdMethod(HRESULT, "CreateBitmapFromWicBitmap", [(Opaque("IWICBitmapSource *"), "wicBitmapSource"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")]),
665 StdMethod(HRESULT, "CreateSharedBitmap", [(REFIID, "riid"), Out(OpaquePointer(Void), "data"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")]),
666 StdMethod(HRESULT, "CreateBitmapBrush", [(ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_BITMAP_BRUSH_PROPERTIES)), "bitmapBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(ObjPointer(ID2D1BitmapBrush)), "bitmapBrush")]),
667 StdMethod(HRESULT, "CreateSolidColorBrush", [(Pointer(Const(D2D1_COLOR_F)), "color"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(ObjPointer(ID2D1SolidColorBrush)), "solidColorBrush")]),
668 StdMethod(HRESULT, "CreateGradientStopCollection", [(Array(Const(D2D1_GRADIENT_STOP), "gradientStopsCount"), "gradientStops"), (UINT, "gradientStopsCount"), (D2D1_GAMMA, "colorInterpolationGamma"), (D2D1_EXTEND_MODE, "extendMode"), Out(Pointer(ObjPointer(ID2D1GradientStopCollection)), "gradientStopCollection")]),
669 StdMethod(HRESULT, "CreateLinearGradientBrush", [(Pointer(Const(D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)), "linearGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (ObjPointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(ObjPointer(ID2D1LinearGradientBrush)), "linearGradientBrush")]),
670 StdMethod(HRESULT, "CreateRadialGradientBrush", [(Pointer(Const(D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES)), "radialGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (ObjPointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(ObjPointer(ID2D1RadialGradientBrush)), "radialGradientBrush")]),
671 StdMethod(HRESULT, "CreateCompatibleRenderTarget", [(Pointer(Const(D2D1_SIZE_F)), "desiredSize"), (Pointer(Const(D2D1_SIZE_U)), "desiredPixelSize"), (Pointer(Const(D2D1_PIXEL_FORMAT)), "desiredFormat"), (D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS, "options"), Out(Pointer(ObjPointer(ID2D1BitmapRenderTarget)), "bitmapRenderTarget")]),
672 StdMethod(HRESULT, "CreateLayer", [(Pointer(Const(D2D1_SIZE_F)), "size"), Out(Pointer(ObjPointer(ID2D1Layer)), "layer")]),
673 StdMethod(HRESULT, "CreateMesh", [Out(Pointer(ObjPointer(ID2D1Mesh)), "mesh")]),
674 StdMethod(Void, "DrawLine", [(D2D1_POINT_2F, "point0"), (D2D1_POINT_2F, "point1"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
675 StdMethod(Void, "DrawRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
676 StdMethod(Void, "FillRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (ObjPointer(ID2D1Brush), "brush")]),
677 StdMethod(Void, "DrawRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
678 StdMethod(Void, "FillRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (ObjPointer(ID2D1Brush), "brush")]),
679 StdMethod(Void, "DrawEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
680 StdMethod(Void, "FillEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (ObjPointer(ID2D1Brush), "brush")]),
681 StdMethod(Void, "DrawGeometry", [(ObjPointer(ID2D1Geometry), "geometry"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
682 StdMethod(Void, "FillGeometry", [(ObjPointer(ID2D1Geometry), "geometry"), (ObjPointer(ID2D1Brush), "brush"), (ObjPointer(ID2D1Brush), "opacityBrush")]),
683 StdMethod(Void, "FillMesh", [(ObjPointer(ID2D1Mesh), "mesh"), (ObjPointer(ID2D1Brush), "brush")]),
684 StdMethod(Void, "FillOpacityMask", [(ObjPointer(ID2D1Bitmap), "opacityMask"), (ObjPointer(ID2D1Brush), "brush"), (D2D1_OPACITY_MASK_CONTENT, "content"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
685 StdMethod(Void, "DrawBitmap", [(ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (FLOAT, "opacity"), (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
José Fonseca7417f642015-01-26 16:01:36 +0000686 StdMethod(Void, "DrawText", [(String(Const(WCHAR), "stringLength", wide=True), "string"), (UINT, "stringLength"), (ObjPointer(IDWriteTextFormat), "textFormat"), (Pointer(Const(D2D1_RECT_F)), "layoutRect"), (ObjPointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options"), (DWRITE_MEASURING_MODE, "measuringMode")]),
José Fonseca43aa19f2012-11-10 09:29:38 +0000687 StdMethod(Void, "DrawTextLayout", [(D2D1_POINT_2F, "origin"), (ObjPointer(IDWriteTextLayout), "textLayout"), (ObjPointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options")]),
688 StdMethod(Void, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (ObjPointer(ID2D1Brush), "foregroundBrush"), (DWRITE_MEASURING_MODE, "measuringMode")]),
689 StdMethod(Void, "SetTransform", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100690 StdMethod(Void, "GetTransform", [Out(Pointer(D2D1_MATRIX_3X2_F), "transform")], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000691 StdMethod(Void, "SetAntialiasMode", [(D2D1_ANTIALIAS_MODE, "antialiasMode")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100692 StdMethod(D2D1_ANTIALIAS_MODE, "GetAntialiasMode", [], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000693 StdMethod(Void, "SetTextAntialiasMode", [(D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100694 StdMethod(D2D1_TEXT_ANTIALIAS_MODE, "GetTextAntialiasMode", [], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000695 StdMethod(Void, "SetTextRenderingParams", [(ObjPointer(IDWriteRenderingParams), "textRenderingParams")]),
696 StdMethod(Void, "GetTextRenderingParams", [Out(Pointer(ObjPointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
697 StdMethod(Void, "SetTags", [(D2D1_TAG, "tag1"), (D2D1_TAG, "tag2")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100698 StdMethod(Void, "GetTags", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000699 StdMethod(Void, "PushLayer", [(Pointer(Const(D2D1_LAYER_PARAMETERS)), "layerParameters"), (ObjPointer(ID2D1Layer), "layer")]),
700 StdMethod(Void, "PopLayer", []),
701 StdMethod(HRESULT, "Flush", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100702 StdMethod(Void, "SaveDrawingState", [(ObjPointer(ID2D1DrawingStateBlock), "drawingStateBlock")], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000703 StdMethod(Void, "RestoreDrawingState", [(ObjPointer(ID2D1DrawingStateBlock), "drawingStateBlock")]),
704 StdMethod(Void, "PushAxisAlignedClip", [(Pointer(Const(D2D1_RECT_F)), "clipRect"), (D2D1_ANTIALIAS_MODE, "antialiasMode")]),
705 StdMethod(Void, "PopAxisAlignedClip", []),
706 StdMethod(Void, "Clear", [(Pointer(Const(D2D1_COLOR_F)), "clearColor")]),
707 StdMethod(Void, "BeginDraw", []),
708 StdMethod(HRESULT, "EndDraw", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100709 StdMethod(D2D1_PIXEL_FORMAT, "GetPixelFormat", [], const=True, sideeffects=False),
José Fonseca43aa19f2012-11-10 09:29:38 +0000710 StdMethod(Void, "SetDpi", [(FLOAT, "dpiX"), (FLOAT, "dpiY")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100711 StdMethod(Void, "GetDpi", [Out(Pointer(FLOAT), "dpiX"), Out(Pointer(FLOAT), "dpiY")], const=True, sideeffects=False),
712 StdMethod(D2D1_SIZE_F, "GetSize", [], const=True, sideeffects=False),
713 StdMethod(D2D1_SIZE_U, "GetPixelSize", [], const=True, sideeffects=False),
714 StdMethod(UINT32, "GetMaximumBitmapSize", [], const=True, sideeffects=False),
715 StdMethod(BOOL, "IsSupported", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties")], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100716]
717
718ID2D1BitmapRenderTarget.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000719 StdMethod(HRESULT, "GetBitmap", [Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100720]
721
722ID2D1HwndRenderTarget.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000723 StdMethod(D2D1_WINDOW_STATE, "CheckWindowState", []),
724 StdMethod(HRESULT, "Resize", [(Pointer(Const(D2D1_SIZE_U)), "pixelSize")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100725 StdMethod(HWND, "GetHwnd", [], const=True, sideeffects=False),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100726]
727
728ID2D1GdiInteropRenderTarget.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000729 StdMethod(HRESULT, "GetDC", [(D2D1_DC_INITIALIZE_MODE, "mode"), Out(Pointer(HDC), "hdc")]),
730 StdMethod(HRESULT, "ReleaseDC", [(Pointer(Const(RECT)), "update")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100731]
732
733ID2D1DCRenderTarget.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000734 StdMethod(HRESULT, "BindDC", [(Const(HDC), "hDC"), (Pointer(Const(RECT)), "pSubRect")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100735]
736
737ID2D1Factory.methods += [
José Fonseca43aa19f2012-11-10 09:29:38 +0000738 StdMethod(HRESULT, "ReloadSystemMetrics", []),
739 StdMethod(Void, "GetDesktopDpi", [Out(Pointer(FLOAT), "dpiX"), Out(Pointer(FLOAT), "dpiY")]),
740 StdMethod(HRESULT, "CreateRectangleGeometry", [(Pointer(Const(D2D1_RECT_F)), "rectangle"), Out(Pointer(ObjPointer(ID2D1RectangleGeometry)), "rectangleGeometry")]),
741 StdMethod(HRESULT, "CreateRoundedRectangleGeometry", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRectangle"), Out(Pointer(ObjPointer(ID2D1RoundedRectangleGeometry)), "roundedRectangleGeometry")]),
742 StdMethod(HRESULT, "CreateEllipseGeometry", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), Out(Pointer(ObjPointer(ID2D1EllipseGeometry)), "ellipseGeometry")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100743 StdMethod(HRESULT, "CreateGeometryGroup", [(D2D1_FILL_MODE, "fillMode"), (Array(ObjPointer(ID2D1Geometry), "geometriesCount"), "geometries"), (UINT, "geometriesCount"), Out(Pointer(ObjPointer(ID2D1GeometryGroup)), "geometryGroup")]),
José Fonseca43aa19f2012-11-10 09:29:38 +0000744 StdMethod(HRESULT, "CreateTransformedGeometry", [(ObjPointer(ID2D1Geometry), "sourceGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "transform"), Out(Pointer(ObjPointer(ID2D1TransformedGeometry)), "transformedGeometry")]),
745 StdMethod(HRESULT, "CreatePathGeometry", [Out(Pointer(ObjPointer(ID2D1PathGeometry)), "pathGeometry")]),
746 StdMethod(HRESULT, "CreateStrokeStyle", [(Pointer(Const(D2D1_STROKE_STYLE_PROPERTIES)), "strokeStyleProperties"), (Pointer(Const(FLOAT)), "dashes"), (UINT, "dashesCount"), Out(Pointer(ObjPointer(ID2D1StrokeStyle)), "strokeStyle")]),
747 StdMethod(HRESULT, "CreateDrawingStateBlock", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "drawingStateDescription"), (ObjPointer(IDWriteRenderingParams), "textRenderingParams"), Out(Pointer(ObjPointer(ID2D1DrawingStateBlock)), "drawingStateBlock")]),
748 StdMethod(HRESULT, "CreateWicBitmapRenderTarget", [(Opaque("IWICBitmap *"), "target"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(ObjPointer(ID2D1RenderTarget)), "renderTarget")]),
749 StdMethod(HRESULT, "CreateHwndRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), (Pointer(Const(D2D1_HWND_RENDER_TARGET_PROPERTIES)), "hwndRenderTargetProperties"), Out(Pointer(ObjPointer(ID2D1HwndRenderTarget)), "hwndRenderTarget")]),
750 StdMethod(HRESULT, "CreateDxgiSurfaceRenderTarget", [(ObjPointer(IDXGISurface), "dxgiSurface"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(ObjPointer(ID2D1RenderTarget)), "renderTarget")]),
751 StdMethod(HRESULT, "CreateDCRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(ObjPointer(ID2D1DCRenderTarget)), "dcRenderTarget")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100752]
753
José Fonseca81301932012-11-11 00:10:20 +0000754d2d1 = Module("d2d1")
755d2d1.addInterfaces([
756 ID2D1Factory
757])
José Fonseca48412ff2012-01-21 00:06:19 +0000758d2d1.addFunctions([
José Fonsecae7d7a642012-11-11 00:17:00 +0000759 StdFunction(HRESULT, "D2D1CreateFactory", [(D2D1_FACTORY_TYPE, "factoryType"), (REFIID, "riid"), (Pointer(Const(D2D1_FACTORY_OPTIONS)), "pFactoryOptions"), Out(Pointer(ObjPointer(Void)), "ppIFactory")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100760 StdFunction(Void, "D2D1MakeRotateMatrix", [(FLOAT, "angle"), (D2D1_POINT_2F, "center"), Out(Pointer(D2D1_MATRIX_3X2_F), "matrix")]),
761 StdFunction(Void, "D2D1MakeSkewMatrix", [(FLOAT, "angleX"), (FLOAT, "angleY"), (D2D1_POINT_2F, "center"), Out(Pointer(D2D1_MATRIX_3X2_F), "matrix")]),
762 StdFunction(BOOL, "D2D1IsMatrixInvertible", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "matrix")]),
José Fonseca5d7fc052012-11-13 19:53:47 +0000763 StdFunction(BOOL, "D2D1InvertMatrix", [InOut(Pointer(D2D1_MATRIX_3X2_F), "matrix")]),
José Fonseca31f2b6e2011-10-10 01:45:04 +0100764])
Jose Fonsecaf7a71302015-08-13 16:10:06 +0100765
766
767
768#
769# D2D1.1
770#
771
772
773ID2D1GdiMetafileSink = Interface("ID2D1GdiMetafileSink", IUnknown)
774ID2D1GdiMetafile = Interface("ID2D1GdiMetafile", ID2D1Resource)
775ID2D1CommandSink = Interface("ID2D1CommandSink", IUnknown)
776ID2D1CommandList = Interface("ID2D1CommandList", ID2D1Image)
777ID2D1PrintControl = Interface("ID2D1PrintControl", IUnknown)
778ID2D1ImageBrush = Interface("ID2D1ImageBrush", ID2D1Brush)
779ID2D1BitmapBrush1 = Interface("ID2D1BitmapBrush1", ID2D1BitmapBrush)
780ID2D1StrokeStyle1 = Interface("ID2D1StrokeStyle1", ID2D1StrokeStyle)
781ID2D1PathGeometry1 = Interface("ID2D1PathGeometry1", ID2D1PathGeometry)
782ID2D1Properties = Interface("ID2D1Properties", IUnknown)
783ID2D1Effect = Interface("ID2D1Effect", ID2D1Properties)
784ID2D1Bitmap1 = Interface("ID2D1Bitmap1", ID2D1Bitmap)
785ID2D1ColorContext = Interface("ID2D1ColorContext", ID2D1Resource)
786ID2D1GradientStopCollection1 = Interface("ID2D1GradientStopCollection1", ID2D1GradientStopCollection)
787ID2D1DrawingStateBlock1 = Interface("ID2D1DrawingStateBlock1", ID2D1DrawingStateBlock)
788ID2D1DeviceContext = Interface("ID2D1DeviceContext", ID2D1RenderTarget)
789ID2D1Device = Interface("ID2D1Device", ID2D1Resource)
790ID2D1Factory1 = Interface("ID2D1Factory1", ID2D1Factory)
791ID2D1Multithread = Interface("ID2D1Multithread", IUnknown)
792
793
794D2D1_RECT_L = Alias("D2D1_RECT_L", D2D_RECT_L)
795D2D1_POINT_2L = Alias("D2D1_POINT_2L", D2D_POINT_2L)
796
797
798D2D1_PROPERTY_INDEX = FakeEnum(UINT32, [
799 "D2D1_INVALID_PROPERTY_INDEX",
800])
801
802D2D1_PROPERTY_TYPE = Enum("D2D1_PROPERTY_TYPE", [
803 "D2D1_PROPERTY_TYPE_UNKNOWN",
804 "D2D1_PROPERTY_TYPE_STRING",
805 "D2D1_PROPERTY_TYPE_BOOL",
806 "D2D1_PROPERTY_TYPE_UINT32",
807 "D2D1_PROPERTY_TYPE_INT32",
808 "D2D1_PROPERTY_TYPE_FLOAT",
809 "D2D1_PROPERTY_TYPE_VECTOR2",
810 "D2D1_PROPERTY_TYPE_VECTOR3",
811 "D2D1_PROPERTY_TYPE_VECTOR4",
812 "D2D1_PROPERTY_TYPE_BLOB",
813 "D2D1_PROPERTY_TYPE_IUNKNOWN",
814 "D2D1_PROPERTY_TYPE_ENUM",
815 "D2D1_PROPERTY_TYPE_ARRAY",
816 "D2D1_PROPERTY_TYPE_CLSID",
817 "D2D1_PROPERTY_TYPE_MATRIX_3X2",
818 "D2D1_PROPERTY_TYPE_MATRIX_4X3",
819 "D2D1_PROPERTY_TYPE_MATRIX_4X4",
820 "D2D1_PROPERTY_TYPE_MATRIX_5X4",
821 "D2D1_PROPERTY_TYPE_COLOR_CONTEXT",
822 "D2D1_PROPERTY_TYPE_FORCE_DWORD",
823])
824
825D2D1_PROPERTY = Enum("D2D1_PROPERTY", [
826 "D2D1_PROPERTY_CLSID",
827 "D2D1_PROPERTY_DISPLAYNAME",
828 "D2D1_PROPERTY_AUTHOR",
829 "D2D1_PROPERTY_CATEGORY",
830 "D2D1_PROPERTY_DESCRIPTION",
831 "D2D1_PROPERTY_INPUTS",
832 "D2D1_PROPERTY_CACHED",
833 "D2D1_PROPERTY_PRECISION",
834 "D2D1_PROPERTY_MIN_INPUTS",
835 "D2D1_PROPERTY_MAX_INPUTS",
836 "D2D1_PROPERTY_FORCE_DWORD",
837])
838
839D2D1_SUBPROPERTY = Enum("D2D1_SUBPROPERTY", [
840 "D2D1_SUBPROPERTY_DISPLAYNAME",
841 "D2D1_SUBPROPERTY_ISREADONLY",
842 "D2D1_SUBPROPERTY_MIN",
843 "D2D1_SUBPROPERTY_MAX",
844 "D2D1_SUBPROPERTY_DEFAULT",
845 "D2D1_SUBPROPERTY_FIELDS",
846 "D2D1_SUBPROPERTY_INDEX",
847 "D2D1_SUBPROPERTY_FORCE_DWORD",
848])
849
850D2D1_BITMAP_OPTIONS = Enum("D2D1_BITMAP_OPTIONS", [
851 "D2D1_BITMAP_OPTIONS_NONE",
852 "D2D1_BITMAP_OPTIONS_TARGET",
853 "D2D1_BITMAP_OPTIONS_CANNOT_DRAW",
854 "D2D1_BITMAP_OPTIONS_CPU_READ",
855 "D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE",
856 "D2D1_BITMAP_OPTIONS_FORCE_DWORD",
857])
858
859D2D1_COMPOSITE_MODE = Enum("D2D1_COMPOSITE_MODE", [
860 "D2D1_COMPOSITE_MODE_SOURCE_OVER",
861 "D2D1_COMPOSITE_MODE_DESTINATION_OVER",
862 "D2D1_COMPOSITE_MODE_SOURCE_IN",
863 "D2D1_COMPOSITE_MODE_DESTINATION_IN",
864 "D2D1_COMPOSITE_MODE_SOURCE_OUT",
865 "D2D1_COMPOSITE_MODE_DESTINATION_OUT",
866 "D2D1_COMPOSITE_MODE_SOURCE_ATOP",
867 "D2D1_COMPOSITE_MODE_DESTINATION_ATOP",
868 "D2D1_COMPOSITE_MODE_XOR",
869 "D2D1_COMPOSITE_MODE_PLUS",
870 "D2D1_COMPOSITE_MODE_SOURCE_COPY",
871 "D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY",
872 "D2D1_COMPOSITE_MODE_MASK_INVERT",
873 "D2D1_COMPOSITE_MODE_FORCE_DWORD",
874])
875
876D2D1_BUFFER_PRECISION = Enum("D2D1_BUFFER_PRECISION", [
877 "D2D1_BUFFER_PRECISION_UNKNOWN",
878 "D2D1_BUFFER_PRECISION_8BPC_UNORM",
879 "D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB",
880 "D2D1_BUFFER_PRECISION_16BPC_UNORM",
881 "D2D1_BUFFER_PRECISION_16BPC_FLOAT",
882 "D2D1_BUFFER_PRECISION_32BPC_FLOAT",
883 "D2D1_BUFFER_PRECISION_FORCE_DWORD",
884])
885
886D2D1_MAP_OPTIONS = Enum("D2D1_MAP_OPTIONS", [
887 "D2D1_MAP_OPTIONS_NONE",
888 "D2D1_MAP_OPTIONS_READ",
889 "D2D1_MAP_OPTIONS_WRITE",
890 "D2D1_MAP_OPTIONS_DISCARD",
891 "D2D1_MAP_OPTIONS_FORCE_DWORD",
892])
893
894D2D1_INTERPOLATION_MODE = Enum("D2D1_INTERPOLATION_MODE", [
895 "D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR",
896 "D2D1_INTERPOLATION_MODE_LINEAR",
897 "D2D1_INTERPOLATION_MODE_CUBIC",
898 "D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR",
899 "D2D1_INTERPOLATION_MODE_ANISOTROPIC",
900 "D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC",
901 "D2D1_INTERPOLATION_MODE_FORCE_DWORD",
902])
903
904D2D1_UNIT_MODE = Enum("D2D1_UNIT_MODE", [
905 "D2D1_UNIT_MODE_DIPS",
906 "D2D1_UNIT_MODE_PIXELS",
907 "D2D1_UNIT_MODE_FORCE_DWORD",
908])
909
910D2D1_COLOR_SPACE = Enum("D2D1_COLOR_SPACE", [
911 "D2D1_COLOR_SPACE_CUSTOM",
912 "D2D1_COLOR_SPACE_SRGB",
913 "D2D1_COLOR_SPACE_SCRGB",
914 "D2D1_COLOR_SPACE_FORCE_DWORD",
915])
916
917D2D1_DEVICE_CONTEXT_OPTIONS = Enum("D2D1_DEVICE_CONTEXT_OPTIONS", [
918 "D2D1_DEVICE_CONTEXT_OPTIONS_NONE",
919 "D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS",
920 "D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD",
921])
922
923D2D1_STROKE_TRANSFORM_TYPE = Enum("D2D1_STROKE_TRANSFORM_TYPE", [
924 "D2D1_STROKE_TRANSFORM_TYPE_NORMAL",
925 "D2D1_STROKE_TRANSFORM_TYPE_FIXED",
926 "D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE",
927 "D2D1_STROKE_TRANSFORM_TYPE_FORCE_DWORD",
928])
929
930D2D1_PRIMITIVE_BLEND = Enum("D2D1_PRIMITIVE_BLEND", [
931 "D2D1_PRIMITIVE_BLEND_SOURCE_OVER",
932 "D2D1_PRIMITIVE_BLEND_COPY",
933 "D2D1_PRIMITIVE_BLEND_MIN",
934 "D2D1_PRIMITIVE_BLEND_ADD",
935 "D2D1_PRIMITIVE_BLEND_FORCE_DWORD",
936])
937
938D2D1_THREADING_MODE = Enum("D2D1_THREADING_MODE", [
939 "D2D1_THREADING_MODE_SINGLE_THREADED",
940 "D2D1_THREADING_MODE_MULTI_THREADED",
941 "D2D1_THREADING_MODE_FORCE_DWORD",
942])
943
944D2D1_COLOR_INTERPOLATION_MODE = Enum("D2D1_COLOR_INTERPOLATION_MODE", [
945 "D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT",
946 "D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED",
947 "D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD",
948])
949
950D2D1_VECTOR_2F = Alias("D2D1_VECTOR_2F", D2D_VECTOR_2F)
951D2D1_VECTOR_3F = Alias("D2D1_VECTOR_3F", D2D_VECTOR_3F)
952D2D1_VECTOR_4F = Alias("D2D1_VECTOR_4F", D2D_VECTOR_4F)
953D2D1_BITMAP_PROPERTIES1 = Struct("D2D1_BITMAP_PROPERTIES1", [
954 (D2D1_PIXEL_FORMAT, "pixelFormat"),
955 (FLOAT, "dpiX"),
956 (FLOAT, "dpiY"),
957 (D2D1_BITMAP_OPTIONS, "bitmapOptions"),
958 (ObjPointer(ID2D1ColorContext), "colorContext"),
959])
960
961D2D1_MAPPED_RECT = Struct("D2D1_MAPPED_RECT", [
962 (UINT32, "pitch"),
963 (Pointer(BYTE), "bits"),
964])
965
966D2D1_RENDERING_CONTROLS = Struct("D2D1_RENDERING_CONTROLS", [
967 (D2D1_BUFFER_PRECISION, "bufferPrecision"),
968 (D2D1_SIZE_U, "tileSize"),
969])
970
971D2D1_EFFECT_INPUT_DESCRIPTION = Struct("D2D1_EFFECT_INPUT_DESCRIPTION", [
972 (ObjPointer(ID2D1Effect), "effect"),
973 (UINT32, "inputIndex"),
974 (D2D1_RECT_F, "inputRectangle"),
975])
976
977D2D1_MATRIX_4X3_F = Alias("D2D1_MATRIX_4X3_F", D2D_MATRIX_4X3_F)
978D2D1_MATRIX_4X4_F = Alias("D2D1_MATRIX_4X4_F", D2D_MATRIX_4X4_F)
979D2D1_MATRIX_5X4_F = Alias("D2D1_MATRIX_5X4_F", D2D_MATRIX_5X4_F)
980D2D1_POINT_DESCRIPTION = Struct("D2D1_POINT_DESCRIPTION", [
981 (D2D1_POINT_2F, "point"),
982 (D2D1_POINT_2F, "unitTangentVector"),
983 (UINT32, "endSegment"),
984 (UINT32, "endFigure"),
985 (FLOAT, "lengthToEndSegment"),
986])
987
988D2D1_IMAGE_BRUSH_PROPERTIES = Struct("D2D1_IMAGE_BRUSH_PROPERTIES", [
989 (D2D1_RECT_F, "sourceRectangle"),
990 (D2D1_EXTEND_MODE, "extendModeX"),
991 (D2D1_EXTEND_MODE, "extendModeY"),
992 (D2D1_INTERPOLATION_MODE, "interpolationMode"),
993])
994
995D2D1_BITMAP_BRUSH_PROPERTIES1 = Struct("D2D1_BITMAP_BRUSH_PROPERTIES1", [
996 (D2D1_EXTEND_MODE, "extendModeX"),
997 (D2D1_EXTEND_MODE, "extendModeY"),
998 (D2D1_INTERPOLATION_MODE, "interpolationMode"),
999])
1000
1001D2D1_STROKE_STYLE_PROPERTIES1 = Struct("D2D1_STROKE_STYLE_PROPERTIES1", [
1002 (D2D1_CAP_STYLE, "startCap"),
1003 (D2D1_CAP_STYLE, "endCap"),
1004 (D2D1_CAP_STYLE, "dashCap"),
1005 (D2D1_LINE_JOIN, "lineJoin"),
1006 (FLOAT, "miterLimit"),
1007 (D2D1_DASH_STYLE, "dashStyle"),
1008 (FLOAT, "dashOffset"),
1009 (D2D1_STROKE_TRANSFORM_TYPE, "transformType"),
1010])
1011
1012D2D1_LAYER_OPTIONS1 = Enum("D2D1_LAYER_OPTIONS1", [
1013 "D2D1_LAYER_OPTIONS1_NONE",
1014 "D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND",
1015 "D2D1_LAYER_OPTIONS1_IGNORE_ALPHA",
1016 "D2D1_LAYER_OPTIONS1_FORCE_DWORD",
1017])
1018
1019D2D1_LAYER_PARAMETERS1 = Struct("D2D1_LAYER_PARAMETERS1", [
1020 (D2D1_RECT_F, "contentBounds"),
1021 (ObjPointer(ID2D1Geometry), "geometricMask"),
1022 (D2D1_ANTIALIAS_MODE, "maskAntialiasMode"),
1023 (D2D1_MATRIX_3X2_F, "maskTransform"),
1024 (FLOAT, "opacity"),
1025 (ObjPointer(ID2D1Brush), "opacityBrush"),
1026 (D2D1_LAYER_OPTIONS1, "layerOptions"),
1027])
1028
1029D2D1_PRINT_FONT_SUBSET_MODE = Enum("D2D1_PRINT_FONT_SUBSET_MODE", [
1030 "D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT",
1031 "D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE",
1032 "D2D1_PRINT_FONT_SUBSET_MODE_NONE",
1033 "D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD",
1034])
1035
1036D2D1_DRAWING_STATE_DESCRIPTION1 = Struct("D2D1_DRAWING_STATE_DESCRIPTION1", [
1037 (D2D1_ANTIALIAS_MODE, "antialiasMode"),
1038 (D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode"),
1039 (D2D1_TAG, "tag1"),
1040 (D2D1_TAG, "tag2"),
1041 (D2D1_MATRIX_3X2_F, "transform"),
1042 (D2D1_PRIMITIVE_BLEND, "primitiveBlend"),
1043 (D2D1_UNIT_MODE, "unitMode"),
1044])
1045
1046D2D1_PRINT_CONTROL_PROPERTIES = Struct("D2D1_PRINT_CONTROL_PROPERTIES", [
1047 (D2D1_PRINT_FONT_SUBSET_MODE, "fontSubset"),
1048 (FLOAT, "rasterDPI"),
1049 (D2D1_COLOR_SPACE, "colorSpace"),
1050])
1051
1052D2D1_CREATION_PROPERTIES = Struct("D2D1_CREATION_PROPERTIES", [
1053 (D2D1_THREADING_MODE, "threadingMode"),
1054 (D2D1_DEBUG_LEVEL, "debugLevel"),
1055 (D2D1_DEVICE_CONTEXT_OPTIONS, "options"),
1056])
1057
1058ID2D1GdiMetafileSink.methods += [
1059 StdMethod(HRESULT, "ProcessRecord", [(DWORD, "recordType"), (OpaqueBlob(Const(Void), "recordDataSize"), "recordData"), (DWORD, "recordDataSize")]),
1060]
1061
1062ID2D1GdiMetafile.methods += [
1063 StdMethod(HRESULT, "Stream", [(ObjPointer(ID2D1GdiMetafileSink), "sink")]),
1064 StdMethod(HRESULT, "GetBounds", [Out(Pointer(D2D1_RECT_F), "bounds")]),
1065]
1066
1067ID2D1CommandSink.methods += [
1068 StdMethod(HRESULT, "BeginDraw", []),
1069 StdMethod(HRESULT, "EndDraw", []),
1070 StdMethod(HRESULT, "SetAntialiasMode", [(D2D1_ANTIALIAS_MODE, "antialiasMode")]),
1071 StdMethod(HRESULT, "SetTags", [(D2D1_TAG, "tag1"), (D2D1_TAG, "tag2")]),
1072 StdMethod(HRESULT, "SetTextAntialiasMode", [(D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode")]),
1073 StdMethod(HRESULT, "SetTextRenderingParams", [(ObjPointer(IDWriteRenderingParams), "textRenderingParams")]),
1074 StdMethod(HRESULT, "SetTransform", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
1075 StdMethod(HRESULT, "SetPrimitiveBlend", [(D2D1_PRIMITIVE_BLEND, "primitiveBlend")]),
1076 StdMethod(HRESULT, "SetUnitMode", [(D2D1_UNIT_MODE, "unitMode")]),
1077 StdMethod(HRESULT, "Clear", [(Pointer(Const(D2D1_COLOR_F)), "color")]),
1078 StdMethod(HRESULT, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(Const(DWRITE_GLYPH_RUN_DESCRIPTION)), "glyphRunDescription"), (ObjPointer(ID2D1Brush), "foregroundBrush"), (DWRITE_MEASURING_MODE, "measuringMode")]),
1079 StdMethod(HRESULT, "DrawLine", [(D2D1_POINT_2F, "point0"), (D2D1_POINT_2F, "point1"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
1080 StdMethod(HRESULT, "DrawGeometry", [(ObjPointer(ID2D1Geometry), "geometry"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
1081 StdMethod(HRESULT, "DrawRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
1082 StdMethod(HRESULT, "DrawBitmap", [(ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (FLOAT, "opacity"), (D2D1_INTERPOLATION_MODE, "interpolationMode"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle"), (Pointer(Const(D2D1_MATRIX_4X4_F)), "perspectiveTransform")]),
1083 StdMethod(HRESULT, "DrawImage", [(ObjPointer(ID2D1Image), "image"), (Pointer(Const(D2D1_POINT_2F)), "targetOffset"), (Pointer(Const(D2D1_RECT_F)), "imageRectangle"), (D2D1_INTERPOLATION_MODE, "interpolationMode"), (D2D1_COMPOSITE_MODE, "compositeMode")]),
1084 StdMethod(HRESULT, "DrawGdiMetafile", [(ObjPointer(ID2D1GdiMetafile), "gdiMetafile"), (Pointer(Const(D2D1_POINT_2F)), "targetOffset")]),
1085 StdMethod(HRESULT, "FillMesh", [(ObjPointer(ID2D1Mesh), "mesh"), (ObjPointer(ID2D1Brush), "brush")]),
1086 StdMethod(HRESULT, "FillOpacityMask", [(ObjPointer(ID2D1Bitmap), "opacityMask"), (ObjPointer(ID2D1Brush), "brush"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
1087 StdMethod(HRESULT, "FillGeometry", [(ObjPointer(ID2D1Geometry), "geometry"), (ObjPointer(ID2D1Brush), "brush"), (ObjPointer(ID2D1Brush), "opacityBrush")]),
1088 StdMethod(HRESULT, "FillRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (ObjPointer(ID2D1Brush), "brush")]),
1089 StdMethod(HRESULT, "PushAxisAlignedClip", [(Pointer(Const(D2D1_RECT_F)), "clipRect"), (D2D1_ANTIALIAS_MODE, "antialiasMode")]),
1090 StdMethod(HRESULT, "PushLayer", [(Pointer(Const(D2D1_LAYER_PARAMETERS1)), "layerParameters1"), (ObjPointer(ID2D1Layer), "layer")]),
1091 StdMethod(HRESULT, "PopAxisAlignedClip", []),
1092 StdMethod(HRESULT, "PopLayer", []),
1093]
1094
1095ID2D1CommandList.methods += [
1096 StdMethod(HRESULT, "Stream", [(ObjPointer(ID2D1CommandSink), "sink")]),
1097 StdMethod(HRESULT, "Close", []),
1098]
1099
1100ID2D1PrintControl.methods += [
1101 StdMethod(HRESULT, "AddPage", [(ObjPointer(ID2D1CommandList), "commandList"), (D2D_SIZE_F, "pageSize"), (Opaque("IStream *"), "pagePrintTicketStream"), Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")]),
1102 StdMethod(HRESULT, "Close", []),
1103]
1104
1105ID2D1ImageBrush.methods += [
1106 StdMethod(Void, "SetImage", [(ObjPointer(ID2D1Image), "image")]),
1107 StdMethod(Void, "SetExtendModeX", [(D2D1_EXTEND_MODE, "extendModeX")]),
1108 StdMethod(Void, "SetExtendModeY", [(D2D1_EXTEND_MODE, "extendModeY")]),
1109 StdMethod(Void, "SetInterpolationMode", [(D2D1_INTERPOLATION_MODE, "interpolationMode")]),
1110 StdMethod(Void, "SetSourceRectangle", [(Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001111 StdMethod(Void, "GetImage", [Out(Pointer(ObjPointer(ID2D1Image)), "image")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001112 StdMethod(D2D1_EXTEND_MODE, "GetExtendModeX", [], const=True, sideeffects=False),
1113 StdMethod(D2D1_EXTEND_MODE, "GetExtendModeY", [], const=True, sideeffects=False),
1114 StdMethod(D2D1_INTERPOLATION_MODE, "GetInterpolationMode", [], const=True, sideeffects=False),
1115 StdMethod(Void, "GetSourceRectangle", [Out(Pointer(D2D1_RECT_F), "sourceRectangle")], const=True, sideeffects=False),
1116]
1117
1118ID2D1BitmapBrush1.methods += [
1119 StdMethod(Void, "SetInterpolationMode1", [(D2D1_INTERPOLATION_MODE, "interpolationMode")]),
1120 StdMethod(D2D1_INTERPOLATION_MODE, "GetInterpolationMode1", [], const=True, sideeffects=False),
1121]
1122
1123ID2D1StrokeStyle1.methods += [
1124 StdMethod(D2D1_STROKE_TRANSFORM_TYPE, "GetStrokeTransformType", [], const=True, sideeffects=False),
1125]
1126
1127ID2D1PathGeometry1.methods += [
1128 StdMethod(HRESULT, "ComputePointAndSegmentAtLength", [(FLOAT, "length"), (UINT32, "startSegment"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_POINT_DESCRIPTION), "pointDescription")], const=True, sideeffects=False),
1129]
1130
1131ID2D1Properties.methods += [
1132 StdMethod(UINT32, "GetPropertyCount", [], const=True, sideeffects=False),
1133 StdMethod(HRESULT, "GetPropertyName", [(UINT32, "index"), Out(PWSTR, "name"), (UINT32, "nameCount")], const=True, sideeffects=False),
1134 StdMethod(UINT32, "GetPropertyNameLength", [(UINT32, "index")], const=True, sideeffects=False),
1135 StdMethod(D2D1_PROPERTY_TYPE, "GetType", [(UINT32, "index")], const=True, sideeffects=False),
1136 StdMethod(D2D1_PROPERTY_INDEX, "GetPropertyIndex", [(PCWSTR, "name")], const=True, sideeffects=False),
1137 StdMethod(HRESULT, "SetValueByName", [(PCWSTR, "name"), (D2D1_PROPERTY_TYPE, "type"), (Pointer(Const(BYTE)), "data"), (UINT32, "dataSize")]),
1138 StdMethod(HRESULT, "SetValue", [(UINT32, "index"), (D2D1_PROPERTY_TYPE, "type"), (Pointer(Const(BYTE)), "data"), (UINT32, "dataSize")]),
1139 StdMethod(HRESULT, "GetValueByName", [(PCWSTR, "name"), (D2D1_PROPERTY_TYPE, "type"), Out(Pointer(BYTE), "data"), (UINT32, "dataSize")], const=True, sideeffects=False),
1140 StdMethod(HRESULT, "GetValue", [(UINT32, "index"), (D2D1_PROPERTY_TYPE, "type"), Out(Pointer(BYTE), "data"), (UINT32, "dataSize")], const=True, sideeffects=False),
1141 StdMethod(UINT32, "GetValueSize", [(UINT32, "index")], const=True, sideeffects=False),
1142 StdMethod(HRESULT, "GetSubProperties", [(UINT32, "index"), Out(Pointer(ObjPointer(ID2D1Properties)), "subProperties")], const=True),
1143]
1144
1145ID2D1Effect.methods += [
1146 StdMethod(Void, "SetInput", [(UINT32, "index"), (ObjPointer(ID2D1Image), "input"), (BOOL, "invalidate")]),
1147 StdMethod(HRESULT, "SetInputCount", [(UINT32, "inputCount")]),
1148 StdMethod(Void, "GetInput", [(UINT32, "index"), Out(Pointer(ObjPointer(ID2D1Image)), "input")], const=True),
1149 StdMethod(UINT32, "GetInputCount", [], const=True, sideeffects=False),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001150 StdMethod(Void, "GetOutput", [Out(Pointer(ObjPointer(ID2D1Image)), "outputImage")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001151]
1152
1153ID2D1Bitmap1.methods += [
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001154 StdMethod(Void, "GetColorContext", [Out(Pointer(ObjPointer(ID2D1ColorContext)), "colorContext")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001155 StdMethod(D2D1_BITMAP_OPTIONS, "GetOptions", [], const=True, sideeffects=False),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001156 StdMethod(HRESULT, "GetSurface", [Out(Pointer(ObjPointer(IDXGISurface)), "dxgiSurface")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001157 StdMethod(HRESULT, "Map", [(D2D1_MAP_OPTIONS, "options"), Out(Pointer(D2D1_MAPPED_RECT), "mappedRect")]),
1158 StdMethod(HRESULT, "Unmap", []),
1159]
1160
1161ID2D1ColorContext.methods += [
1162 StdMethod(D2D1_COLOR_SPACE, "GetColorSpace", [], const=True, sideeffects=False),
1163 StdMethod(UINT32, "GetProfileSize", [], const=True, sideeffects=False),
1164 StdMethod(HRESULT, "GetProfile", [Out(Pointer(BYTE), "profile"), (UINT32, "profileSize")], const=True, sideeffects=False),
1165]
1166
1167ID2D1GradientStopCollection1.methods += [
1168 StdMethod(Void, "GetGradientStops1", [Out(Array(D2D1_GRADIENT_STOP, "gradientStopsCount"), "gradientStops"), (UINT32, "gradientStopsCount")], const=True, sideeffects=False),
1169 StdMethod(D2D1_COLOR_SPACE, "GetPreInterpolationSpace", [], const=True, sideeffects=False),
1170 StdMethod(D2D1_COLOR_SPACE, "GetPostInterpolationSpace", [], const=True, sideeffects=False),
1171 StdMethod(D2D1_BUFFER_PRECISION, "GetBufferPrecision", [], const=True, sideeffects=False),
1172 StdMethod(D2D1_COLOR_INTERPOLATION_MODE, "GetColorInterpolationMode", [], const=True, sideeffects=False),
1173]
1174
1175ID2D1DrawingStateBlock1.methods += [
1176 StdMethod(Void, "GetDescription", [Out(Pointer(D2D1_DRAWING_STATE_DESCRIPTION1), "stateDescription")], const=True, sideeffects=False),
1177 StdMethod(Void, "SetDescription", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION1)), "stateDescription")]),
1178]
1179
1180ID2D1DeviceContext.methods += [
1181 StdMethod(HRESULT, "CreateBitmap", [(D2D1_SIZE_U, "size"), (OpaquePointer(Const(Void)), "sourceData"), (UINT32, "pitch"), (Pointer(Const(D2D1_BITMAP_PROPERTIES1)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap1)), "bitmap")]),
1182 StdMethod(HRESULT, "CreateBitmapFromWicBitmap", [(Opaque("IWICBitmapSource *"), "wicBitmapSource"), (Pointer(Const(D2D1_BITMAP_PROPERTIES1)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap1)), "bitmap")]),
1183 StdMethod(HRESULT, "CreateColorContext", [(D2D1_COLOR_SPACE, "space"), (Pointer(Const(BYTE)), "profile"), (UINT32, "profileSize"), Out(Pointer(ObjPointer(ID2D1ColorContext)), "colorContext")]),
1184 StdMethod(HRESULT, "CreateColorContextFromFilename", [(PCWSTR, "filename"), Out(Pointer(ObjPointer(ID2D1ColorContext)), "colorContext")]),
1185 StdMethod(HRESULT, "CreateColorContextFromWicColorContext", [(Opaque("IWICColorContext *"), "wicColorContext"), Out(Pointer(ObjPointer(ID2D1ColorContext)), "colorContext")]),
1186 StdMethod(HRESULT, "CreateBitmapFromDxgiSurface", [(ObjPointer(IDXGISurface), "surface"), (Pointer(Const(D2D1_BITMAP_PROPERTIES1)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap1)), "bitmap")]),
1187 StdMethod(HRESULT, "CreateEffect", [(REFCLSID, "effectId"), Out(Pointer(ObjPointer(ID2D1Effect)), "effect")]),
1188 StdMethod(HRESULT, "CreateGradientStopCollection", [(Pointer(Const(D2D1_GRADIENT_STOP)), "straightAlphaGradientStops"), (UINT32, "straightAlphaGradientStopsCount"), (D2D1_COLOR_SPACE, "preInterpolationSpace"), (D2D1_COLOR_SPACE, "postInterpolationSpace"), (D2D1_BUFFER_PRECISION, "bufferPrecision"), (D2D1_EXTEND_MODE, "extendMode"), (D2D1_COLOR_INTERPOLATION_MODE, "colorInterpolationMode"), Out(Pointer(ObjPointer(ID2D1GradientStopCollection1)), "gradientStopCollection1")]),
1189 StdMethod(HRESULT, "CreateImageBrush", [(ObjPointer(ID2D1Image), "image"), (Pointer(Const(D2D1_IMAGE_BRUSH_PROPERTIES)), "imageBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(ObjPointer(ID2D1ImageBrush)), "imageBrush")]),
1190 StdMethod(HRESULT, "CreateBitmapBrush", [(ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_BITMAP_BRUSH_PROPERTIES1)), "bitmapBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(ObjPointer(ID2D1BitmapBrush1)), "bitmapBrush")]),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001191 StdMethod(HRESULT, "CreateCommandList", [Out(Pointer(ObjPointer(ID2D1CommandList)), "commandList")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001192 StdMethod(BOOL, "IsDxgiFormatSupported", [(DXGI_FORMAT, "format")], const=True, sideeffects=False),
1193 StdMethod(BOOL, "IsBufferPrecisionSupported", [(D2D1_BUFFER_PRECISION, "bufferPrecision")], const=True, sideeffects=False),
1194 StdMethod(HRESULT, "GetImageLocalBounds", [(ObjPointer(ID2D1Image), "image"), Out(Pointer(D2D1_RECT_F), "localBounds")], const=True, sideeffects=False),
1195 StdMethod(HRESULT, "GetImageWorldBounds", [(ObjPointer(ID2D1Image), "image"), Out(Pointer(D2D1_RECT_F), "worldBounds")], const=True, sideeffects=False),
1196 StdMethod(HRESULT, "GetGlyphRunWorldBounds", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (DWRITE_MEASURING_MODE, "measuringMode"), Out(Pointer(D2D1_RECT_F), "bounds")], const=True, sideeffects=False),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001197 StdMethod(Void, "GetDevice", [Out(Pointer(ObjPointer(ID2D1Device)), "device")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001198 StdMethod(Void, "SetTarget", [(ObjPointer(ID2D1Image), "image")]),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001199 StdMethod(Void, "GetTarget", [Out(Pointer(ObjPointer(ID2D1Image)), "image")], const=True),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001200 StdMethod(Void, "SetRenderingControls", [(Pointer(Const(D2D1_RENDERING_CONTROLS)), "renderingControls")]),
1201 StdMethod(Void, "GetRenderingControls", [Out(Pointer(D2D1_RENDERING_CONTROLS), "renderingControls")], const=True, sideeffects=False),
1202 StdMethod(Void, "SetPrimitiveBlend", [(D2D1_PRIMITIVE_BLEND, "primitiveBlend")]),
1203 StdMethod(D2D1_PRIMITIVE_BLEND, "GetPrimitiveBlend", [], const=True, sideeffects=False),
1204 StdMethod(Void, "SetUnitMode", [(D2D1_UNIT_MODE, "unitMode")]),
1205 StdMethod(D2D1_UNIT_MODE, "GetUnitMode", [], const=True, sideeffects=False),
1206 StdMethod(Void, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(Const(DWRITE_GLYPH_RUN_DESCRIPTION)), "glyphRunDescription"), (ObjPointer(ID2D1Brush), "foregroundBrush"), (DWRITE_MEASURING_MODE, "measuringMode")]),
1207 StdMethod(Void, "DrawImage", [(ObjPointer(ID2D1Image), "image"), (Pointer(Const(D2D1_POINT_2F)), "targetOffset"), (Pointer(Const(D2D1_RECT_F)), "imageRectangle"), (D2D1_INTERPOLATION_MODE, "interpolationMode"), (D2D1_COMPOSITE_MODE, "compositeMode")]),
1208 StdMethod(Void, "DrawGdiMetafile", [(ObjPointer(ID2D1GdiMetafile), "gdiMetafile"), (Pointer(Const(D2D1_POINT_2F)), "targetOffset")]),
1209 StdMethod(Void, "DrawBitmap", [(ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (FLOAT, "opacity"), (D2D1_INTERPOLATION_MODE, "interpolationMode"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle"), (Pointer(Const(D2D1_MATRIX_4X4_F)), "perspectiveTransform")]),
1210 StdMethod(Void, "PushLayer", [(Pointer(Const(D2D1_LAYER_PARAMETERS1)), "layerParameters"), (ObjPointer(ID2D1Layer), "layer")]),
1211 StdMethod(HRESULT, "InvalidateEffectInputRectangle", [(ObjPointer(ID2D1Effect), "effect"), (UINT32, "input"), (Pointer(Const(D2D1_RECT_F)), "inputRectangle")]),
1212 StdMethod(HRESULT, "GetEffectInvalidRectangleCount", [(ObjPointer(ID2D1Effect), "effect"), Out(Pointer(UINT32), "rectangleCount")]),
1213 StdMethod(HRESULT, "GetEffectInvalidRectangles", [(ObjPointer(ID2D1Effect), "effect"), Out(Pointer(D2D1_RECT_F), "rectangles"), (UINT32, "rectanglesCount")]),
1214 StdMethod(HRESULT, "GetEffectRequiredInputRectangles", [(ObjPointer(ID2D1Effect), "renderEffect"), (Pointer(Const(D2D1_RECT_F)), "renderImageRectangle"), (Pointer(Const(D2D1_EFFECT_INPUT_DESCRIPTION)), "inputDescriptions"), Out(Pointer(D2D1_RECT_F), "requiredInputRects"), (UINT32, "inputCount")]),
1215 StdMethod(Void, "FillOpacityMask", [(ObjPointer(ID2D1Bitmap), "opacityMask"), (ObjPointer(ID2D1Brush), "brush"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
1216]
1217
1218ID2D1Device.methods += [
1219 StdMethod(HRESULT, "CreateDeviceContext", [(D2D1_DEVICE_CONTEXT_OPTIONS, "options"), Out(Pointer(ObjPointer(ID2D1DeviceContext)), "deviceContext")]),
1220 StdMethod(HRESULT, "CreatePrintControl", [(Opaque("IWICImagingFactory *"), "wicFactory"), (Opaque("IPrintDocumentPackageTarget *"), "documentTarget"), (Pointer(Const(D2D1_PRINT_CONTROL_PROPERTIES)), "printControlProperties"), Out(Pointer(ObjPointer(ID2D1PrintControl)), "printControl")]),
1221 StdMethod(Void, "SetMaximumTextureMemory", [(UINT64, "maximumInBytes")]),
1222 StdMethod(UINT64, "GetMaximumTextureMemory", [], const=True, sideeffects=False),
1223 StdMethod(Void, "ClearResources", [(UINT32, "millisecondsSinceUse")]),
1224]
1225
Jose Fonsecacc9bea92016-02-01 13:28:54 +00001226PD2D1_PROPERTY_SET_FUNCTION = Opaque("PD2D1_PROPERTY_SET_FUNCTION")
1227PD2D1_PROPERTY_GET_FUNCTION = Opaque("PD2D1_PROPERTY_GET_FUNCTION")
1228D2D1_PROPERTY_BINDING = Struct("D2D1_PROPERTY_BINDING", [
1229 (PCWSTR, "propertyName"),
1230 (PD2D1_PROPERTY_SET_FUNCTION, "setFunction"),
1231 (PD2D1_PROPERTY_GET_FUNCTION, "getFunction"),
1232])
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001233
1234PD2D1_EFFECT_FACTORY = Opaque("PD2D1_EFFECT_FACTORY")
1235
1236ID2D1Factory1.methods += [
1237 StdMethod(HRESULT, "CreateDevice", [(Opaque("IDXGIDevice *"), "dxgiDevice"), Out(Pointer(ObjPointer(ID2D1Device)), "d2dDevice")]),
1238 StdMethod(HRESULT, "CreateStrokeStyle", [(Pointer(Const(D2D1_STROKE_STYLE_PROPERTIES1)), "strokeStyleProperties"), (Pointer(Const(FLOAT)), "dashes"), (UINT32, "dashesCount"), Out(Pointer(ObjPointer(ID2D1StrokeStyle1)), "strokeStyle")]),
Robert Tarasov6ccf5bb2020-01-10 12:31:25 -08001239 StdMethod(HRESULT, "CreatePathGeometry", [Out(Pointer(ObjPointer(ID2D1PathGeometry1)), "pathGeometry")]),
Jose Fonsecaf7a71302015-08-13 16:10:06 +01001240 StdMethod(HRESULT, "CreateDrawingStateBlock", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION1)), "drawingStateDescription"), (ObjPointer(IDWriteRenderingParams), "textRenderingParams"), Out(Pointer(ObjPointer(ID2D1DrawingStateBlock1)), "drawingStateBlock")]),
1241 StdMethod(HRESULT, "CreateGdiMetafile", [(Opaque("IStream *"), "metafileStream"), Out(Pointer(ObjPointer(ID2D1GdiMetafile)), "metafile")]),
1242 StdMethod(HRESULT, "RegisterEffectFromStream", [(REFCLSID, "classId"), (Opaque("IStream *"), "propertyXml"), (Pointer(Const(D2D1_PROPERTY_BINDING)), "bindings"), (UINT32, "bindingsCount"), (Const(PD2D1_EFFECT_FACTORY), "effectFactory")]),
1243 StdMethod(HRESULT, "RegisterEffectFromString", [(REFCLSID, "classId"), (PCWSTR, "propertyXml"), (Pointer(Const(D2D1_PROPERTY_BINDING)), "bindings"), (UINT32, "bindingsCount"), (Const(PD2D1_EFFECT_FACTORY), "effectFactory")]),
1244 StdMethod(HRESULT, "UnregisterEffect", [(REFCLSID, "classId")]),
1245 StdMethod(HRESULT, "GetRegisteredEffects", [Out(Pointer(CLSID), "effects"), (UINT32, "effectsCount"), Out(Pointer(UINT32), "effectsReturned"), Out(Pointer(UINT32), "effectsRegistered")], const=True, sideeffects=False),
1246 StdMethod(HRESULT, "GetEffectProperties", [(REFCLSID, "effectId"), Out(Pointer(ObjPointer(ID2D1Properties)), "properties")], const=True),
1247]
1248
1249ID2D1Multithread.methods += [
1250 StdMethod(BOOL, "GetMultithreadProtected", [], const=True, sideeffects=False),
1251 StdMethod(Void, "Enter", []),
1252 StdMethod(Void, "Leave", []),
1253]
1254
1255d2d1.addInterfaces([
1256 ID2D1Factory1,
1257 ID2D1Multithread,
1258])
1259d2d1.addFunctions([
1260 StdFunction(HRESULT, "D2D1CreateDevice", [(Opaque("IDXGIDevice *"), "dxgiDevice"), (Pointer(Const(D2D1_CREATION_PROPERTIES)), "creationProperties"), Out(Pointer(ObjPointer(ID2D1Device)), "d2dDevice")]),
1261 StdFunction(HRESULT, "D2D1CreateDeviceContext", [(ObjPointer(IDXGISurface), "dxgiSurface"), (Pointer(Const(D2D1_CREATION_PROPERTIES)), "creationProperties"), Out(Pointer(ObjPointer(ID2D1DeviceContext)), "d2dDeviceContext")]),
1262 StdFunction(D2D1_COLOR_F, "D2D1ConvertColorSpace", [(D2D1_COLOR_SPACE, "sourceColorSpace"), (D2D1_COLOR_SPACE, "destinationColorSpace"), (Pointer(Const(D2D1_COLOR_F)), "color")]),
1263 StdFunction(Void, "D2D1SinCos", [(FLOAT, "angle"), Out(Pointer(FLOAT), "s"), Out(Pointer(FLOAT), "c")]),
1264 StdFunction(FLOAT, "D2D1Tan", [(FLOAT, "angle")]),
1265 StdFunction(FLOAT, "D2D1Vec3Length", [(FLOAT, "x"), (FLOAT, "y"), (FLOAT, "z")]),
1266])