]> git.cworth.org Git - apitrace/commitdiff
Draft D2D trace support.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 10 Oct 2011 00:45:04 +0000 (01:45 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 10 Oct 2011 00:45:04 +0000 (01:45 +0100)
15 files changed:
.gitignore
CMakeLists.txt
cmake/FindDirectX.cmake
compat.h
d2d1trace.py [new file with mode: 0644]
specs/d2d1.def [new file with mode: 0644]
specs/d2d1.py [new file with mode: 0644]
specs/d2dbasetypes.py [new file with mode: 0644]
specs/d2derr.py [new file with mode: 0644]
specs/dcommon.py [new file with mode: 0644]
specs/dwrite.py [new file with mode: 0644]
specs/scripts/cdecl.py
specs/stdapi.py
specs/temp.py [new file with mode: 0644]
specs/winapi.py

index 95b78fec2d3d4e4198f71c75f44f36bcdce3702b..bd855dbdf05b7bf20d9238bbbff1ad62923f7d2f 100644 (file)
@@ -30,6 +30,7 @@ CMakeFiles
 Makefile
 build
 cgltrace.cpp
+d3d1trace.cpp
 d3d10trace.cpp
 d3d8trace.cpp
 d3d9trace.cpp
index c81e44d8f0131e15766a27bd2821fee5d648a437..d520fb6132e6f708932b10e9bbb82f44083678c7 100755 (executable)
@@ -307,6 +307,23 @@ if (WIN32)
         install (TARGETS d3d10 LIBRARY DESTINATION wrappers)
     endif (DirectX_D3D10_INCLUDE_DIR)
 
+    # d2d1.dll
+    if (DirectX_D2D1_INCLUDE_DIR)
+        include_directories (SYSTEM ${DirectX_D2D1_INCLUDE_DIR})
+        add_custom_command (
+            OUTPUT d2d1trace.cpp
+            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d2d1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d2d1trace.cpp
+            DEPENDS d2d1trace.py trace.py specs/d2d1.py specs/d2d1.py specs/d2dbasetypes.py specs/d2derr.py specs/dwrite.py specs/dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
+        )
+        add_library (d2d1 MODULE specs/d2d1.def d2d1trace.cpp)
+        set_target_properties (d2d1
+            PROPERTIES PREFIX ""
+            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+        )
+        install (TARGETS d2d1 LIBRARY DESTINATION wrappers)
+    endif (DirectX_D2D1_INCLUDE_DIR)
+
     # opengl32.dll
     add_custom_command (
         OUTPUT wgltrace.cpp
index 2c54023ebc43b19af4458740a874d8530f130f38..faeee60f150a99745fb1163a8a185301363dd997 100644 (file)
@@ -137,6 +137,22 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                endif (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3DX10_LIBRARY)
        endif (DirectX_D3D10_INCLUDE_DIR AND DirectX_D3D10_LIBRARY)
 
+
+       find_path (DirectX_D2D1_INCLUDE_DIR d2d1.h
+               PATHS
+                       "${DirectX_ROOT_DIR}/Include"
+               DOC "The directory where d2d1.h resides")
+
+       find_library (DirectX_D2D1_LIBRARY d2d1
+               PATHS
+                       "${DirectX_ROOT_DIR}/Lib/x86"
+               DOC "The directory where d2d1 resides")
+
+       if (DirectX_D2D1_INCLUDE_DIR AND DirectX_D2D1_LIBRARY)
+               set (DirectX_D2D1_FOUND 1)
+       endif (DirectX_D2D1_INCLUDE_DIR AND DirectX_D2D1_LIBRARY)
+
+
        mark_as_advanced(
                DirectX_D3D_INCLUDE_DIR
                DirectX_D3D_INCLUDE_DIR
@@ -162,6 +178,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                DirectX_D3D10_LIBRARY
                DirectX_D3DX10_INCLUDE_DIR
                DirectX_D3DX10_LIBRARY
+               DirectX_D2D1_INCLUDE_DIR
+               DirectX_D2D1_LIBRARY
        )
 
 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
@@ -175,4 +193,5 @@ mark_as_advanced (
        DirectX_D3DX9_FOUND
        DirectX_D3D10_FOUND
        DirectX_D3DX10_FOUND
+       DirectX_D2D1_FOUND
 )
index f1d302878e212a3deb2e0f3c73371732aaa8a87f..c7fb3d52a2b95111e7661ab9b417718a9ba5c46f 100644 (file)
--- a/compat.h
+++ b/compat.h
 #define __field_bcount(x) /**/
 #define __field_ecount(x) /**/
 #define __field_ecount_full(x) /**/
-#define __inline static __inline__
+#define __inline __inline__
+#define __deref_out /**/
+#define __deref_out_opt /**/
+#define __maybenull
+#define __in_z
+#define __in_z_opt
+#define __out_z
+#define __out_ecount_z(x)
+#define __nullterminated
+#define __notnull
 
+#ifndef DECLSPEC_DEPRECATED
 #define DECLSPEC_DEPRECATED /**/
+#endif
 
+#ifndef DECLSPEC_NOVTABLE
+#define DECLSPEC_NOVTABLE
+#endif
+
+#define INT8 int8_t
 #define UINT8 uint8_t
+#define INT16 int16_t
+#define UINT16 uint16_t
+
 
 #endif /* __MINGW32__ */
 
diff --git a/d2d1trace.py b/d2d1trace.py
new file mode 100644 (file)
index 0000000..579836b
--- /dev/null
@@ -0,0 +1,57 @@
+##########################################################################
+#
+# Copyright 2008-2009 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from trace import DllTracer
+from specs.d2d1 import d2d1
+
+
+class D2D1Tracer(DllTracer):
+
+    def wrap_arg(self, function, arg):
+        if function.name == 'D2D1CreateFactory' and arg.output:
+            print '    if (*%s) {' % arg.name
+            for iface in d2d1.interfaces:
+                print '        if (riid == IID_%s) {' % iface.name
+                print '            *%s = (LPVOID) new Wrap%s((%s *)*%s);' % (arg.name, iface.name, iface.name, arg.name)
+                print '        }'
+            print '    }'
+
+        DllTracer.wrap_arg(self, function, arg)
+
+
+if __name__ == '__main__':
+    print '#include "trace_writer.hpp"'
+    print '#include "os.hpp"'
+    print
+    print '#include <windows.h>'
+    print
+    print '#include "compat.h"'
+    print
+    print '#include <d2d1.h>'
+    print '#include <dwrite.h>'
+    print
+    tracer = D2D1Tracer('d2d1.dll')
+    tracer.trace_api(d2d1)
diff --git a/specs/d2d1.def b/specs/d2d1.def
new file mode 100644 (file)
index 0000000..58c897b
--- /dev/null
@@ -0,0 +1,8 @@
+LIBRARY "d2d1"
+
+EXPORTS
+       D2D1CreateFactory
+       D2D1InvertMatrix
+       D2D1IsMatrixInvertible
+       D2D1MakeRotateMatrix
+       D2D1MakeSkewMatrix
diff --git a/specs/d2d1.py b/specs/d2d1.py
new file mode 100644 (file)
index 0000000..db39bbc
--- /dev/null
@@ -0,0 +1,633 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+from dxgiformat import DXGI_FORMAT
+from dxgi import IDXGISurface
+from d2derr import *
+from d2dbasetypes import *
+from dwrite import *
+
+
+ID2D1Resource = Interface("ID2D1Resource", IUnknown)
+ID2D1Bitmap = Interface("ID2D1Bitmap", ID2D1Resource)
+ID2D1GradientStopCollection = Interface("ID2D1GradientStopCollection", ID2D1Resource)
+ID2D1Brush = Interface("ID2D1Brush", ID2D1Resource)
+ID2D1BitmapBrush = Interface("ID2D1BitmapBrush", ID2D1Brush)
+ID2D1SolidColorBrush = Interface("ID2D1SolidColorBrush", ID2D1Brush)
+ID2D1LinearGradientBrush = Interface("ID2D1LinearGradientBrush", ID2D1Brush)
+ID2D1RadialGradientBrush = Interface("ID2D1RadialGradientBrush", ID2D1Brush)
+ID2D1StrokeStyle = Interface("ID2D1StrokeStyle", ID2D1Resource)
+ID2D1Geometry = Interface("ID2D1Geometry", ID2D1Resource)
+ID2D1RectangleGeometry = Interface("ID2D1RectangleGeometry", ID2D1Geometry)
+ID2D1RoundedRectangleGeometry = Interface("ID2D1RoundedRectangleGeometry", ID2D1Geometry)
+ID2D1EllipseGeometry = Interface("ID2D1EllipseGeometry", ID2D1Geometry)
+ID2D1GeometryGroup = Interface("ID2D1GeometryGroup", ID2D1Geometry)
+ID2D1TransformedGeometry = Interface("ID2D1TransformedGeometry", ID2D1Geometry)
+ID2D1GeometrySink = Interface("ID2D1GeometrySink", ID2D1SimplifiedGeometrySink)
+ID2D1TessellationSink = Interface("ID2D1TessellationSink", IUnknown)
+ID2D1PathGeometry = Interface("ID2D1PathGeometry", ID2D1Geometry)
+ID2D1Mesh = Interface("ID2D1Mesh", ID2D1Resource)
+ID2D1Layer = Interface("ID2D1Layer", ID2D1Resource)
+ID2D1DrawingStateBlock = Interface("ID2D1DrawingStateBlock", ID2D1Resource)
+ID2D1RenderTarget = Interface("ID2D1RenderTarget", ID2D1Resource)
+ID2D1BitmapRenderTarget = Interface("ID2D1BitmapRenderTarget", ID2D1RenderTarget)
+ID2D1HwndRenderTarget = Interface("ID2D1HwndRenderTarget", ID2D1RenderTarget)
+ID2D1GdiInteropRenderTarget = Interface("ID2D1GdiInteropRenderTarget", IUnknown)
+ID2D1DCRenderTarget = Interface("ID2D1DCRenderTarget", ID2D1RenderTarget)
+ID2D1Factory = Interface("ID2D1Factory", IUnknown)
+
+
+D2D1_ALPHA_MODE = Enum("D2D1_ALPHA_MODE", [
+    "D2D1_ALPHA_MODE_UNKNOWN",
+    "D2D1_ALPHA_MODE_PREMULTIPLIED",
+    "D2D1_ALPHA_MODE_STRAIGHT",
+    "D2D1_ALPHA_MODE_IGNORE",
+])
+
+D2D1_GAMMA = Enum("D2D1_GAMMA", [
+    "D2D1_GAMMA_2_2",
+    "D2D1_GAMMA_1_0",
+])
+
+D2D1_OPACITY_MASK_CONTENT = Enum("D2D1_OPACITY_MASK_CONTENT", [
+    "D2D1_OPACITY_MASK_CONTENT_GRAPHICS",
+    "D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL",
+    "D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE",
+])
+
+D2D1_EXTEND_MODE = Enum("D2D1_EXTEND_MODE", [
+    "D2D1_EXTEND_MODE_CLAMP",
+    "D2D1_EXTEND_MODE_WRAP",
+    "D2D1_EXTEND_MODE_MIRROR",
+])
+
+D2D1_ANTIALIAS_MODE = Enum("D2D1_ANTIALIAS_MODE", [
+    "D2D1_ANTIALIAS_MODE_PER_PRIMITIVE",
+    "D2D1_ANTIALIAS_MODE_ALIASED",
+])
+
+D2D1_TEXT_ANTIALIAS_MODE = Enum("D2D1_TEXT_ANTIALIAS_MODE", [
+    "D2D1_TEXT_ANTIALIAS_MODE_DEFAULT",
+    "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE",
+    "D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE",
+    "D2D1_TEXT_ANTIALIAS_MODE_ALIASED",
+])
+
+D2D1_BITMAP_INTERPOLATION_MODE = Enum("D2D1_BITMAP_INTERPOLATION_MODE", [
+    "D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR",
+    "D2D1_BITMAP_INTERPOLATION_MODE_LINEAR",
+])
+
+D2D1_DRAW_TEXT_OPTIONS = EnumFlag("D2D1_DRAW_TEXT_OPTIONS", [
+    "D2D1_DRAW_TEXT_OPTIONS_NONE",
+    "D2D1_DRAW_TEXT_OPTIONS_NO_SNAP",
+    "D2D1_DRAW_TEXT_OPTIONS_NO_CLIP",
+])
+
+D2D1_PIXEL_FORMAT = Struct("D2D1_PIXEL_FORMAT", [
+    (DXGI_FORMAT, "format"),
+    (D2D1_ALPHA_MODE, "alphaMode"),
+])
+
+D2D1_POINT_2U = Alias("D2D1_POINT_2U", D2D_POINT_2U)
+D2D1_POINT_2F = Alias("D2D1_POINT_2F", D2D_POINT_2F)
+D2D1_RECT_F = Alias("D2D1_RECT_F", D2D_RECT_F)
+D2D1_RECT_U = Alias("D2D1_RECT_U", D2D_RECT_U)
+D2D1_SIZE_F = Alias("D2D1_SIZE_F", D2D_SIZE_F)
+D2D1_SIZE_U = Alias("D2D1_SIZE_U", D2D_SIZE_U)
+D2D1_COLOR_F = Alias("D2D1_COLOR_F", D2D_COLOR_F)
+D2D1_MATRIX_3X2_F = Alias("D2D1_MATRIX_3X2_F", D2D_MATRIX_3X2_F)
+D2D1_TAG = Alias("D2D1_TAG", UINT64)
+D2D1_BITMAP_PROPERTIES = Struct("D2D1_BITMAP_PROPERTIES", [
+    (D2D1_PIXEL_FORMAT, "pixelFormat"),
+    (FLOAT, "dpiX"),
+    (FLOAT, "dpiY"),
+])
+
+D2D1_GRADIENT_STOP = Struct("D2D1_GRADIENT_STOP", [
+    (FLOAT, "position"),
+    (D2D1_COLOR_F, "color"),
+])
+
+D2D1_BRUSH_PROPERTIES = Struct("D2D1_BRUSH_PROPERTIES", [
+    (FLOAT, "opacity"),
+    (D2D1_MATRIX_3X2_F, "transform"),
+])
+
+D2D1_BITMAP_BRUSH_PROPERTIES = Struct("D2D1_BITMAP_BRUSH_PROPERTIES", [
+    (D2D1_EXTEND_MODE, "extendModeX"),
+    (D2D1_EXTEND_MODE, "extendModeY"),
+    (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"),
+])
+
+D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES", [
+    (D2D1_POINT_2F, "startPoint"),
+    (D2D1_POINT_2F, "endPoint"),
+])
+
+D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES", [
+    (D2D1_POINT_2F, "center"),
+    (D2D1_POINT_2F, "gradientOriginOffset"),
+    (FLOAT, "radiusX"),
+    (FLOAT, "radiusY"),
+])
+
+D2D1_ARC_SIZE = Enum("D2D1_ARC_SIZE", [
+    "D2D1_ARC_SIZE_SMALL",
+    "D2D1_ARC_SIZE_LARGE",
+])
+
+D2D1_CAP_STYLE = Enum("D2D1_CAP_STYLE", [
+    "D2D1_CAP_STYLE_FLAT",
+    "D2D1_CAP_STYLE_SQUARE",
+    "D2D1_CAP_STYLE_ROUND",
+    "D2D1_CAP_STYLE_TRIANGLE",
+])
+
+D2D1_DASH_STYLE = Enum("D2D1_DASH_STYLE", [
+    "D2D1_DASH_STYLE_SOLID",
+    "D2D1_DASH_STYLE_DASH",
+    "D2D1_DASH_STYLE_DOT",
+    "D2D1_DASH_STYLE_DASH_DOT",
+    "D2D1_DASH_STYLE_DASH_DOT_DOT",
+    "D2D1_DASH_STYLE_CUSTOM",
+])
+
+D2D1_LINE_JOIN = Enum("D2D1_LINE_JOIN", [
+    "D2D1_LINE_JOIN_MITER",
+    "D2D1_LINE_JOIN_BEVEL",
+    "D2D1_LINE_JOIN_ROUND",
+    "D2D1_LINE_JOIN_MITER_OR_BEVEL",
+])
+
+D2D1_COMBINE_MODE = Enum("D2D1_COMBINE_MODE", [
+    "D2D1_COMBINE_MODE_UNION",
+    "D2D1_COMBINE_MODE_INTERSECT",
+    "D2D1_COMBINE_MODE_XOR",
+    "D2D1_COMBINE_MODE_EXCLUDE",
+])
+
+D2D1_GEOMETRY_RELATION = Enum("D2D1_GEOMETRY_RELATION", [
+    "D2D1_GEOMETRY_RELATION_UNKNOWN",
+    "D2D1_GEOMETRY_RELATION_DISJOINT",
+    "D2D1_GEOMETRY_RELATION_IS_CONTAINED",
+    "D2D1_GEOMETRY_RELATION_CONTAINS",
+    "D2D1_GEOMETRY_RELATION_OVERLAP",
+])
+
+D2D1_GEOMETRY_SIMPLIFICATION_OPTION = Enum("D2D1_GEOMETRY_SIMPLIFICATION_OPTION", [
+    "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES",
+    "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES",
+])
+
+D2D1_FIGURE_BEGIN = Enum("D2D1_FIGURE_BEGIN", [
+    "D2D1_FIGURE_BEGIN_FILLED",
+    "D2D1_FIGURE_BEGIN_HOLLOW",
+])
+
+D2D1_FIGURE_END = Enum("D2D1_FIGURE_END", [
+    "D2D1_FIGURE_END_OPEN",
+    "D2D1_FIGURE_END_CLOSED",
+])
+
+D2D1_BEZIER_SEGMENT = Struct("D2D1_BEZIER_SEGMENT", [
+    (D2D1_POINT_2F, "point1"),
+    (D2D1_POINT_2F, "point2"),
+    (D2D1_POINT_2F, "point3"),
+])
+
+D2D1_TRIANGLE = Struct("D2D1_TRIANGLE", [
+    (D2D1_POINT_2F, "point1"),
+    (D2D1_POINT_2F, "point2"),
+    (D2D1_POINT_2F, "point3"),
+])
+
+D2D1_PATH_SEGMENT = EnumFlag("D2D1_PATH_SEGMENT", [
+    "D2D1_PATH_SEGMENT_NONE",
+    "D2D1_PATH_SEGMENT_FORCE_UNSTROKED",
+    "D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN",
+])
+
+D2D1_SWEEP_DIRECTION = Enum("D2D1_SWEEP_DIRECTION", [
+    "D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE",
+    "D2D1_SWEEP_DIRECTION_CLOCKWISE",
+])
+
+D2D1_FILL_MODE = Enum("D2D1_FILL_MODE", [
+    "D2D1_FILL_MODE_ALTERNATE",
+    "D2D1_FILL_MODE_WINDING",
+])
+
+D2D1_ARC_SEGMENT = Struct("D2D1_ARC_SEGMENT", [
+    (D2D1_POINT_2F, "point"),
+    (D2D1_SIZE_F, "size"),
+    (FLOAT, "rotationAngle"),
+    (D2D1_SWEEP_DIRECTION, "sweepDirection"),
+    (D2D1_ARC_SIZE, "arcSize"),
+])
+
+D2D1_QUADRATIC_BEZIER_SEGMENT = Struct("D2D1_QUADRATIC_BEZIER_SEGMENT", [
+    (D2D1_POINT_2F, "point1"),
+    (D2D1_POINT_2F, "point2"),
+])
+
+D2D1_ELLIPSE = Struct("D2D1_ELLIPSE", [
+    (D2D1_POINT_2F, "point"),
+    (FLOAT, "radiusX"),
+    (FLOAT, "radiusY"),
+])
+
+D2D1_ROUNDED_RECT = Struct("D2D1_ROUNDED_RECT", [
+    (D2D1_RECT_F, "rect"),
+    (FLOAT, "radiusX"),
+    (FLOAT, "radiusY"),
+])
+
+D2D1_STROKE_STYLE_PROPERTIES = Struct("D2D1_STROKE_STYLE_PROPERTIES", [
+    (D2D1_CAP_STYLE, "startCap"),
+    (D2D1_CAP_STYLE, "endCap"),
+    (D2D1_CAP_STYLE, "dashCap"),
+    (D2D1_LINE_JOIN, "lineJoin"),
+    (FLOAT, "miterLimit"),
+    (D2D1_DASH_STYLE, "dashStyle"),
+    (FLOAT, "dashOffset"),
+])
+
+D2D1_LAYER_OPTIONS = EnumFlag("D2D1_LAYER_OPTIONS", [
+    "D2D1_LAYER_OPTIONS_NONE",
+    "D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE",
+])
+
+D2D1_LAYER_PARAMETERS = Struct("D2D1_LAYER_PARAMETERS", [
+    (D2D1_RECT_F, "contentBounds"),
+    (Pointer(ID2D1Geometry), "geometricMask"),
+    (D2D1_ANTIALIAS_MODE, "maskAntialiasMode"),
+    (D2D1_MATRIX_3X2_F, "maskTransform"),
+    (FLOAT, "opacity"),
+    (Pointer(ID2D1Brush), "opacityBrush"),
+    (D2D1_LAYER_OPTIONS, "layerOptions"),
+])
+
+D2D1_WINDOW_STATE = EnumFlag("D2D1_WINDOW_STATE", [
+    "D2D1_WINDOW_STATE_NONE",
+    "D2D1_WINDOW_STATE_OCCLUDED",
+])
+
+D2D1_RENDER_TARGET_TYPE = Enum("D2D1_RENDER_TARGET_TYPE", [
+    "D2D1_RENDER_TARGET_TYPE_DEFAULT",
+    "D2D1_RENDER_TARGET_TYPE_SOFTWARE",
+    "D2D1_RENDER_TARGET_TYPE_HARDWARE",
+])
+
+D2D1_FEATURE_LEVEL = Enum("D2D1_FEATURE_LEVEL", [
+    "D2D1_FEATURE_LEVEL_DEFAULT",
+    "D2D1_FEATURE_LEVEL_9",
+    "D2D1_FEATURE_LEVEL_10",
+])
+
+D2D1_RENDER_TARGET_USAGE = EnumFlag("D2D1_RENDER_TARGET_USAGE", [
+    "D2D1_RENDER_TARGET_USAGE_NONE",
+    "D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING",
+    "D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE",
+])
+
+D2D1_PRESENT_OPTIONS = EnumFlag("D2D1_PRESENT_OPTIONS", [
+    "D2D1_PRESENT_OPTIONS_NONE",
+    "D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS",
+    "D2D1_PRESENT_OPTIONS_IMMEDIATELY",
+])
+
+D2D1_RENDER_TARGET_PROPERTIES = Struct("D2D1_RENDER_TARGET_PROPERTIES", [
+    (D2D1_RENDER_TARGET_TYPE, "type"),
+    (D2D1_PIXEL_FORMAT, "pixelFormat"),
+    (FLOAT, "dpiX"),
+    (FLOAT, "dpiY"),
+    (D2D1_RENDER_TARGET_USAGE, "usage"),
+    (D2D1_FEATURE_LEVEL, "minLevel"),
+])
+
+D2D1_HWND_RENDER_TARGET_PROPERTIES = Struct("D2D1_HWND_RENDER_TARGET_PROPERTIES", [
+    (HWND, "hwnd"),
+    (D2D1_SIZE_U, "pixelSize"),
+    (D2D1_PRESENT_OPTIONS, "presentOptions"),
+])
+
+D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS = EnumFlag("D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS", [
+    "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE",
+    "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE",
+])
+
+D2D1_DRAWING_STATE_DESCRIPTION = Struct("D2D1_DRAWING_STATE_DESCRIPTION", [
+    (D2D1_ANTIALIAS_MODE, "antialiasMode"),
+    (D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode"),
+    (D2D1_TAG, "tag1"),
+    (D2D1_TAG, "tag2"),
+    (D2D1_MATRIX_3X2_F, "transform"),
+])
+
+D2D1_DC_INITIALIZE_MODE = Enum("D2D1_DC_INITIALIZE_MODE", [
+    "D2D1_DC_INITIALIZE_MODE_COPY",
+    "D2D1_DC_INITIALIZE_MODE_CLEAR",
+])
+
+D2D1_DEBUG_LEVEL = Enum("D2D1_DEBUG_LEVEL", [
+    "D2D1_DEBUG_LEVEL_NONE",
+    "D2D1_DEBUG_LEVEL_ERROR",
+    "D2D1_DEBUG_LEVEL_WARNING",
+    "D2D1_DEBUG_LEVEL_INFORMATION",
+])
+
+D2D1_FACTORY_TYPE = Enum("D2D1_FACTORY_TYPE", [
+    "D2D1_FACTORY_TYPE_SINGLE_THREADED",
+    "D2D1_FACTORY_TYPE_MULTI_THREADED",
+])
+
+D2D1_FACTORY_OPTIONS = Struct("D2D1_FACTORY_OPTIONS", [
+    (D2D1_DEBUG_LEVEL, "debugLevel"),
+])
+
+ID2D1Resource.methods += [
+    Method(Void, "GetFactory", [Out(Pointer(Pointer(ID2D1Factory)), "factory")], const=True),
+]
+
+ID2D1Bitmap.methods += [
+    Method(D2D1_SIZE_F, "GetSize", [], const=True),
+    Method(D2D1_SIZE_U, "GetPixelSize", [], const=True),
+    Method(D2D1_PIXEL_FORMAT, "GetPixelFormat", [], const=True),
+    Method(Void, "GetDpi", [Out(Pointer(FLOAT), "dpiX"), Out(Pointer(FLOAT), "dpiY")], const=True),
+    Method(HRESULT, "CopyFromBitmap", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (Pointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
+    Method(HRESULT, "CopyFromRenderTarget", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (Pointer(ID2D1RenderTarget), "renderTarget"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
+    Method(HRESULT, "CopyFromMemory", [(Pointer(Const(D2D1_RECT_U)), "dstRect"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch")]),
+]
+
+ID2D1GradientStopCollection.methods += [
+    Method(UINT32, "GetGradientStopCount", [], const=True),
+    Method(Void, "GetGradientStops", [Out(Pointer(D2D1_GRADIENT_STOP), "gradientStops"), (UINT, "gradientStopsCount")], const=True),
+    Method(D2D1_GAMMA, "GetColorInterpolationGamma", [], const=True),
+    Method(D2D1_EXTEND_MODE, "GetExtendMode", [], const=True),
+]
+
+ID2D1Brush.methods += [
+    Method(Void, "SetOpacity", [(FLOAT, "opacity")]),
+    Method(Void, "SetTransform", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
+    Method(FLOAT, "GetOpacity", [], const=True),
+    Method(Void, "GetTransform", [Out(Pointer(D2D1_MATRIX_3X2_F), "transform")], const=True),
+]
+
+ID2D1BitmapBrush.methods += [
+    Method(Void, "SetExtendModeX", [(D2D1_EXTEND_MODE, "extendModeX")]),
+    Method(Void, "SetExtendModeY", [(D2D1_EXTEND_MODE, "extendModeY")]),
+    Method(Void, "SetInterpolationMode", [(D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode")]),
+    Method(Void, "SetBitmap", [(Pointer(ID2D1Bitmap), "bitmap")]),
+    Method(D2D1_EXTEND_MODE, "GetExtendModeX", [], const=True),
+    Method(D2D1_EXTEND_MODE, "GetExtendModeY", [], const=True),
+    Method(D2D1_BITMAP_INTERPOLATION_MODE, "GetInterpolationMode", [], const=True),
+    Method(Void, "GetBitmap", [Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")], const=True),
+]
+
+ID2D1SolidColorBrush.methods += [
+    Method(Void, "SetColor", [(Pointer(Const(D2D1_COLOR_F)), "color")]),
+    Method(D2D1_COLOR_F, "GetColor", [], const=True),
+]
+
+ID2D1LinearGradientBrush.methods += [
+    Method(Void, "SetStartPoint", [(D2D1_POINT_2F, "startPoint")]),
+    Method(Void, "SetEndPoint", [(D2D1_POINT_2F, "endPoint")]),
+    Method(D2D1_POINT_2F, "GetStartPoint", [], const=True),
+    Method(D2D1_POINT_2F, "GetEndPoint", [], const=True),
+    Method(Void, "GetGradientStopCollection", [Out(Pointer(Pointer(ID2D1GradientStopCollection)), "gradientStopCollection")], const=True),
+]
+
+ID2D1RadialGradientBrush.methods += [
+    Method(Void, "SetCenter", [(D2D1_POINT_2F, "center")]),
+    Method(Void, "SetGradientOriginOffset", [(D2D1_POINT_2F, "gradientOriginOffset")]),
+    Method(Void, "SetRadiusX", [(FLOAT, "radiusX")]),
+    Method(Void, "SetRadiusY", [(FLOAT, "radiusY")]),
+    Method(D2D1_POINT_2F, "GetCenter", [], const=True),
+    Method(D2D1_POINT_2F, "GetGradientOriginOffset", [], const=True),
+    Method(FLOAT, "GetRadiusX", [], const=True),
+    Method(FLOAT, "GetRadiusY", [], const=True),
+    Method(Void, "GetGradientStopCollection", [Out(Pointer(Pointer(ID2D1GradientStopCollection)), "gradientStopCollection")], const=True),
+]
+
+ID2D1StrokeStyle.methods += [
+    Method(D2D1_CAP_STYLE, "GetStartCap", [], const=True),
+    Method(D2D1_CAP_STYLE, "GetEndCap", [], const=True),
+    Method(D2D1_CAP_STYLE, "GetDashCap", [], const=True),
+    Method(FLOAT, "GetMiterLimit", [], const=True),
+    Method(D2D1_LINE_JOIN, "GetLineJoin", [], const=True),
+    Method(FLOAT, "GetDashOffset", [], const=True),
+    Method(D2D1_DASH_STYLE, "GetDashStyle", [], const=True),
+    Method(UINT32, "GetDashesCount", [], const=True),
+    Method(Void, "GetDashes", [Out(Pointer(FLOAT), "dashes"), (UINT, "dashesCount")], const=True),
+]
+
+ID2D1Geometry.methods += [
+    Method(HRESULT, "GetBounds", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), Out(Pointer(D2D1_RECT_F), "bounds")], const=True),
+    Method(HRESULT, "GetWidenedBounds", [(FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_RECT_F), "bounds")], const=True),
+    Method(HRESULT, "StrokeContainsPoint", [(D2D1_POINT_2F, "point"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(BOOL), "contains")], const=True),
+    Method(HRESULT, "FillContainsPoint", [(D2D1_POINT_2F, "point"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(BOOL), "contains")], const=True),
+    Method(HRESULT, "CompareWithGeometry", [(Pointer(ID2D1Geometry), "inputGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_GEOMETRY_RELATION), "relation")], const=True),
+    Method(HRESULT, "Simplify", [(D2D1_GEOMETRY_SIMPLIFICATION_OPTION, "simplificationOption"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "Tessellate", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1TessellationSink), "tessellationSink")], const=True),
+    Method(HRESULT, "CombineWithGeometry", [(Pointer(ID2D1Geometry), "inputGeometry"), (D2D1_COMBINE_MODE, "combineMode"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "Outline", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "ComputeArea", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(FLOAT), "area")], const=True),
+    Method(HRESULT, "ComputeLength", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(FLOAT), "length")], const=True),
+    Method(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),
+    Method(HRESULT, "Widen", [(FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+]
+
+ID2D1RectangleGeometry.methods += [
+    Method(Void, "GetRect", [Out(Pointer(D2D1_RECT_F), "rect")], const=True),
+]
+
+ID2D1RoundedRectangleGeometry.methods += [
+    Method(Void, "GetRoundedRect", [Out(Pointer(D2D1_ROUNDED_RECT), "roundedRect")], const=True),
+]
+
+ID2D1EllipseGeometry.methods += [
+    Method(Void, "GetEllipse", [Out(Pointer(D2D1_ELLIPSE), "ellipse")], const=True),
+]
+
+ID2D1GeometryGroup.methods += [
+    Method(D2D1_FILL_MODE, "GetFillMode", [], const=True),
+    Method(UINT32, "GetSourceGeometryCount", [], const=True),
+    Method(Void, "GetSourceGeometries", [Out(Pointer(Pointer(ID2D1Geometry)), "geometries"), (UINT, "geometriesCount")], const=True),
+]
+
+ID2D1TransformedGeometry.methods += [
+    Method(Void, "GetSourceGeometry", [Out(Pointer(Pointer(ID2D1Geometry)), "sourceGeometry")], const=True),
+    Method(Void, "GetTransform", [Out(Pointer(D2D1_MATRIX_3X2_F), "transform")], const=True),
+]
+
+ID2D1SimplifiedGeometrySink.methods += [
+    Method(Void, "SetFillMode", [(D2D1_FILL_MODE, "fillMode")]),
+    Method(Void, "SetSegmentFlags", [(D2D1_PATH_SEGMENT, "vertexFlags")]),
+    Method(Void, "BeginFigure", [(D2D1_POINT_2F, "startPoint"), (D2D1_FIGURE_BEGIN, "figureBegin")]),
+    Method(Void, "AddLines", [(Pointer(Const(D2D1_POINT_2F)), "points"), (UINT, "pointsCount")]),
+    Method(Void, "AddBeziers", [(Pointer(Const(D2D1_BEZIER_SEGMENT)), "beziers"), (UINT, "beziersCount")]),
+    Method(Void, "EndFigure", [(D2D1_FIGURE_END, "figureEnd")]),
+    Method(HRESULT, "Close", []),
+]
+
+ID2D1GeometrySink.methods += [
+    Method(Void, "AddLine", [(D2D1_POINT_2F, "point")]),
+    Method(Void, "AddBezier", [(Pointer(Const(D2D1_BEZIER_SEGMENT)), "bezier")]),
+    Method(Void, "AddQuadraticBezier", [(Pointer(Const(D2D1_QUADRATIC_BEZIER_SEGMENT)), "bezier")]),
+    Method(Void, "AddQuadraticBeziers", [(Pointer(Const(D2D1_QUADRATIC_BEZIER_SEGMENT)), "beziers"), (UINT, "beziersCount")]),
+    Method(Void, "AddArc", [(Pointer(Const(D2D1_ARC_SEGMENT)), "arc")]),
+]
+
+ID2D1TessellationSink.methods += [
+    Method(Void, "AddTriangles", [(Pointer(Const(D2D1_TRIANGLE)), "triangles"), (UINT, "trianglesCount")]),
+    Method(HRESULT, "Close", []),
+]
+
+ID2D1PathGeometry.methods += [
+    Method(HRESULT, "Open", [Out(Pointer(Pointer(ID2D1GeometrySink)), "geometrySink")]),
+    Method(HRESULT, "Stream", [(Pointer(ID2D1GeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "GetSegmentCount", [Out(Pointer(UINT32), "count")], const=True),
+    Method(HRESULT, "GetFigureCount", [Out(Pointer(UINT32), "count")], const=True),
+]
+
+ID2D1Mesh.methods += [
+    Method(HRESULT, "Open", [Out(Pointer(Pointer(ID2D1TessellationSink)), "tessellationSink")]),
+]
+
+ID2D1Layer.methods += [
+    Method(D2D1_SIZE_F, "GetSize", [], const=True),
+]
+
+ID2D1DrawingStateBlock.methods += [
+    Method(Void, "GetDescription", [Out(Pointer(D2D1_DRAWING_STATE_DESCRIPTION), "stateDescription")], const=True),
+    Method(Void, "SetDescription", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "stateDescription")]),
+    Method(Void, "SetTextRenderingParams", [(Pointer(IDWriteRenderingParams), "textRenderingParams")]),
+    Method(Void, "GetTextRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
+]
+
+ID2D1RenderTarget.methods += [
+    Method(HRESULT, "CreateBitmap", [(D2D1_SIZE_U, "size"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateBitmapFromWicBitmap", [(Opaque("IWICBitmapSource *"), "wicBitmapSource"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateSharedBitmap", [(REFIID, "riid"), Out(OpaquePointer(Void), "data"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateBitmapBrush", [(Pointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_BITMAP_BRUSH_PROPERTIES)), "bitmapBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(Pointer(ID2D1BitmapBrush)), "bitmapBrush")]),
+    Method(HRESULT, "CreateSolidColorBrush", [(Pointer(Const(D2D1_COLOR_F)), "color"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(Pointer(ID2D1SolidColorBrush)), "solidColorBrush")]),
+    Method(HRESULT, "CreateGradientStopCollection", [(Pointer(Const(D2D1_GRADIENT_STOP)), "gradientStops"), (UINT, "gradientStopsCount"), (D2D1_GAMMA, "colorInterpolationGamma"), (D2D1_EXTEND_MODE, "extendMode"), Out(Pointer(Pointer(ID2D1GradientStopCollection)), "gradientStopCollection")]),
+    Method(HRESULT, "CreateLinearGradientBrush", [(Pointer(Const(D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)), "linearGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (Pointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(Pointer(ID2D1LinearGradientBrush)), "linearGradientBrush")]),
+    Method(HRESULT, "CreateRadialGradientBrush", [(Pointer(Const(D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES)), "radialGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (Pointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(Pointer(ID2D1RadialGradientBrush)), "radialGradientBrush")]),
+    Method(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(Pointer(ID2D1BitmapRenderTarget)), "bitmapRenderTarget")]),
+    Method(HRESULT, "CreateLayer", [(Pointer(Const(D2D1_SIZE_F)), "size"), Out(Pointer(Pointer(ID2D1Layer)), "layer")]),
+    Method(HRESULT, "CreateMesh", [Out(Pointer(Pointer(ID2D1Mesh)), "mesh")]),
+    Method(Void, "DrawLine", [(D2D1_POINT_2F, "point0"), (D2D1_POINT_2F, "point1"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "DrawRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (Pointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (Pointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (Pointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawGeometry", [(Pointer(ID2D1Geometry), "geometry"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillGeometry", [(Pointer(ID2D1Geometry), "geometry"), (Pointer(ID2D1Brush), "brush"), (Pointer(ID2D1Brush), "opacityBrush")]),
+    Method(Void, "FillMesh", [(Pointer(ID2D1Mesh), "mesh"), (Pointer(ID2D1Brush), "brush")]),
+    Method(Void, "FillOpacityMask", [(Pointer(ID2D1Bitmap), "opacityMask"), (Pointer(ID2D1Brush), "brush"), (D2D1_OPACITY_MASK_CONTENT, "content"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
+    Method(Void, "DrawBitmap", [(Pointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (FLOAT, "opacity"), (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
+    Method(Void, "DrawText", [(Pointer(Const(WCHAR)), "string"), (UINT, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (Pointer(Const(D2D1_RECT_F)), "layoutRect"), (Pointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options"), (DWRITE_MEASURING_MODE, "measuringMode")]),
+    Method(Void, "DrawTextLayout", [(D2D1_POINT_2F, "origin"), (Pointer(IDWriteTextLayout), "textLayout"), (Pointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options")]),
+    Method(Void, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(ID2D1Brush), "foregroundBrush"), (DWRITE_MEASURING_MODE, "measuringMode")]),
+    Method(Void, "SetTransform", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
+    Method(Void, "GetTransform", [Out(Pointer(D2D1_MATRIX_3X2_F), "transform")], const=True),
+    Method(Void, "SetAntialiasMode", [(D2D1_ANTIALIAS_MODE, "antialiasMode")]),
+    Method(D2D1_ANTIALIAS_MODE, "GetAntialiasMode", [], const=True),
+    Method(Void, "SetTextAntialiasMode", [(D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode")]),
+    Method(D2D1_TEXT_ANTIALIAS_MODE, "GetTextAntialiasMode", [], const=True),
+    Method(Void, "SetTextRenderingParams", [(Pointer(IDWriteRenderingParams), "textRenderingParams")]),
+    Method(Void, "GetTextRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
+    Method(Void, "SetTags", [(D2D1_TAG, "tag1"), (D2D1_TAG, "tag2")]),
+    Method(Void, "GetTags", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")], const=True),
+    Method(Void, "PushLayer", [(Pointer(Const(D2D1_LAYER_PARAMETERS)), "layerParameters"), (Pointer(ID2D1Layer), "layer")]),
+    Method(Void, "PopLayer", []),
+    Method(HRESULT, "Flush", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")]),
+    Method(Void, "SaveDrawingState", [Out(Pointer(ID2D1DrawingStateBlock), "drawingStateBlock")], const=True),
+    Method(Void, "RestoreDrawingState", [(Pointer(ID2D1DrawingStateBlock), "drawingStateBlock")]),
+    Method(Void, "PushAxisAlignedClip", [(Pointer(Const(D2D1_RECT_F)), "clipRect"), (D2D1_ANTIALIAS_MODE, "antialiasMode")]),
+    Method(Void, "PopAxisAlignedClip", []),
+    Method(Void, "Clear", [(Pointer(Const(D2D1_COLOR_F)), "clearColor")]),
+    Method(Void, "BeginDraw", []),
+    Method(HRESULT, "EndDraw", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")]),
+    Method(D2D1_PIXEL_FORMAT, "GetPixelFormat", [], const=True),
+    Method(Void, "SetDpi", [(FLOAT, "dpiX"), (FLOAT, "dpiY")]),
+    Method(Void, "GetDpi", [Out(Pointer(FLOAT), "dpiX"), Out(Pointer(FLOAT), "dpiY")], const=True),
+    Method(D2D1_SIZE_F, "GetSize", [], const=True),
+    Method(D2D1_SIZE_U, "GetPixelSize", [], const=True),
+    Method(UINT32, "GetMaximumBitmapSize", [], const=True),
+    Method(BOOL, "IsSupported", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties")], const=True),
+]
+
+ID2D1BitmapRenderTarget.methods += [
+    Method(HRESULT, "GetBitmap", [Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
+]
+
+ID2D1HwndRenderTarget.methods += [
+    Method(D2D1_WINDOW_STATE, "CheckWindowState", []),
+    Method(HRESULT, "Resize", [(Pointer(Const(D2D1_SIZE_U)), "pixelSize")]),
+    Method(HWND, "GetHwnd", [], const=True),
+]
+
+ID2D1GdiInteropRenderTarget.methods += [
+    Method(HRESULT, "GetDC", [(D2D1_DC_INITIALIZE_MODE, "mode"), Out(Pointer(HDC), "hdc")]),
+    Method(HRESULT, "ReleaseDC", [(Pointer(Const(RECT)), "update")]),
+]
+
+ID2D1DCRenderTarget.methods += [
+    Method(HRESULT, "BindDC", [(Const(HDC), "hDC"), (Pointer(Const(RECT)), "pSubRect")]),
+]
+
+ID2D1Factory.methods += [
+    Method(HRESULT, "ReloadSystemMetrics", []),
+    Method(Void, "GetDesktopDpi", [Out(Pointer(FLOAT), "dpiX"), Out(Pointer(FLOAT), "dpiY")]),
+    Method(HRESULT, "CreateRectangleGeometry", [(Pointer(Const(D2D1_RECT_F)), "rectangle"), Out(Pointer(Pointer(ID2D1RectangleGeometry)), "rectangleGeometry")]),
+    Method(HRESULT, "CreateRoundedRectangleGeometry", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRectangle"), Out(Pointer(Pointer(ID2D1RoundedRectangleGeometry)), "roundedRectangleGeometry")]),
+    Method(HRESULT, "CreateEllipseGeometry", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), Out(Pointer(Pointer(ID2D1EllipseGeometry)), "ellipseGeometry")]),
+    Method(HRESULT, "CreateGeometryGroup", [(D2D1_FILL_MODE, "fillMode"), (Pointer(Pointer(ID2D1Geometry)), "geometries"), (UINT, "geometriesCount"), Out(Pointer(Pointer(ID2D1GeometryGroup)), "geometryGroup")]),
+    Method(HRESULT, "CreateTransformedGeometry", [(Pointer(ID2D1Geometry), "sourceGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "transform"), Out(Pointer(Pointer(ID2D1TransformedGeometry)), "transformedGeometry")]),
+    Method(HRESULT, "CreatePathGeometry", [Out(Pointer(Pointer(ID2D1PathGeometry)), "pathGeometry")]),
+    Method(HRESULT, "CreateStrokeStyle", [(Pointer(Const(D2D1_STROKE_STYLE_PROPERTIES)), "strokeStyleProperties"), (Pointer(Const(FLOAT)), "dashes"), (UINT, "dashesCount"), Out(Pointer(Pointer(ID2D1StrokeStyle)), "strokeStyle")]),
+    Method(HRESULT, "CreateDrawingStateBlock", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "drawingStateDescription"), (Pointer(IDWriteRenderingParams), "textRenderingParams"), Out(Pointer(Pointer(ID2D1DrawingStateBlock)), "drawingStateBlock")]),
+    Method(HRESULT, "CreateWicBitmapRenderTarget", [(Opaque("IWICBitmap *"), "target"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(Pointer(ID2D1RenderTarget)), "renderTarget")]),
+    Method(HRESULT, "CreateHwndRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), (Pointer(Const(D2D1_HWND_RENDER_TARGET_PROPERTIES)), "hwndRenderTargetProperties"), Out(Pointer(Pointer(ID2D1HwndRenderTarget)), "hwndRenderTarget")]),
+    Method(HRESULT, "CreateDxgiSurfaceRenderTarget", [(Pointer(IDXGISurface), "dxgiSurface"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(Pointer(ID2D1RenderTarget)), "renderTarget")]),
+    Method(HRESULT, "CreateDCRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(Pointer(ID2D1DCRenderTarget)), "dcRenderTarget")]),
+]
+
+d2d1 = API("d2d1")
+d2d1.add_interface(ID2D1Factory)
+d2d1.add_functions([
+    StdFunction(HRESULT, "D2D1CreateFactory", [(D2D1_FACTORY_TYPE, "factoryType"), (REFIID, "riid"), (Pointer(Const(D2D1_FACTORY_OPTIONS)), "pFactoryOptions"), Out(Pointer(OpaquePointer(Void)), "ppIFactory")]),
+    StdFunction(Void, "D2D1MakeRotateMatrix", [(FLOAT, "angle"), (D2D1_POINT_2F, "center"), Out(Pointer(D2D1_MATRIX_3X2_F), "matrix")]),
+    StdFunction(Void, "D2D1MakeSkewMatrix", [(FLOAT, "angleX"), (FLOAT, "angleY"), (D2D1_POINT_2F, "center"), Out(Pointer(D2D1_MATRIX_3X2_F), "matrix")]),
+    StdFunction(BOOL, "D2D1IsMatrixInvertible", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "matrix")]),
+    StdFunction(BOOL, "D2D1InvertMatrix", [Out(Pointer(D2D1_MATRIX_3X2_F), "matrix")]),
+])
diff --git a/specs/d2dbasetypes.py b/specs/d2dbasetypes.py
new file mode 100644 (file)
index 0000000..86ba794
--- /dev/null
@@ -0,0 +1,80 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+
+
+D3DCOLORVALUE = Struct("D3DCOLORVALUE", [
+    (FLOAT, "r"),
+    (FLOAT, "g"),
+    (FLOAT, "b"),
+    (FLOAT, "a"),
+])
+
+D2D_POINT_2U = Struct("D2D_POINT_2U", [
+    (UINT32, "x"),
+    (UINT32, "y"),
+])
+
+D2D_POINT_2F = Struct("D2D_POINT_2F", [
+    (FLOAT, "x"),
+    (FLOAT, "y"),
+])
+
+D2D_RECT_F = Struct("D2D_RECT_F", [
+    (FLOAT, "left"),
+    (FLOAT, "top"),
+    (FLOAT, "right"),
+    (FLOAT, "bottom"),
+])
+
+D2D_RECT_U = Struct("D2D_RECT_U", [
+    (UINT32, "left"),
+    (UINT32, "top"),
+    (UINT32, "right"),
+    (UINT32, "bottom"),
+])
+
+D2D_SIZE_F = Struct("D2D_SIZE_F", [
+    (FLOAT, "width"),
+    (FLOAT, "height"),
+])
+
+D2D_SIZE_U = Struct("D2D_SIZE_U", [
+    (UINT32, "width"),
+    (UINT32, "height"),
+])
+
+D2D_COLOR_F = Alias("D2D_COLOR_F", D3DCOLORVALUE)
+D2D_MATRIX_3X2_F = Struct("D2D_MATRIX_3X2_F", [
+    (FLOAT, "_11"),
+    (FLOAT, "_12"),
+    (FLOAT, "_21"),
+    (FLOAT, "_22"),
+    (FLOAT, "_31"),
+    (FLOAT, "_32"),
+])
+
diff --git a/specs/d2derr.py b/specs/d2derr.py
new file mode 100644 (file)
index 0000000..35898ac
--- /dev/null
@@ -0,0 +1,62 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+
+
+HRESULT = Enum("HRESULT", [
+    "D2DERR_UNSUPPORTED_PIXEL_FORMAT",
+    "D2DERR_INSUFFICIENT_BUFFER",
+    "D2DERR_WRONG_STATE",
+    "D2DERR_NOT_INITIALIZED",
+    "D2DERR_UNSUPPORTED_OPERATION",
+    "D2DERR_SCANNER_FAILED",
+    "D2DERR_SCREEN_ACCESS_DENIED",
+    "D2DERR_DISPLAY_STATE_INVALID",
+    "D2DERR_ZERO_VECTOR",
+    "D2DERR_INTERNAL_ERROR",
+    "D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED",
+    "D2DERR_INVALID_CALL",
+    "D2DERR_NO_HARDWARE_DEVICE",
+    "D2DERR_RECREATE_TARGET",
+    "D2DERR_TOO_MANY_SHADER_ELEMENTS",
+    "D2DERR_SHADER_COMPILE_FAILED",
+    "D2DERR_MAX_TEXTURE_SIZE_EXCEEDED",
+    "D2DERR_UNSUPPORTED_VERSION",
+    "D2DERR_BAD_NUMBER",
+    "D2DERR_WRONG_FACTORY",
+    "D2DERR_LAYER_ALREADY_IN_USE",
+    "D2DERR_POP_CALL_DID_NOT_MATCH_PUSH",
+    "D2DERR_WRONG_RENDER_TARGET",
+    "D2DERR_PUSH_POP_UNBALANCED",
+    "D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT",
+    "D2DERR_INCOMPATIBLE_BRUSH_TYPES",
+    "D2DERR_WIN32_ERROR",
+    "D2DERR_TARGET_NOT_GDI_COMPATIBLE",
+    "D2DERR_TEXT_EFFECT_IS_WRONG_TYPE",
+    "D2DERR_TEXT_RENDERER_NOT_RELEASED",
+    "D2DERR_EXCEEDS_MAX_BITMAP_SIZE",
+])
diff --git a/specs/dcommon.py b/specs/dcommon.py
new file mode 100644 (file)
index 0000000..21659a5
--- /dev/null
@@ -0,0 +1,34 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+
+
+DWRITE_MEASURING_MODE = Enum("DWRITE_MEASURING_MODE", [
+    "DWRITE_MEASURING_MODE_NATURAL",
+    "DWRITE_MEASURING_MODE_GDI_CLASSIC",
+    "DWRITE_MEASURING_MODE_GDI_NATURAL",
+])
diff --git a/specs/dwrite.py b/specs/dwrite.py
new file mode 100644 (file)
index 0000000..f7d284b
--- /dev/null
@@ -0,0 +1,772 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+from dcommon import *
+
+
+ID2D1SimplifiedGeometrySink = Interface("ID2D1SimplifiedGeometrySink", IUnknown)
+IDWriteGeometrySink = Alias("IDWriteGeometrySink", ID2D1SimplifiedGeometrySink)
+
+IDWriteFontFileLoader = Interface("IDWriteFontFileLoader", IUnknown)
+IDWriteLocalFontFileLoader = Interface("IDWriteLocalFontFileLoader", IDWriteFontFileLoader)
+IDWriteFontFileStream = Interface("IDWriteFontFileStream", IUnknown)
+IDWriteFontFile = Interface("IDWriteFontFile", IUnknown)
+IDWriteRenderingParams = Interface("IDWriteRenderingParams", IUnknown)
+IDWriteFontFace = Interface("IDWriteFontFace", IUnknown)
+IDWriteFontCollectionLoader = Interface("IDWriteFontCollectionLoader", IUnknown)
+IDWriteFontFileEnumerator = Interface("IDWriteFontFileEnumerator", IUnknown)
+IDWriteLocalizedStrings = Interface("IDWriteLocalizedStrings", IUnknown)
+IDWriteFontCollection = Interface("IDWriteFontCollection", IUnknown)
+IDWriteFontList = Interface("IDWriteFontList", IUnknown)
+IDWriteFontFamily = Interface("IDWriteFontFamily", IDWriteFontList)
+IDWriteFont = Interface("IDWriteFont", IUnknown)
+IDWriteTextFormat = Interface("IDWriteTextFormat", IUnknown)
+IDWriteTypography = Interface("IDWriteTypography", IUnknown)
+IDWriteNumberSubstitution = Interface("IDWriteNumberSubstitution", IUnknown)
+IDWriteTextAnalysisSource = Interface("IDWriteTextAnalysisSource", IUnknown)
+IDWriteTextAnalysisSink = Interface("IDWriteTextAnalysisSink", IUnknown)
+IDWriteTextAnalyzer = Interface("IDWriteTextAnalyzer", IUnknown)
+IDWriteInlineObject = Interface("IDWriteInlineObject", IUnknown)
+IDWritePixelSnapping = Interface("IDWritePixelSnapping", IUnknown)
+IDWriteTextRenderer = Interface("IDWriteTextRenderer", IDWritePixelSnapping)
+IDWriteTextLayout = Interface("IDWriteTextLayout", IDWriteTextFormat)
+IDWriteBitmapRenderTarget = Interface("IDWriteBitmapRenderTarget", IUnknown)
+IDWriteGdiInterop = Interface("IDWriteGdiInterop", IUnknown)
+IDWriteGlyphRunAnalysis = Interface("IDWriteGlyphRunAnalysis", IUnknown)
+IDWriteFactory = Interface("IDWriteFactory", IUnknown)
+
+
+def EnumFlag(expr, values):
+    return Flags(Alias(expr, DWORD), values)
+
+
+DWRITE_FONT_FILE_TYPE = Enum("DWRITE_FONT_FILE_TYPE", [
+    "DWRITE_FONT_FILE_TYPE_UNKNOWN",
+    "DWRITE_FONT_FILE_TYPE_CFF",
+    "DWRITE_FONT_FILE_TYPE_TRUETYPE",
+    "DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION",
+    "DWRITE_FONT_FILE_TYPE_TYPE1_PFM",
+    "DWRITE_FONT_FILE_TYPE_TYPE1_PFB",
+    "DWRITE_FONT_FILE_TYPE_VECTOR",
+    "DWRITE_FONT_FILE_TYPE_BITMAP",
+])
+
+DWRITE_FONT_FACE_TYPE = Enum("DWRITE_FONT_FACE_TYPE", [
+    "DWRITE_FONT_FACE_TYPE_CFF",
+    "DWRITE_FONT_FACE_TYPE_TRUETYPE",
+    "DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION",
+    "DWRITE_FONT_FACE_TYPE_TYPE1",
+    "DWRITE_FONT_FACE_TYPE_VECTOR",
+    "DWRITE_FONT_FACE_TYPE_BITMAP",
+    "DWRITE_FONT_FACE_TYPE_UNKNOWN",
+])
+
+DWRITE_FONT_SIMULATIONS = EnumFlag("DWRITE_FONT_SIMULATIONS", [
+    "DWRITE_FONT_SIMULATIONS_NONE",
+    "DWRITE_FONT_SIMULATIONS_BOLD",
+    "DWRITE_FONT_SIMULATIONS_OBLIQUE",
+])
+
+DWRITE_FONT_WEIGHT = Enum("DWRITE_FONT_WEIGHT", [
+    "DWRITE_FONT_WEIGHT_THIN",
+    "DWRITE_FONT_WEIGHT_EXTRA_LIGHT",
+    #"DWRITE_FONT_WEIGHT_ULTRA_LIGHT",
+    "DWRITE_FONT_WEIGHT_LIGHT",
+    "DWRITE_FONT_WEIGHT_NORMAL",
+    #"DWRITE_FONT_WEIGHT_REGULAR",
+    "DWRITE_FONT_WEIGHT_MEDIUM",
+    "DWRITE_FONT_WEIGHT_DEMI_BOLD",
+    #"DWRITE_FONT_WEIGHT_SEMI_BOLD",
+    "DWRITE_FONT_WEIGHT_BOLD",
+    "DWRITE_FONT_WEIGHT_EXTRA_BOLD",
+    #"DWRITE_FONT_WEIGHT_ULTRA_BOLD",
+    "DWRITE_FONT_WEIGHT_BLACK",
+    #"DWRITE_FONT_WEIGHT_HEAVY",
+    "DWRITE_FONT_WEIGHT_EXTRA_BLACK",
+    #"DWRITE_FONT_WEIGHT_ULTRA_BLACK",
+])
+
+DWRITE_FONT_STRETCH = Enum("DWRITE_FONT_STRETCH", [
+    "DWRITE_FONT_STRETCH_UNDEFINED",
+    "DWRITE_FONT_STRETCH_ULTRA_CONDENSED",
+    "DWRITE_FONT_STRETCH_EXTRA_CONDENSED",
+    "DWRITE_FONT_STRETCH_CONDENSED",
+    "DWRITE_FONT_STRETCH_SEMI_CONDENSED",
+    "DWRITE_FONT_STRETCH_NORMAL",
+    #"DWRITE_FONT_STRETCH_MEDIUM",
+    "DWRITE_FONT_STRETCH_SEMI_EXPANDED",
+    "DWRITE_FONT_STRETCH_EXPANDED",
+    "DWRITE_FONT_STRETCH_EXTRA_EXPANDED",
+    "DWRITE_FONT_STRETCH_ULTRA_EXPANDED",
+])
+
+DWRITE_FONT_STYLE = Enum("DWRITE_FONT_STYLE", [
+    "DWRITE_FONT_STYLE_NORMAL",
+    "DWRITE_FONT_STYLE_OBLIQUE",
+    "DWRITE_FONT_STYLE_ITALIC",
+])
+
+DWRITE_INFORMATIONAL_STRING_ID = Enum("DWRITE_INFORMATIONAL_STRING_ID", [
+    "DWRITE_INFORMATIONAL_STRING_NONE",
+    "DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE",
+    "DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS",
+    "DWRITE_INFORMATIONAL_STRING_TRADEMARK",
+    "DWRITE_INFORMATIONAL_STRING_MANUFACTURER",
+    "DWRITE_INFORMATIONAL_STRING_DESIGNER",
+    "DWRITE_INFORMATIONAL_STRING_DESIGNER_URL",
+    "DWRITE_INFORMATIONAL_STRING_DESCRIPTION",
+    "DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL",
+    "DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION",
+    "DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL",
+    "DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES",
+    "DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES",
+    "DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES",
+    "DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES",
+    "DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT",
+])
+
+DWRITE_FONT_METRICS = Struct("DWRITE_FONT_METRICS", [
+    (UINT16, "designUnitsPerEm"),
+    (UINT16, "ascent"),
+    (UINT16, "descent"),
+    (INT16, "lineGap"),
+    (UINT16, "capHeight"),
+    (UINT16, "xHeight"),
+    (INT16, "underlinePosition"),
+    (UINT16, "underlineThickness"),
+    (INT16, "strikethroughPosition"),
+    (UINT16, "strikethroughThickness"),
+])
+
+DWRITE_GLYPH_METRICS = Struct("DWRITE_GLYPH_METRICS", [
+    (INT32, "leftSideBearing"),
+    (UINT32, "advanceWidth"),
+    (INT32, "rightSideBearing"),
+    (INT32, "topSideBearing"),
+    (UINT32, "advanceHeight"),
+    (INT32, "bottomSideBearing"),
+    (INT32, "verticalOriginY"),
+])
+
+DWRITE_GLYPH_OFFSET = Struct("DWRITE_GLYPH_OFFSET", [
+    (FLOAT, "advanceOffset"),
+    (FLOAT, "ascenderOffset"),
+])
+
+DWRITE_FACTORY_TYPE = Enum("DWRITE_FACTORY_TYPE", [
+    "DWRITE_FACTORY_TYPE_SHARED",
+    "DWRITE_FACTORY_TYPE_ISOLATED",
+])
+
+IDWriteFontFileLoader.methods += [
+    Method(HRESULT, "CreateStreamFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(Pointer(IDWriteFontFileStream)), "fontFileStream")]),
+]
+
+IDWriteLocalFontFileLoader.methods += [
+    Method(HRESULT, "GetFilePathLengthFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(UINT32), "filePathLength")]),
+    Method(HRESULT, "GetFilePathFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(WCHAR), "filePath"), (UINT32, "filePathSize")]),
+    Method(HRESULT, "GetLastWriteTimeFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(FILETIME), "lastWriteTime")]),
+]
+
+IDWriteFontFileStream.methods += [
+    Method(HRESULT, "ReadFileFragment", [Out(Pointer(OpaquePointer(Const(Void))), "fragmentStart"), (UINT64, "fileOffset"), (UINT64, "fragmentSize"), Out(Pointer(OpaquePointer(Void)), "fragmentContext")]),
+    Method(Void, "ReleaseFileFragment", [(OpaquePointer(Void), "fragmentContext")]),
+    Method(HRESULT, "GetFileSize", [Out(Pointer(UINT64), "fileSize")]),
+    Method(HRESULT, "GetLastWriteTime", [Out(Pointer(UINT64), "lastWriteTime")]),
+]
+
+IDWriteFontFile.methods += [
+    Method(HRESULT, "GetReferenceKey", [Out(Pointer(OpaquePointer(Const(Void))), "fontFileReferenceKey"), Out(Pointer(UINT32), "fontFileReferenceKeySize")]),
+    Method(HRESULT, "GetLoader", [Out(Pointer(Pointer(IDWriteFontFileLoader)), "fontFileLoader")]),
+    Method(HRESULT, "Analyze", [Out(Pointer(BOOL), "isSupportedFontType"), Out(Pointer(DWRITE_FONT_FILE_TYPE), "fontFileType"), Out(Pointer(DWRITE_FONT_FACE_TYPE), "fontFaceType"), Out(Pointer(UINT32), "numberOfFaces")]),
+]
+
+DWRITE_PIXEL_GEOMETRY = Enum("DWRITE_PIXEL_GEOMETRY", [
+    "DWRITE_PIXEL_GEOMETRY_FLAT",
+    "DWRITE_PIXEL_GEOMETRY_RGB",
+    "DWRITE_PIXEL_GEOMETRY_BGR",
+])
+
+DWRITE_RENDERING_MODE = Enum("DWRITE_RENDERING_MODE", [
+    "DWRITE_RENDERING_MODE_DEFAULT",
+    "DWRITE_RENDERING_MODE_ALIASED",
+    "DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC",
+    "DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL",
+    "DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL",
+    "DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC",
+    "DWRITE_RENDERING_MODE_OUTLINE",
+])
+
+DWRITE_MATRIX = Struct("DWRITE_MATRIX", [
+    (FLOAT, "m11"),
+    (FLOAT, "m12"),
+    (FLOAT, "m21"),
+    (FLOAT, "m22"),
+    (FLOAT, "dx"),
+    (FLOAT, "dy"),
+])
+
+IDWriteRenderingParams.methods += [
+    Method(FLOAT, "GetGamma", []),
+    Method(FLOAT, "GetEnhancedContrast", []),
+    Method(FLOAT, "GetClearTypeLevel", []),
+    Method(DWRITE_PIXEL_GEOMETRY, "GetPixelGeometry", []),
+    Method(DWRITE_RENDERING_MODE, "GetRenderingMode", []),
+]
+
+IDWriteFontFace.methods += [
+    Method(DWRITE_FONT_FACE_TYPE, "GetType", []),
+    Method(HRESULT, "GetFiles", [(OpaquePointer(UINT32), "numberOfFiles"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFiles")]),
+    Method(UINT32, "GetIndex", []),
+    Method(DWRITE_FONT_SIMULATIONS, "GetSimulations", []),
+    Method(BOOL, "IsSymbolFont", []),
+    Method(Void, "GetMetrics", [Out(Pointer(DWRITE_FONT_METRICS), "fontFaceMetrics")]),
+    Method(UINT16, "GetGlyphCount", []),
+    Method(HRESULT, "GetDesignGlyphMetrics", [(Pointer(Const(UINT16)), "glyphIndices"), (UINT32, "glyphCount"), Out(Pointer(DWRITE_GLYPH_METRICS), "glyphMetrics"), (BOOL, "isSideways")]),
+    Method(HRESULT, "GetGlyphIndices", [(Pointer(Const(UINT32)), "codePoints"), (UINT32, "codePointCount"), Out(Pointer(UINT16), "glyphIndices")]),
+    Method(HRESULT, "TryGetFontTable", [(UINT32, "openTypeTableTag"), Out(Pointer(OpaquePointer(Const(Void))), "tableData"), Out(Pointer(UINT32), "tableSize"), Out(Pointer(OpaquePointer(Void)), "tableContext"), Out(Pointer(BOOL), "exists")]),
+    Method(Void, "ReleaseFontTable", [(OpaquePointer(Void), "tableContext")]),
+    Method(HRESULT, "GetGlyphRunOutline", [(FLOAT, "emSize"), (Pointer(Const(UINT16)), "glyphIndices"), (Pointer(Const(FLOAT)), "glyphAdvances"), (Pointer(Const(DWRITE_GLYPH_OFFSET)), "glyphOffsets"), (UINT32, "glyphCount"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IDWriteGeometrySink), "geometrySink")]),
+    Method(HRESULT, "GetRecommendedRenderingMode", [(FLOAT, "emSize"), (FLOAT, "pixelsPerDip"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(DWRITE_RENDERING_MODE), "renderingMode")]),
+]
+
+IDWriteFontCollectionLoader.methods += [
+    Method(HRESULT, "CreateEnumeratorFromKey", [(Pointer(IDWriteFactory), "factory"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(Pointer(IDWriteFontFileEnumerator)), "fontFileEnumerator")]),
+]
+
+IDWriteFontFileEnumerator.methods += [
+    Method(HRESULT, "MoveNext", [Out(Pointer(BOOL), "hasCurrentFile")]),
+    Method(HRESULT, "GetCurrentFontFile", [Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
+]
+
+IDWriteLocalizedStrings.methods += [
+    Method(UINT32, "GetCount", []),
+    Method(HRESULT, "FindLocaleName", [(Pointer(Const(WCHAR)), "localeName"), Out(Pointer(UINT32), "index"), Out(Pointer(BOOL), "exists")]),
+    Method(HRESULT, "GetLocaleNameLength", [(UINT32, "index"), Out(Pointer(UINT32), "length")]),
+    Method(HRESULT, "GetLocaleName", [(UINT32, "index"), Out(Pointer(WCHAR), "localeName"), (UINT32, "size")]),
+    Method(HRESULT, "GetStringLength", [(UINT32, "index"), Out(Pointer(UINT32), "length")]),
+    Method(HRESULT, "GetString", [(UINT32, "index"), Out(Pointer(WCHAR), "stringBuffer"), (UINT32, "size")]),
+]
+
+IDWriteFontCollection.methods += [
+    Method(UINT32, "GetFontFamilyCount", []),
+    Method(HRESULT, "GetFontFamily", [(UINT32, "index"), Out(Pointer(Pointer(IDWriteFontFamily)), "fontFamily")]),
+    Method(HRESULT, "FindFamilyName", [(Pointer(Const(WCHAR)), "familyName"), Out(Pointer(UINT32), "index"), Out(Pointer(BOOL), "exists")]),
+    Method(HRESULT, "GetFontFromFontFace", [(Pointer(IDWriteFontFace), "fontFace"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
+]
+
+IDWriteFontList.methods += [
+    Method(HRESULT, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
+    Method(UINT32, "GetFontCount", []),
+    Method(HRESULT, "GetFont", [(UINT32, "index"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
+]
+
+IDWriteFontFamily.methods += [
+    Method(HRESULT, "GetFamilyNames", [Out(Pointer(Pointer(IDWriteLocalizedStrings)), "names")]),
+    Method(HRESULT, "GetFirstMatchingFont", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(Pointer(IDWriteFont)), "matchingFont")]),
+    Method(HRESULT, "GetMatchingFonts", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(Pointer(IDWriteFontList)), "matchingFonts")]),
+]
+
+IDWriteFont.methods += [
+    Method(HRESULT, "GetFontFamily", [Out(Pointer(Pointer(IDWriteFontFamily)), "fontFamily")]),
+    Method(DWRITE_FONT_WEIGHT, "GetWeight", []),
+    Method(DWRITE_FONT_STRETCH, "GetStretch", []),
+    Method(DWRITE_FONT_STYLE, "GetStyle", []),
+    Method(BOOL, "IsSymbolFont", []),
+    Method(HRESULT, "GetFaceNames", [Out(Pointer(Pointer(IDWriteLocalizedStrings)), "names")]),
+    Method(HRESULT, "GetInformationalStrings", [(DWRITE_INFORMATIONAL_STRING_ID, "informationalStringID"), Out(Pointer(Pointer(IDWriteLocalizedStrings)), "informationalStrings"), Out(Pointer(BOOL), "exists")]),
+    Method(DWRITE_FONT_SIMULATIONS, "GetSimulations", []),
+    Method(Void, "GetMetrics", [Out(Pointer(DWRITE_FONT_METRICS), "fontMetrics")]),
+    Method(HRESULT, "HasCharacter", [(UINT32, "unicodeValue"), Out(Pointer(BOOL), "exists")]),
+    Method(HRESULT, "CreateFontFace", [Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
+]
+
+DWRITE_READING_DIRECTION = Enum("DWRITE_READING_DIRECTION", [
+    "DWRITE_READING_DIRECTION_LEFT_TO_RIGHT",
+    "DWRITE_READING_DIRECTION_RIGHT_TO_LEFT",
+])
+
+DWRITE_FLOW_DIRECTION = Enum("DWRITE_FLOW_DIRECTION", [
+    "DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM",
+])
+
+DWRITE_TEXT_ALIGNMENT = Enum("DWRITE_TEXT_ALIGNMENT", [
+    "DWRITE_TEXT_ALIGNMENT_LEADING",
+    "DWRITE_TEXT_ALIGNMENT_TRAILING",
+    "DWRITE_TEXT_ALIGNMENT_CENTER",
+])
+
+DWRITE_PARAGRAPH_ALIGNMENT = Enum("DWRITE_PARAGRAPH_ALIGNMENT", [
+    "DWRITE_PARAGRAPH_ALIGNMENT_NEAR",
+    "DWRITE_PARAGRAPH_ALIGNMENT_FAR",
+    "DWRITE_PARAGRAPH_ALIGNMENT_CENTER",
+])
+
+DWRITE_WORD_WRAPPING = Enum("DWRITE_WORD_WRAPPING", [
+    "DWRITE_WORD_WRAPPING_WRAP",
+    "DWRITE_WORD_WRAPPING_NO_WRAP",
+])
+
+DWRITE_LINE_SPACING_METHOD = Enum("DWRITE_LINE_SPACING_METHOD", [
+    "DWRITE_LINE_SPACING_METHOD_DEFAULT",
+    "DWRITE_LINE_SPACING_METHOD_UNIFORM",
+])
+
+DWRITE_TRIMMING_GRANULARITY = Enum("DWRITE_TRIMMING_GRANULARITY", [
+    "DWRITE_TRIMMING_GRANULARITY_NONE",
+    "DWRITE_TRIMMING_GRANULARITY_CHARACTER",
+    "DWRITE_TRIMMING_GRANULARITY_WORD",
+])
+
+DWRITE_FONT_FEATURE_TAG = Enum("DWRITE_FONT_FEATURE_TAG", [
+    "DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS",
+    "DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS",
+    "DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS",
+    "DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES",
+    "DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION",
+    "DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES",
+    "DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING",
+    "DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH",
+    "DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING",
+    "DWRITE_FONT_FEATURE_TAG_DEFAULT",
+    "DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES",
+    "DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_FRACTIONS",
+    "DWRITE_FONT_FEATURE_TAG_FULL_WIDTH",
+    "DWRITE_FONT_FEATURE_TAG_HALF_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_HALANT_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH",
+    "DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES",
+    "DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES",
+    "DWRITE_FONT_FEATURE_TAG_HALF_WIDTH",
+    "DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_JIS04_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_JIS78_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_JIS83_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_JIS90_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_KERNING",
+    "DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES",
+    "DWRITE_FONT_FEATURE_TAG_LINING_FIGURES",
+    "DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING",
+    "DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK",
+    "DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING",
+    "DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES",
+    "DWRITE_FONT_FEATURE_TAG_ORDINALS",
+    "DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH",
+    "DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS",
+    "DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES",
+    "DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS",
+    "DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS",
+    "DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES",
+    "DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES",
+    "DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS",
+    "DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS",
+    "DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19",
+    "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20",
+    "DWRITE_FONT_FEATURE_TAG_SUBSCRIPT",
+    "DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT",
+    "DWRITE_FONT_FEATURE_TAG_SWASH",
+    "DWRITE_FONT_FEATURE_TAG_TITLING",
+    "DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES",
+    "DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS",
+    "DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS",
+    "DWRITE_FONT_FEATURE_TAG_UNICASE",
+    "DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO",
+])
+
+DWRITE_TEXT_RANGE = Struct("DWRITE_TEXT_RANGE", [
+    (UINT32, "startPosition"),
+    (UINT32, "length"),
+])
+
+DWRITE_FONT_FEATURE = Struct("DWRITE_FONT_FEATURE", [
+    (DWRITE_FONT_FEATURE_TAG, "nameTag"),
+    (UINT32, "parameter"),
+])
+
+DWRITE_TYPOGRAPHIC_FEATURES = Struct("DWRITE_TYPOGRAPHIC_FEATURES", [
+    (OpaquePointer(DWRITE_FONT_FEATURE), "features"),
+    (UINT32, "featureCount"),
+])
+
+DWRITE_TRIMMING = Struct("DWRITE_TRIMMING", [
+    (DWRITE_TRIMMING_GRANULARITY, "granularity"),
+    (UINT32, "delimiter"),
+    (UINT32, "delimiterCount"),
+])
+
+IDWriteTextFormat.methods += [
+    Method(HRESULT, "SetTextAlignment", [(DWRITE_TEXT_ALIGNMENT, "textAlignment")]),
+    Method(HRESULT, "SetParagraphAlignment", [(DWRITE_PARAGRAPH_ALIGNMENT, "paragraphAlignment")]),
+    Method(HRESULT, "SetWordWrapping", [(DWRITE_WORD_WRAPPING, "wordWrapping")]),
+    Method(HRESULT, "SetReadingDirection", [(DWRITE_READING_DIRECTION, "readingDirection")]),
+    Method(HRESULT, "SetFlowDirection", [(DWRITE_FLOW_DIRECTION, "flowDirection")]),
+    Method(HRESULT, "SetIncrementalTabStop", [(FLOAT, "incrementalTabStop")]),
+    Method(HRESULT, "SetTrimming", [(Pointer(Const(DWRITE_TRIMMING)), "trimmingOptions"), (Pointer(IDWriteInlineObject), "trimmingSign")]),
+    Method(HRESULT, "SetLineSpacing", [(DWRITE_LINE_SPACING_METHOD, "lineSpacingMethod"), (FLOAT, "lineSpacing"), (FLOAT, "baseline")]),
+    Method(DWRITE_TEXT_ALIGNMENT, "GetTextAlignment", []),
+    Method(DWRITE_PARAGRAPH_ALIGNMENT, "GetParagraphAlignment", []),
+    Method(DWRITE_WORD_WRAPPING, "GetWordWrapping", []),
+    Method(DWRITE_READING_DIRECTION, "GetReadingDirection", []),
+    Method(DWRITE_FLOW_DIRECTION, "GetFlowDirection", []),
+    Method(FLOAT, "GetIncrementalTabStop", []),
+    Method(HRESULT, "GetTrimming", [Out(Pointer(DWRITE_TRIMMING), "trimmingOptions"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
+    Method(HRESULT, "GetLineSpacing", [Out(Pointer(DWRITE_LINE_SPACING_METHOD), "lineSpacingMethod"), Out(Pointer(FLOAT), "lineSpacing"), Out(Pointer(FLOAT), "baseline")]),
+    Method(HRESULT, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
+    Method(UINT32, "GetFontFamilyNameLength", []),
+    Method(HRESULT, "GetFontFamilyName", [Out(Pointer(WCHAR), "fontFamilyName"), (UINT32, "nameSize")]),
+    Method(DWRITE_FONT_WEIGHT, "GetFontWeight", []),
+    Method(DWRITE_FONT_STYLE, "GetFontStyle", []),
+    Method(DWRITE_FONT_STRETCH, "GetFontStretch", []),
+    Method(FLOAT, "GetFontSize", []),
+    Method(UINT32, "GetLocaleNameLength", []),
+    Method(HRESULT, "GetLocaleName", [Out(Pointer(WCHAR), "localeName"), (UINT32, "nameSize")]),
+]
+
+IDWriteTypography.methods += [
+    Method(HRESULT, "AddFontFeature", [(DWRITE_FONT_FEATURE, "fontFeature")]),
+    Method(UINT32, "GetFontFeatureCount", []),
+    Method(HRESULT, "GetFontFeature", [(UINT32, "fontFeatureIndex"), Out(Pointer(DWRITE_FONT_FEATURE), "fontFeature")]),
+]
+
+DWRITE_SCRIPT_SHAPES = EnumFlag("DWRITE_SCRIPT_SHAPES", [
+    "DWRITE_SCRIPT_SHAPES_DEFAULT",
+    "DWRITE_SCRIPT_SHAPES_NO_VISUAL",
+])
+
+DWRITE_SCRIPT_ANALYSIS = Struct("DWRITE_SCRIPT_ANALYSIS", [
+    (UINT16, "script"),
+    (DWRITE_SCRIPT_SHAPES, "shapes"),
+])
+
+DWRITE_BREAK_CONDITION = Enum("DWRITE_BREAK_CONDITION", [
+    "DWRITE_BREAK_CONDITION_NEUTRAL",
+    "DWRITE_BREAK_CONDITION_CAN_BREAK",
+    "DWRITE_BREAK_CONDITION_MAY_NOT_BREAK",
+    "DWRITE_BREAK_CONDITION_MUST_BREAK",
+])
+
+DWRITE_LINE_BREAKPOINT = Struct("DWRITE_LINE_BREAKPOINT", [
+    (UINT8, "breakConditionBefore"),
+    (UINT8, "breakConditionAfter"),
+    (UINT8, "isWhitespace"),
+    (UINT8, "isSoftHyphen"),
+    (UINT8, "padding"),
+])
+
+DWRITE_NUMBER_SUBSTITUTION_METHOD = Enum("DWRITE_NUMBER_SUBSTITUTION_METHOD", [
+    "DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE",
+    "DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL",
+    "DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE",
+    "DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL",
+    "DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL",
+])
+
+IDWriteNumberSubstitution.methods += [
+]
+
+DWRITE_SHAPING_TEXT_PROPERTIES = Struct("DWRITE_SHAPING_TEXT_PROPERTIES", [
+    (UINT16, "isShapedAlone"),
+    (UINT16, "reserved"),
+])
+
+DWRITE_SHAPING_GLYPH_PROPERTIES = Struct("DWRITE_SHAPING_GLYPH_PROPERTIES", [
+    (UINT16, "justification"),
+    (UINT16, "isClusterStart"),
+    (UINT16, "isDiacritic"),
+    (UINT16, "isZeroWidthSpace"),
+    (UINT16, "reserved"),
+])
+
+IDWriteTextAnalysisSource.methods += [
+    Method(HRESULT, "GetTextAtPosition", [(UINT32, "textPosition"), Out(Pointer(Pointer(Const(WCHAR))), "textString"), Out(Pointer(UINT32), "textLength")]),
+    Method(HRESULT, "GetTextBeforePosition", [(UINT32, "textPosition"), Out(Pointer(Pointer(Const(WCHAR))), "textString"), Out(Pointer(UINT32), "textLength")]),
+    Method(DWRITE_READING_DIRECTION, "GetParagraphReadingDirection", []),
+    Method(HRESULT, "GetLocaleName", [(UINT32, "textPosition"), Out(Pointer(UINT32), "textLength"), Out(Pointer(Pointer(Const(WCHAR))), "localeName")]),
+    Method(HRESULT, "GetNumberSubstitution", [(UINT32, "textPosition"), Out(Pointer(UINT32), "textLength"), Out(Pointer(Pointer(IDWriteNumberSubstitution)), "numberSubstitution")]),
+]
+
+IDWriteTextAnalysisSink.methods += [
+    Method(HRESULT, "SetScriptAnalysis", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis")]),
+    Method(HRESULT, "SetLineBreakpoints", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(Const(DWRITE_LINE_BREAKPOINT)), "lineBreakpoints")]),
+    Method(HRESULT, "SetBidiLevel", [(UINT32, "textPosition"), (UINT32, "textLength"), (UINT8, "explicitLevel"), (UINT8, "resolvedLevel")]),
+    Method(HRESULT, "SetNumberSubstitution", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteNumberSubstitution), "numberSubstitution")]),
+]
+
+IDWriteTextAnalyzer.methods += [
+    Method(HRESULT, "AnalyzeScript", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "AnalyzeBidi", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "AnalyzeNumberSubstitution", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "AnalyzeLineBreakpoints", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "GetGlyphs", [(Pointer(Const(WCHAR)), "textString"), (UINT32, "textLength"), (Pointer(IDWriteFontFace), "fontFace"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (Pointer(Const(WCHAR)), "localeName"), (Pointer(IDWriteNumberSubstitution), "numberSubstitution"), (OpaquePointer(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES))), "features"), (Pointer(Const(UINT32)), "featureRangeLengths"), (UINT32, "featureRanges"), (UINT32, "maxGlyphCount"), Out(Pointer(UINT16), "clusterMap"), Out(Pointer(DWRITE_SHAPING_TEXT_PROPERTIES), "textProps"), Out(Pointer(UINT16), "glyphIndices"), Out(Pointer(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphProps"), Out(Pointer(UINT32), "actualGlyphCount")]),
+    Method(HRESULT, "GetGlyphPlacements", [(Pointer(Const(WCHAR)), "textString"), (Pointer(Const(UINT16)), "clusterMap"), (OpaquePointer(DWRITE_SHAPING_TEXT_PROPERTIES), "textProps"), (UINT32, "textLength"), (Pointer(Const(UINT16)), "glyphIndices"), (Pointer(Const(DWRITE_SHAPING_GLYPH_PROPERTIES)), "glyphProps"), (UINT32, "glyphCount"), (Pointer(IDWriteFontFace), "fontFace"), (FLOAT, "fontEmSize"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (Pointer(Const(WCHAR)), "localeName"), (OpaquePointer(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES))), "features"), (Pointer(Const(UINT32)), "featureRangeLengths"), (UINT32, "featureRanges"), Out(Pointer(FLOAT), "glyphAdvances"), Out(Pointer(DWRITE_GLYPH_OFFSET), "glyphOffsets")]),
+]
+
+DWRITE_GLYPH_RUN = Struct("DWRITE_GLYPH_RUN", [
+    (Pointer(IDWriteFontFace), "fontFace"),
+    (FLOAT, "fontEmSize"),
+    (UINT32, "glyphCount"),
+    (Pointer(Const(UINT16)), "glyphIndices"),
+    (Pointer(Const(FLOAT)), "glyphAdvances"),
+    (Pointer(Const(DWRITE_GLYPH_OFFSET)), "glyphOffsets"),
+    (BOOL, "isSideways"),
+    (UINT32, "bidiLevel"),
+])
+
+DWRITE_GLYPH_RUN_DESCRIPTION = Struct("DWRITE_GLYPH_RUN_DESCRIPTION", [
+    (Pointer(Const(WCHAR)), "localeName"),
+    (Pointer(Const(WCHAR)), "string"),
+    (UINT32, "stringLength"),
+    (Pointer(Const(UINT16)), "clusterMap"),
+    (UINT32, "textPosition"),
+])
+
+DWRITE_UNDERLINE = Struct("DWRITE_UNDERLINE", [
+    (FLOAT, "width"),
+    (FLOAT, "thickness"),
+    (FLOAT, "offset"),
+    (FLOAT, "runHeight"),
+    (DWRITE_READING_DIRECTION, "readingDirection"),
+    (DWRITE_FLOW_DIRECTION, "flowDirection"),
+    (Pointer(Const(WCHAR)), "localeName"),
+    (DWRITE_MEASURING_MODE, "measuringMode"),
+])
+
+DWRITE_STRIKETHROUGH = Struct("DWRITE_STRIKETHROUGH", [
+    (FLOAT, "width"),
+    (FLOAT, "thickness"),
+    (FLOAT, "offset"),
+    (DWRITE_READING_DIRECTION, "readingDirection"),
+    (DWRITE_FLOW_DIRECTION, "flowDirection"),
+    (Pointer(Const(WCHAR)), "localeName"),
+    (DWRITE_MEASURING_MODE, "measuringMode"),
+])
+
+DWRITE_LINE_METRICS = Struct("DWRITE_LINE_METRICS", [
+    (UINT32, "length"),
+    (UINT32, "trailingWhitespaceLength"),
+    (UINT32, "newlineLength"),
+    (FLOAT, "height"),
+    (FLOAT, "baseline"),
+    (BOOL, "isTrimmed"),
+])
+
+DWRITE_CLUSTER_METRICS = Struct("DWRITE_CLUSTER_METRICS", [
+    (FLOAT, "width"),
+    (UINT16, "length"),
+    (UINT16, "canWrapLineAfter"),
+    (UINT16, "isWhitespace"),
+    (UINT16, "isNewline"),
+    (UINT16, "isSoftHyphen"),
+    (UINT16, "isRightToLeft"),
+    (UINT16, "padding"),
+])
+
+DWRITE_TEXT_METRICS = Struct("DWRITE_TEXT_METRICS", [
+    (FLOAT, "left"),
+    (FLOAT, "top"),
+    (FLOAT, "width"),
+    (FLOAT, "widthIncludingTrailingWhitespace"),
+    (FLOAT, "height"),
+    (FLOAT, "layoutWidth"),
+    (FLOAT, "layoutHeight"),
+    (UINT32, "maxBidiReorderingDepth"),
+    (UINT32, "lineCount"),
+])
+
+DWRITE_INLINE_OBJECT_METRICS = Struct("DWRITE_INLINE_OBJECT_METRICS", [
+    (FLOAT, "width"),
+    (FLOAT, "height"),
+    (FLOAT, "baseline"),
+    (BOOL, "supportsSideways"),
+])
+
+DWRITE_OVERHANG_METRICS = Struct("DWRITE_OVERHANG_METRICS", [
+    (FLOAT, "left"),
+    (FLOAT, "top"),
+    (FLOAT, "right"),
+    (FLOAT, "bottom"),
+])
+
+DWRITE_HIT_TEST_METRICS = Struct("DWRITE_HIT_TEST_METRICS", [
+    (UINT32, "textPosition"),
+    (UINT32, "length"),
+    (FLOAT, "left"),
+    (FLOAT, "top"),
+    (FLOAT, "width"),
+    (FLOAT, "height"),
+    (UINT32, "bidiLevel"),
+    (BOOL, "isText"),
+    (BOOL, "isTrimmed"),
+])
+
+IDWriteInlineObject.methods += [
+    Method(HRESULT, "Draw", [(OpaquePointer(Void), "clientDrawingContext"), (Pointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "GetMetrics", [Out(Pointer(DWRITE_INLINE_OBJECT_METRICS), "metrics")]),
+    Method(HRESULT, "GetOverhangMetrics", [Out(Pointer(DWRITE_OVERHANG_METRICS), "overhangs")]),
+    Method(HRESULT, "GetBreakConditions", [Out(Pointer(DWRITE_BREAK_CONDITION), "breakConditionBefore"), Out(Pointer(DWRITE_BREAK_CONDITION), "breakConditionAfter")]),
+]
+
+IDWritePixelSnapping.methods += [
+    Method(HRESULT, "IsPixelSnappingDisabled", [(OpaquePointer(Void), "clientDrawingContext"), Out(Pointer(BOOL), "isDisabled")]),
+    Method(HRESULT, "GetCurrentTransform", [(OpaquePointer(Void), "clientDrawingContext"), Out(Pointer(DWRITE_MATRIX), "transform")]),
+    Method(HRESULT, "GetPixelsPerDip", [(OpaquePointer(Void), "clientDrawingContext"), Out(Pointer(FLOAT), "pixelsPerDip")]),
+]
+
+IDWriteTextRenderer.methods += [
+    Method(HRESULT, "DrawGlyphRun", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(Const(DWRITE_GLYPH_RUN_DESCRIPTION)), "glyphRunDescription"), (Pointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "DrawUnderline", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_UNDERLINE)), "underline"), (Pointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "DrawStrikethrough", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_STRIKETHROUGH)), "strikethrough"), (Pointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "DrawInlineObject", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "originX"), (FLOAT, "originY"), (Pointer(IDWriteInlineObject), "inlineObject"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IUnknown), "clientDrawingEffect")]),
+]
+
+IDWriteTextLayout.methods += [
+    Method(HRESULT, "SetMaxWidth", [(FLOAT, "maxWidth")]),
+    Method(HRESULT, "SetMaxHeight", [(FLOAT, "maxHeight")]),
+    Method(HRESULT, "SetFontCollection", [(Pointer(IDWriteFontCollection), "fontCollection"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetFontFamilyName", [(Pointer(Const(WCHAR)), "fontFamilyName"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetFontWeight", [(DWRITE_FONT_WEIGHT, "fontWeight"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetFontStyle", [(DWRITE_FONT_STYLE, "fontStyle"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetFontStretch", [(DWRITE_FONT_STRETCH, "fontStretch"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetFontSize", [(FLOAT, "fontSize"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetUnderline", [(BOOL, "hasUnderline"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetStrikethrough", [(BOOL, "hasStrikethrough"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetDrawingEffect", [(Pointer(IUnknown), "drawingEffect"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetInlineObject", [(Pointer(IDWriteInlineObject), "inlineObject"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetTypography", [(Pointer(IDWriteTypography), "typography"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetLocaleName", [(Pointer(Const(WCHAR)), "localeName"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(FLOAT, "GetMaxWidth", []),
+    Method(FLOAT, "GetMaxHeight", []),
+    Method(HRESULT, "GetFontCollection", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetFontFamilyNameLength", [(UINT32, "currentPosition"), Out(Pointer(UINT32), "nameLength"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetFontFamilyName", [(UINT32, "currentPosition"), Out(Pointer(WCHAR), "fontFamilyName"), (UINT32, "nameSize"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetFontWeight", [(UINT32, "currentPosition"), Out(Pointer(DWRITE_FONT_WEIGHT), "fontWeight"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetFontStyle", [(UINT32, "currentPosition"), Out(Pointer(DWRITE_FONT_STYLE), "fontStyle"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetFontStretch", [(UINT32, "currentPosition"), Out(Pointer(DWRITE_FONT_STRETCH), "fontStretch"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetFontSize", [(UINT32, "currentPosition"), Out(Pointer(FLOAT), "fontSize"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetUnderline", [(UINT32, "currentPosition"), Out(Pointer(BOOL), "hasUnderline"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetStrikethrough", [(UINT32, "currentPosition"), Out(Pointer(BOOL), "hasStrikethrough"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetDrawingEffect", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IUnknown)), "drawingEffect"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetInlineObject", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteInlineObject)), "inlineObject"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetTypography", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteTypography)), "typography"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetLocaleNameLength", [(UINT32, "currentPosition"), Out(Pointer(UINT32), "nameLength"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetLocaleName", [(UINT32, "currentPosition"), Out(Pointer(WCHAR), "localeName"), (UINT32, "nameSize"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "Draw", [(OpaquePointer(Void), "clientDrawingContext"), (Pointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY")]),
+    Method(HRESULT, "GetLineMetrics", [Out(Pointer(DWRITE_LINE_METRICS), "lineMetrics"), (UINT32, "maxLineCount"), Out(Pointer(UINT32), "actualLineCount")]),
+    Method(HRESULT, "GetMetrics", [Out(Pointer(DWRITE_TEXT_METRICS), "textMetrics")]),
+    Method(HRESULT, "GetOverhangMetrics", [Out(Pointer(DWRITE_OVERHANG_METRICS), "overhangs")]),
+    Method(HRESULT, "GetClusterMetrics", [Out(Pointer(DWRITE_CLUSTER_METRICS), "clusterMetrics"), (UINT32, "maxClusterCount"), Out(Pointer(UINT32), "actualClusterCount")]),
+    Method(HRESULT, "DetermineMinWidth", [Out(Pointer(FLOAT), "minWidth")]),
+    Method(HRESULT, "HitTestPoint", [(FLOAT, "pointX"), (FLOAT, "pointY"), Out(Pointer(BOOL), "isTrailingHit"), Out(Pointer(BOOL), "isInside"), Out(Pointer(DWRITE_HIT_TEST_METRICS), "hitTestMetrics")]),
+    Method(HRESULT, "HitTestTextPosition", [(UINT32, "textPosition"), (BOOL, "isTrailingHit"), Out(Pointer(FLOAT), "pointX"), Out(Pointer(FLOAT), "pointY"), Out(Pointer(DWRITE_HIT_TEST_METRICS), "hitTestMetrics")]),
+    Method(HRESULT, "HitTestTextRange", [(UINT32, "textPosition"), (UINT32, "textLength"), (FLOAT, "originX"), (FLOAT, "originY"), Out(Pointer(DWRITE_HIT_TEST_METRICS), "hitTestMetrics"), (UINT32, "maxHitTestMetricsCount"), Out(Pointer(UINT32), "actualHitTestMetricsCount")]),
+]
+
+IDWriteBitmapRenderTarget.methods += [
+    Method(HRESULT, "DrawGlyphRun", [(FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(IDWriteRenderingParams), "renderingParams"), (COLORREF, "textColor"), Out(Pointer(RECT), "blackBoxRect")]),
+    Method(HDC, "GetMemoryDC", []),
+    Method(FLOAT, "GetPixelsPerDip", []),
+    Method(HRESULT, "SetPixelsPerDip", [(FLOAT, "pixelsPerDip")]),
+    Method(HRESULT, "GetCurrentTransform", [Out(Pointer(DWRITE_MATRIX), "transform")]),
+    Method(HRESULT, "SetCurrentTransform", [(Pointer(Const(DWRITE_MATRIX)), "transform")]),
+    Method(HRESULT, "GetSize", [Out(Pointer(SIZE), "size")]),
+    Method(HRESULT, "Resize", [(UINT32, "width"), (UINT32, "height")]),
+]
+
+IDWriteGdiInterop.methods += [
+    Method(HRESULT, "CreateFontFromLOGFONT", [(Pointer(Const(LOGFONTW)), "logFont"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
+    Method(HRESULT, "ConvertFontToLOGFONT", [(Pointer(IDWriteFont), "font"), Out(Pointer(LOGFONTW), "logFont"), Out(Pointer(BOOL), "isSystemFont")]),
+    Method(HRESULT, "ConvertFontFaceToLOGFONT", [(Pointer(IDWriteFontFace), "font"), Out(Pointer(LOGFONTW), "logFont")]),
+    Method(HRESULT, "CreateFontFaceFromHdc", [(HDC, "hdc"), Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
+    Method(HRESULT, "CreateBitmapRenderTarget", [(HDC, "hdc"), (UINT32, "width"), (UINT32, "height"), Out(Pointer(Pointer(IDWriteBitmapRenderTarget)), "renderTarget")]),
+]
+
+DWRITE_TEXTURE_TYPE = Enum("DWRITE_TEXTURE_TYPE", [
+    "DWRITE_TEXTURE_ALIASED_1x1",
+    "DWRITE_TEXTURE_CLEARTYPE_3x1",
+])
+
+IDWriteGlyphRunAnalysis.methods += [
+    Method(HRESULT, "GetAlphaTextureBounds", [(DWRITE_TEXTURE_TYPE, "textureType"), Out(Pointer(RECT), "textureBounds")]),
+    Method(HRESULT, "CreateAlphaTexture", [(DWRITE_TEXTURE_TYPE, "textureType"), (Pointer(Const(RECT)), "textureBounds"), Out(Pointer(BYTE), "alphaValues"), (UINT32, "bufferSize")]),
+    Method(HRESULT, "GetAlphaBlendParams", [(Pointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(FLOAT), "blendGamma"), Out(Pointer(FLOAT), "blendEnhancedContrast"), Out(Pointer(FLOAT), "blendClearTypeLevel")]),
+]
+
+IDWriteFactory.methods += [
+    Method(HRESULT, "GetSystemFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection"), (BOOL, "checkForUpdates")]),
+    Method(HRESULT, "CreateCustomFontCollection", [(Pointer(IDWriteFontCollectionLoader), "collectionLoader"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
+    Method(HRESULT, "RegisterFontCollectionLoader", [(Pointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
+    Method(HRESULT, "UnregisterFontCollectionLoader", [(Pointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
+    Method(HRESULT, "CreateFontFileReference", [(Pointer(Const(WCHAR)), "filePath"), (Pointer(Const(FILETIME)), "lastWriteTime"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
+    Method(HRESULT, "CreateCustomFontFileReference", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), (Pointer(IDWriteFontFileLoader), "fontFileLoader"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
+    Method(HRESULT, "CreateFontFace", [(DWRITE_FONT_FACE_TYPE, "fontFaceType"), (UINT32, "numberOfFiles"), (Pointer(Const(Pointer(IDWriteFontFile))), "fontFiles"), (UINT32, "faceIndex"), (DWRITE_FONT_SIMULATIONS, "fontFaceSimulationFlags"), Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
+    Method(HRESULT, "CreateRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
+    Method(HRESULT, "CreateMonitorRenderingParams", [(HMONITOR, "monitor"), Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
+    Method(HRESULT, "CreateCustomRenderingParams", [(FLOAT, "gamma"), (FLOAT, "enhancedContrast"), (FLOAT, "clearTypeLevel"), (DWRITE_PIXEL_GEOMETRY, "pixelGeometry"), (DWRITE_RENDERING_MODE, "renderingMode"), Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
+    Method(HRESULT, "RegisterFontFileLoader", [(Pointer(IDWriteFontFileLoader), "fontFileLoader")]),
+    Method(HRESULT, "UnregisterFontFileLoader", [(Pointer(IDWriteFontFileLoader), "fontFileLoader")]),
+    Method(HRESULT, "CreateTextFormat", [(Pointer(Const(WCHAR)), "fontFamilyName"), (Pointer(IDWriteFontCollection), "fontCollection"), (DWRITE_FONT_WEIGHT, "fontWeight"), (DWRITE_FONT_STYLE, "fontStyle"), (DWRITE_FONT_STRETCH, "fontStretch"), (FLOAT, "fontSize"), (Pointer(Const(WCHAR)), "localeName"), Out(Pointer(Pointer(IDWriteTextFormat)), "textFormat")]),
+    Method(HRESULT, "CreateTypography", [Out(Pointer(Pointer(IDWriteTypography)), "typography")]),
+    Method(HRESULT, "GetGdiInterop", [Out(Pointer(Pointer(IDWriteGdiInterop)), "gdiInterop")]),
+    Method(HRESULT, "CreateTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (FLOAT, "maxWidth"), (FLOAT, "maxHeight"), Out(Pointer(Pointer(IDWriteTextLayout)), "textLayout")]),
+    Method(HRESULT, "CreateGdiCompatibleTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (FLOAT, "layoutWidth"), (FLOAT, "layoutHeight"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), Out(Pointer(Pointer(IDWriteTextLayout)), "textLayout")]),
+    Method(HRESULT, "CreateEllipsisTrimmingSign", [(Pointer(IDWriteTextFormat), "textFormat"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
+    Method(HRESULT, "CreateTextAnalyzer", [Out(Pointer(Pointer(IDWriteTextAnalyzer)), "textAnalyzer")]),
+    Method(HRESULT, "CreateNumberSubstitution", [(DWRITE_NUMBER_SUBSTITUTION_METHOD, "substitutionMethod"), (Pointer(Const(WCHAR)), "localeName"), (BOOL, "ignoreUserOverride"), Out(Pointer(Pointer(IDWriteNumberSubstitution)), "numberSubstitution")]),
+    Method(HRESULT, "CreateGlyphRunAnalysis", [(Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (DWRITE_RENDERING_MODE, "renderingMode"), (DWRITE_MEASURING_MODE, "measuringMode"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), Out(Pointer(Pointer(IDWriteGlyphRunAnalysis)), "glyphRunAnalysis")]),
+]
+
+dwrite = API("dwrite")
+dwrite.add_functions([
+    StdFunction(HRESULT, "DWriteCreateFactory", [(DWRITE_FACTORY_TYPE, "factoryType"), (REFIID, "iid"), Out(Pointer(Pointer(IUnknown)), "factory")]),
+])
index 4f3a6b9163f2f8501ead807ae01e5afefd1db7c1..3ef4a0110352be11db08680343f09d7f5f98c402 100755 (executable)
@@ -189,6 +189,11 @@ class Parser:
         value = 0
         while self.lookahead() != '}':
             type, name = self.parse_named_type()
+
+            if self.match(':'):
+                self.consume()
+                self.consume()
+
             if self.match(','):
                 self.consume(',')
             self.consume(';')
@@ -205,6 +210,8 @@ class Parser:
         if self.match(';'):
             return
         self.consume(':')
+        if self.lookahead() in ('public', 'protected'):
+            self.consume()
         base = self.consume()
         self.consume('{')
 
@@ -225,7 +232,7 @@ class Parser:
 
         ret = self.parse_type()
 
-        if self.match('__stdcall'):
+        if self.match('__stdcall', 'WINAPI'):
             self.consume()
             creator = 'StdFunction'
 
@@ -244,7 +251,10 @@ class Parser:
             args.append(arg)
             if self.match(','):
                 self.consume()
-        self.consume() == ')'
+        self.consume(')')
+        if self.lookahead() == 'const':
+            self.consume()
+            extra = ', const=True' + extra
         
         print '    %s(%s, "%s", [%s]%s),' % (creator, ret, name, ', '.join(args), extra)
 
@@ -256,6 +266,12 @@ class Parser:
         arg = '(%s, "%s")' % (type, name)
         if 'out' in tags:
             arg = 'Out' + arg
+
+        if self.match('='):
+            self.consume()
+            while not self.match(',', ')'):
+                self.consume()
+
         return arg
 
     def parse_tags(self):
index 53d874ee9cafc7225e716c08462a08368ce6754f..573743c5b39883ef6b4f8570ce6450546fc2a24a 100644 (file)
@@ -299,10 +299,17 @@ class Interface(Type):
 
 class Method(Function):
 
-    def __init__(self, type, name, args):
+    def __init__(self, type, name, args, const=False):
         Function.__init__(self, type, name, args, call = '__stdcall')
         for index in range(len(self.args)):
             self.args[index].index = index + 1
+        self.const = const
+
+    def prototype(self, name=None):
+        s = Function.prototype(self, name)
+        if self.const:
+            s += ' const'
+        return s
 
 
 class String(Type):
diff --git a/specs/temp.py b/specs/temp.py
new file mode 100644 (file)
index 0000000..7b51a97
--- /dev/null
@@ -0,0 +1,624 @@
+D2D1_ALPHA_MODE = Enum("D2D1_ALPHA_MODE", [
+    "D2D1_ALPHA_MODE_UNKNOWN",
+    "D2D1_ALPHA_MODE_PREMULTIPLIED",
+    "D2D1_ALPHA_MODE_STRAIGHT",
+    "D2D1_ALPHA_MODE_IGNORE",
+    "D2D1_ALPHA_MODE_FORCE_DWORD",
+])
+
+D2D1_GAMMA = Enum("D2D1_GAMMA", [
+    "D2D1_GAMMA_2_2",
+    "D2D1_GAMMA_1_0",
+    "D2D1_GAMMA_FORCE_DWORD",
+])
+
+D2D1_OPACITY_MASK_CONTENT = Enum("D2D1_OPACITY_MASK_CONTENT", [
+    "D2D1_OPACITY_MASK_CONTENT_GRAPHICS",
+    "D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL",
+    "D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE",
+    "D2D1_OPACITY_MASK_CONTENT_FORCE_DWORD",
+])
+
+D2D1_EXTEND_MODE = Enum("D2D1_EXTEND_MODE", [
+    "D2D1_EXTEND_MODE_CLAMP",
+    "D2D1_EXTEND_MODE_WRAP",
+    "D2D1_EXTEND_MODE_MIRROR",
+    "D2D1_EXTEND_MODE_FORCE_DWORD",
+])
+
+D2D1_ANTIALIAS_MODE = Enum("D2D1_ANTIALIAS_MODE", [
+    "D2D1_ANTIALIAS_MODE_PER_PRIMITIVE",
+    "D2D1_ANTIALIAS_MODE_ALIASED",
+    "D2D1_ANTIALIAS_MODE_FORCE_DWORD",
+])
+
+D2D1_TEXT_ANTIALIAS_MODE = Enum("D2D1_TEXT_ANTIALIAS_MODE", [
+    "D2D1_TEXT_ANTIALIAS_MODE_DEFAULT",
+    "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE",
+    "D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE",
+    "D2D1_TEXT_ANTIALIAS_MODE_ALIASED",
+    "D2D1_TEXT_ANTIALIAS_MODE_FORCE_DWORD",
+])
+
+D2D1_BITMAP_INTERPOLATION_MODE = Enum("D2D1_BITMAP_INTERPOLATION_MODE", [
+    "D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR",
+    "D2D1_BITMAP_INTERPOLATION_MODE_LINEAR",
+    "D2D1_BITMAP_INTERPOLATION_MODE_FORCE_DWORD",
+])
+
+D2D1_DRAW_TEXT_OPTIONS = Enum("D2D1_DRAW_TEXT_OPTIONS", [
+    "D2D1_DRAW_TEXT_OPTIONS_NO_SNAP",
+    "D2D1_DRAW_TEXT_OPTIONS_NO_CLIP",
+    "D2D1_DRAW_TEXT_OPTIONS_NONE",
+    "D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD",
+])
+
+D2D1_PIXEL_FORMAT = Struct("D2D1_PIXEL_FORMAT", [
+    (DXGI_FORMAT, "format"),
+    (D2D1_ALPHA_MODE, "alphaMode"),
+])
+
+D2D1_POINT_2U = Alias("D2D1_POINT_2U", D2D_POINT_2U)
+D2D1_POINT_2F = Alias("D2D1_POINT_2F", D2D_POINT_2F)
+D2D1_RECT_F = Alias("D2D1_RECT_F", D2D_RECT_F)
+D2D1_RECT_U = Alias("D2D1_RECT_U", D2D_RECT_U)
+D2D1_SIZE_F = Alias("D2D1_SIZE_F", D2D_SIZE_F)
+D2D1_SIZE_U = Alias("D2D1_SIZE_U", D2D_SIZE_U)
+D2D1_COLOR_F = Alias("D2D1_COLOR_F", D2D_COLOR_F)
+D2D1_MATRIX_3X2_F = Alias("D2D1_MATRIX_3X2_F", D2D_MATRIX_3X2_F)
+D2D1_TAG = Alias("D2D1_TAG", UINT64)
+D2D1_BITMAP_PROPERTIES = Struct("D2D1_BITMAP_PROPERTIES", [
+    (D2D1_PIXEL_FORMAT, "pixelFormat"),
+    (FLOAT, "dpiX"),
+    (FLOAT, "dpiY"),
+])
+
+D2D1_GRADIENT_STOP = Struct("D2D1_GRADIENT_STOP", [
+    (FLOAT, "position"),
+    (D2D1_COLOR_F, "color"),
+])
+
+D2D1_BRUSH_PROPERTIES = Struct("D2D1_BRUSH_PROPERTIES", [
+    (FLOAT, "opacity"),
+    (D2D1_MATRIX_3X2_F, "transform"),
+])
+
+D2D1_BITMAP_BRUSH_PROPERTIES = Struct("D2D1_BITMAP_BRUSH_PROPERTIES", [
+    (D2D1_EXTEND_MODE, "extendModeX"),
+    (D2D1_EXTEND_MODE, "extendModeY"),
+    (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"),
+])
+
+D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES", [
+    (D2D1_POINT_2F, "startPoint"),
+    (D2D1_POINT_2F, "endPoint"),
+])
+
+D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES", [
+    (D2D1_POINT_2F, "center"),
+    (D2D1_POINT_2F, "gradientOriginOffset"),
+    (FLOAT, "radiusX"),
+    (FLOAT, "radiusY"),
+])
+
+D2D1_ARC_SIZE = Enum("D2D1_ARC_SIZE", [
+    "D2D1_ARC_SIZE_SMALL",
+    "D2D1_ARC_SIZE_LARGE",
+    "D2D1_ARC_SIZE_FORCE_DWORD",
+])
+
+D2D1_CAP_STYLE = Enum("D2D1_CAP_STYLE", [
+    "D2D1_CAP_STYLE_FLAT",
+    "D2D1_CAP_STYLE_SQUARE",
+    "D2D1_CAP_STYLE_ROUND",
+    "D2D1_CAP_STYLE_TRIANGLE",
+    "D2D1_CAP_STYLE_FORCE_DWORD",
+])
+
+D2D1_DASH_STYLE = Enum("D2D1_DASH_STYLE", [
+    "D2D1_DASH_STYLE_SOLID",
+    "D2D1_DASH_STYLE_DASH",
+    "D2D1_DASH_STYLE_DOT",
+    "D2D1_DASH_STYLE_DASH_DOT",
+    "D2D1_DASH_STYLE_DASH_DOT_DOT",
+    "D2D1_DASH_STYLE_CUSTOM",
+    "D2D1_DASH_STYLE_FORCE_DWORD",
+])
+
+D2D1_LINE_JOIN = Enum("D2D1_LINE_JOIN", [
+    "D2D1_LINE_JOIN_MITER",
+    "D2D1_LINE_JOIN_BEVEL",
+    "D2D1_LINE_JOIN_ROUND",
+    "D2D1_LINE_JOIN_MITER_OR_BEVEL",
+    "D2D1_LINE_JOIN_FORCE_DWORD",
+])
+
+D2D1_COMBINE_MODE = Enum("D2D1_COMBINE_MODE", [
+    "D2D1_COMBINE_MODE_UNION",
+    "D2D1_COMBINE_MODE_INTERSECT",
+    "D2D1_COMBINE_MODE_XOR",
+    "D2D1_COMBINE_MODE_EXCLUDE",
+    "D2D1_COMBINE_MODE_FORCE_DWORD",
+])
+
+D2D1_GEOMETRY_RELATION = Enum("D2D1_GEOMETRY_RELATION", [
+    "D2D1_GEOMETRY_RELATION_UNKNOWN",
+    "D2D1_GEOMETRY_RELATION_DISJOINT",
+    "D2D1_GEOMETRY_RELATION_IS_CONTAINED",
+    "D2D1_GEOMETRY_RELATION_CONTAINS",
+    "D2D1_GEOMETRY_RELATION_OVERLAP",
+    "D2D1_GEOMETRY_RELATION_FORCE_DWORD",
+])
+
+D2D1_GEOMETRY_SIMPLIFICATION_OPTION = Enum("D2D1_GEOMETRY_SIMPLIFICATION_OPTION", [
+    "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES",
+    "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES",
+    "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD",
+])
+
+D2D1_FIGURE_BEGIN = Enum("D2D1_FIGURE_BEGIN", [
+    "D2D1_FIGURE_BEGIN_FILLED",
+    "D2D1_FIGURE_BEGIN_HOLLOW",
+    "D2D1_FIGURE_BEGIN_FORCE_DWORD",
+])
+
+D2D1_FIGURE_END = Enum("D2D1_FIGURE_END", [
+    "D2D1_FIGURE_END_OPEN",
+    "D2D1_FIGURE_END_CLOSED",
+    "D2D1_FIGURE_END_FORCE_DWORD",
+])
+
+D2D1_BEZIER_SEGMENT = Struct("D2D1_BEZIER_SEGMENT", [
+    (D2D1_POINT_2F, "point1"),
+    (D2D1_POINT_2F, "point2"),
+    (D2D1_POINT_2F, "point3"),
+])
+
+D2D1_TRIANGLE = Struct("D2D1_TRIANGLE", [
+    (D2D1_POINT_2F, "point1"),
+    (D2D1_POINT_2F, "point2"),
+    (D2D1_POINT_2F, "point3"),
+])
+
+D2D1_PATH_SEGMENT = Enum("D2D1_PATH_SEGMENT", [
+    "D2D1_PATH_SEGMENT_NONE",
+    "D2D1_PATH_SEGMENT_FORCE_UNSTROKED",
+    "D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN",
+    "D2D1_PATH_SEGMENT_FORCE_DWORD",
+])
+
+D2D1_SWEEP_DIRECTION = Enum("D2D1_SWEEP_DIRECTION", [
+    "D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE",
+    "D2D1_SWEEP_DIRECTION_CLOCKWISE",
+    "D2D1_SWEEP_DIRECTION_FORCE_DWORD",
+])
+
+D2D1_FILL_MODE = Enum("D2D1_FILL_MODE", [
+    "D2D1_FILL_MODE_ALTERNATE",
+    "D2D1_FILL_MODE_WINDING",
+    "D2D1_FILL_MODE_FORCE_DWORD",
+])
+
+D2D1_ARC_SEGMENT = Struct("D2D1_ARC_SEGMENT", [
+    (D2D1_POINT_2F, "point"),
+    (D2D1_SIZE_F, "size"),
+    (FLOAT, "rotationAngle"),
+    (D2D1_SWEEP_DIRECTION, "sweepDirection"),
+    (D2D1_ARC_SIZE, "arcSize"),
+])
+
+D2D1_QUADRATIC_BEZIER_SEGMENT = Struct("D2D1_QUADRATIC_BEZIER_SEGMENT", [
+    (D2D1_POINT_2F, "point1"),
+    (D2D1_POINT_2F, "point2"),
+])
+
+D2D1_ELLIPSE = Struct("D2D1_ELLIPSE", [
+    (D2D1_POINT_2F, "point"),
+    (FLOAT, "radiusX"),
+    (FLOAT, "radiusY"),
+])
+
+D2D1_ROUNDED_RECT = Struct("D2D1_ROUNDED_RECT", [
+    (D2D1_RECT_F, "rect"),
+    (FLOAT, "radiusX"),
+    (FLOAT, "radiusY"),
+])
+
+D2D1_STROKE_STYLE_PROPERTIES = Struct("D2D1_STROKE_STYLE_PROPERTIES", [
+    (D2D1_CAP_STYLE, "startCap"),
+    (D2D1_CAP_STYLE, "endCap"),
+    (D2D1_CAP_STYLE, "dashCap"),
+    (D2D1_LINE_JOIN, "lineJoin"),
+    (FLOAT, "miterLimit"),
+    (D2D1_DASH_STYLE, "dashStyle"),
+    (FLOAT, "dashOffset"),
+])
+
+D2D1_LAYER_OPTIONS = Enum("D2D1_LAYER_OPTIONS", [
+    "D2D1_LAYER_OPTIONS_NONE",
+    "D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE",
+    "D2D1_LAYER_OPTIONS_FORCE_DWORD",
+])
+
+D2D1_LAYER_PARAMETERS = Struct("D2D1_LAYER_PARAMETERS", [
+    (D2D1_RECT_F, "contentBounds"),
+    (OpaquePointer(ID2D1Geometry), "geometricMask"),
+    (D2D1_ANTIALIAS_MODE, "maskAntialiasMode"),
+    (D2D1_MATRIX_3X2_F, "maskTransform"),
+    (FLOAT, "opacity"),
+    (OpaquePointer(ID2D1Brush), "opacityBrush"),
+    (D2D1_LAYER_OPTIONS, "layerOptions"),
+])
+
+D2D1_WINDOW_STATE = Enum("D2D1_WINDOW_STATE", [
+    "D2D1_WINDOW_STATE_NONE",
+    "D2D1_WINDOW_STATE_OCCLUDED",
+    "D2D1_WINDOW_STATE_FORCE_DWORD",
+])
+
+D2D1_RENDER_TARGET_TYPE = Enum("D2D1_RENDER_TARGET_TYPE", [
+    "D2D1_RENDER_TARGET_TYPE_DEFAULT",
+    "D2D1_RENDER_TARGET_TYPE_SOFTWARE",
+    "D2D1_RENDER_TARGET_TYPE_HARDWARE",
+    "D2D1_RENDER_TARGET_TYPE_FORCE_DWORD",
+])
+
+D2D1_FEATURE_LEVEL = Enum("D2D1_FEATURE_LEVEL", [
+    "D2D1_FEATURE_LEVEL_DEFAULT",
+    "D2D1_FEATURE_LEVEL_9",
+    "D2D1_FEATURE_LEVEL_10",
+    "D2D1_FEATURE_LEVEL_FORCE_DWORD",
+])
+
+D2D1_RENDER_TARGET_USAGE = Enum("D2D1_RENDER_TARGET_USAGE", [
+    "D2D1_RENDER_TARGET_USAGE_NONE",
+    "D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING",
+    "D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE",
+    "D2D1_RENDER_TARGET_USAGE_FORCE_DWORD",
+])
+
+D2D1_PRESENT_OPTIONS = Enum("D2D1_PRESENT_OPTIONS", [
+    "D2D1_PRESENT_OPTIONS_NONE",
+    "D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS",
+    "D2D1_PRESENT_OPTIONS_IMMEDIATELY",
+    "D2D1_PRESENT_OPTIONS_FORCE_DWORD",
+])
+
+D2D1_RENDER_TARGET_PROPERTIES = Struct("D2D1_RENDER_TARGET_PROPERTIES", [
+    (D2D1_RENDER_TARGET_TYPE, "type"),
+    (D2D1_PIXEL_FORMAT, "pixelFormat"),
+    (FLOAT, "dpiX"),
+    (FLOAT, "dpiY"),
+    (D2D1_RENDER_TARGET_USAGE, "usage"),
+    (D2D1_FEATURE_LEVEL, "minLevel"),
+])
+
+D2D1_HWND_RENDER_TARGET_PROPERTIES = Struct("D2D1_HWND_RENDER_TARGET_PROPERTIES", [
+    (HWND, "hwnd"),
+    (D2D1_SIZE_U, "pixelSize"),
+    (D2D1_PRESENT_OPTIONS, "presentOptions"),
+])
+
+D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS = Enum("D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS", [
+    "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE",
+    "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE",
+    "D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_FORCE_DWORD",
+])
+
+D2D1_DRAWING_STATE_DESCRIPTION = Struct("D2D1_DRAWING_STATE_DESCRIPTION", [
+    (D2D1_ANTIALIAS_MODE, "antialiasMode"),
+    (D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode"),
+    (D2D1_TAG, "tag1"),
+    (D2D1_TAG, "tag2"),
+    (D2D1_MATRIX_3X2_F, "transform"),
+])
+
+D2D1_DC_INITIALIZE_MODE = Enum("D2D1_DC_INITIALIZE_MODE", [
+    "D2D1_DC_INITIALIZE_MODE_COPY",
+    "D2D1_DC_INITIALIZE_MODE_CLEAR",
+    "D2D1_DC_INITIALIZE_MODE_FORCE_DWORD",
+])
+
+D2D1_DEBUG_LEVEL = Enum("D2D1_DEBUG_LEVEL", [
+    "D2D1_DEBUG_LEVEL_NONE",
+    "D2D1_DEBUG_LEVEL_ERROR",
+    "D2D1_DEBUG_LEVEL_WARNING",
+    "D2D1_DEBUG_LEVEL_INFORMATION",
+    "D2D1_DEBUG_LEVEL_FORCE_DWORD",
+])
+
+D2D1_FACTORY_TYPE = Enum("D2D1_FACTORY_TYPE", [
+    "D2D1_FACTORY_TYPE_SINGLE_THREADED",
+    "D2D1_FACTORY_TYPE_MULTI_THREADED",
+    "D2D1_FACTORY_TYPE_FORCE_DWORD",
+])
+
+D2D1_FACTORY_OPTIONS = Struct("D2D1_FACTORY_OPTIONS", [
+    (D2D1_DEBUG_LEVEL, "debugLevel"),
+])
+
+ID2D1Resource = Interface("ID2D1Resource", IUnknown)
+ID2D1Resource.methods += [
+    Method(Void, "GetFactory", [Out(OpaquePointer(OpaquePointer(ID2D1Factory)), "factory")], const=True),
+]
+
+ID2D1Bitmap = Interface("ID2D1Bitmap", ID2D1Resource)
+ID2D1Bitmap.methods += [
+    Method(D2D1_SIZE_F, "GetSize", [], const=True),
+    Method(D2D1_SIZE_U, "GetPixelSize", [], const=True),
+    Method(D2D1_PIXEL_FORMAT, "GetPixelFormat", [], const=True),
+    Method(Void, "GetDpi", [Out(OpaquePointer(FLOAT), "dpiX"), Out(OpaquePointer(FLOAT), "dpiY")], const=True),
+    Method(HRESULT, "CopyFromBitmap", [(OpaquePointer(Const(D2D1_POINT_2U)), "destPoint"), (OpaquePointer(ID2D1Bitmap), "bitmap"), (OpaquePointer(Const(D2D1_RECT_U)), "srcRect")]),
+    Method(HRESULT, "CopyFromRenderTarget", [(OpaquePointer(Const(D2D1_POINT_2U)), "destPoint"), (OpaquePointer(ID2D1RenderTarget), "renderTarget"), (OpaquePointer(Const(D2D1_RECT_U)), "srcRect")]),
+    Method(HRESULT, "CopyFromMemory", [(OpaquePointer(Const(D2D1_RECT_U)), "dstRect"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch")]),
+]
+
+ID2D1GradientStopCollection = Interface("ID2D1GradientStopCollection", ID2D1Resource)
+ID2D1GradientStopCollection.methods += [
+    Method(UINT32, "GetGradientStopCount", [], const=True),
+    Method(Void, "GetGradientStops", [Out(OpaquePointer(D2D1_GRADIENT_STOP), "gradientStops"), (UINT, "gradientStopsCount")], const=True),
+    Method(D2D1_GAMMA, "GetColorInterpolationGamma", [], const=True),
+    Method(D2D1_EXTEND_MODE, "GetExtendMode", [], const=True),
+]
+
+ID2D1Brush = Interface("ID2D1Brush", ID2D1Resource)
+ID2D1Brush.methods += [
+    Method(Void, "SetOpacity", [(FLOAT, "opacity")]),
+    Method(Void, "SetTransform", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
+    Method(FLOAT, "GetOpacity", [], const=True),
+    Method(Void, "GetTransform", [Out(OpaquePointer(D2D1_MATRIX_3X2_F), "transform")], const=True),
+]
+
+ID2D1BitmapBrush = Interface("ID2D1BitmapBrush", ID2D1Brush)
+ID2D1BitmapBrush.methods += [
+    Method(Void, "SetExtendModeX", [(D2D1_EXTEND_MODE, "extendModeX")]),
+    Method(Void, "SetExtendModeY", [(D2D1_EXTEND_MODE, "extendModeY")]),
+    Method(Void, "SetInterpolationMode", [(D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode")]),
+    Method(Void, "SetBitmap", [(OpaquePointer(ID2D1Bitmap), "bitmap")]),
+    Method(D2D1_EXTEND_MODE, "GetExtendModeX", [], const=True),
+    Method(D2D1_EXTEND_MODE, "GetExtendModeY", [], const=True),
+    Method(D2D1_BITMAP_INTERPOLATION_MODE, "GetInterpolationMode", [], const=True),
+    Method(Void, "GetBitmap", [Out(OpaquePointer(OpaquePointer(ID2D1Bitmap)), "bitmap")], const=True),
+]
+
+ID2D1SolidColorBrush = Interface("ID2D1SolidColorBrush", ID2D1Brush)
+ID2D1SolidColorBrush.methods += [
+    Method(Void, "SetColor", [(OpaquePointer(Const(D2D1_COLOR_F)), "color")]),
+    Method(D2D1_COLOR_F, "GetColor", [], const=True),
+]
+
+ID2D1LinearGradientBrush = Interface("ID2D1LinearGradientBrush", ID2D1Brush)
+ID2D1LinearGradientBrush.methods += [
+    Method(Void, "SetStartPoint", [(D2D1_POINT_2F, "startPoint")]),
+    Method(Void, "SetEndPoint", [(D2D1_POINT_2F, "endPoint")]),
+    Method(D2D1_POINT_2F, "GetStartPoint", [], const=True),
+    Method(D2D1_POINT_2F, "GetEndPoint", [], const=True),
+    Method(Void, "GetGradientStopCollection", [Out(OpaquePointer(OpaquePointer(ID2D1GradientStopCollection)), "gradientStopCollection")], const=True),
+]
+
+ID2D1RadialGradientBrush = Interface("ID2D1RadialGradientBrush", ID2D1Brush)
+ID2D1RadialGradientBrush.methods += [
+    Method(Void, "SetCenter", [(D2D1_POINT_2F, "center")]),
+    Method(Void, "SetGradientOriginOffset", [(D2D1_POINT_2F, "gradientOriginOffset")]),
+    Method(Void, "SetRadiusX", [(FLOAT, "radiusX")]),
+    Method(Void, "SetRadiusY", [(FLOAT, "radiusY")]),
+    Method(D2D1_POINT_2F, "GetCenter", [], const=True),
+    Method(D2D1_POINT_2F, "GetGradientOriginOffset", [], const=True),
+    Method(FLOAT, "GetRadiusX", [], const=True),
+    Method(FLOAT, "GetRadiusY", [], const=True),
+    Method(Void, "GetGradientStopCollection", [Out(OpaquePointer(OpaquePointer(ID2D1GradientStopCollection)), "gradientStopCollection")], const=True),
+]
+
+ID2D1StrokeStyle = Interface("ID2D1StrokeStyle", ID2D1Resource)
+ID2D1StrokeStyle.methods += [
+    Method(D2D1_CAP_STYLE, "GetStartCap", [], const=True),
+    Method(D2D1_CAP_STYLE, "GetEndCap", [], const=True),
+    Method(D2D1_CAP_STYLE, "GetDashCap", [], const=True),
+    Method(FLOAT, "GetMiterLimit", [], const=True),
+    Method(D2D1_LINE_JOIN, "GetLineJoin", [], const=True),
+    Method(FLOAT, "GetDashOffset", [], const=True),
+    Method(D2D1_DASH_STYLE, "GetDashStyle", [], const=True),
+    Method(UINT32, "GetDashesCount", [], const=True),
+    Method(Void, "GetDashes", [Out(OpaquePointer(FLOAT), "dashes"), (UINT, "dashesCount")], const=True),
+]
+
+ID2D1Geometry = Interface("ID2D1Geometry", ID2D1Resource)
+ID2D1Geometry.methods += [
+    Method(HRESULT, "GetBounds", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), Out(OpaquePointer(D2D1_RECT_F), "bounds")], const=True),
+    Method(HRESULT, "GetWidenedBounds", [(FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(D2D1_RECT_F), "bounds")], const=True),
+    Method(HRESULT, "StrokeContainsPoint", [(D2D1_POINT_2F, "point"), (FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(BOOL), "contains")], const=True),
+    Method(HRESULT, "FillContainsPoint", [(D2D1_POINT_2F, "point"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(BOOL), "contains")], const=True),
+    Method(HRESULT, "CompareWithGeometry", [(OpaquePointer(ID2D1Geometry), "inputGeometry"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(D2D1_GEOMETRY_RELATION), "relation")], const=True),
+    Method(HRESULT, "Simplify", [(D2D1_GEOMETRY_SIMPLIFICATION_OPTION, "simplificationOption"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (OpaquePointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "Tessellate", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (OpaquePointer(ID2D1TessellationSink), "tessellationSink")], const=True),
+    Method(HRESULT, "CombineWithGeometry", [(OpaquePointer(ID2D1Geometry), "inputGeometry"), (D2D1_COMBINE_MODE, "combineMode"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), (OpaquePointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "Outline", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (OpaquePointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "ComputeArea", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(FLOAT), "area")], const=True),
+    Method(HRESULT, "ComputeLength", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(FLOAT), "length")], const=True),
+    Method(HRESULT, "ComputePointAtLength", [(FLOAT, "length"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(OpaquePointer(D2D1_POINT_2F), "point"), Out(OpaquePointer(D2D1_POINT_2F), "unitTangentVector")], const=True),
+    Method(HRESULT, "Widen", [(FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (OpaquePointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+]
+
+ID2D1RectangleGeometry = Interface("ID2D1RectangleGeometry", ID2D1Geometry)
+ID2D1RectangleGeometry.methods += [
+    Method(Void, "GetRect", [Out(OpaquePointer(D2D1_RECT_F), "rect")], const=True),
+]
+
+ID2D1RoundedRectangleGeometry = Interface("ID2D1RoundedRectangleGeometry", ID2D1Geometry)
+ID2D1RoundedRectangleGeometry.methods += [
+    Method(Void, "GetRoundedRect", [Out(OpaquePointer(D2D1_ROUNDED_RECT), "roundedRect")], const=True),
+]
+
+ID2D1EllipseGeometry = Interface("ID2D1EllipseGeometry", ID2D1Geometry)
+ID2D1EllipseGeometry.methods += [
+    Method(Void, "GetEllipse", [Out(OpaquePointer(D2D1_ELLIPSE), "ellipse")], const=True),
+]
+
+ID2D1GeometryGroup = Interface("ID2D1GeometryGroup", ID2D1Geometry)
+ID2D1GeometryGroup.methods += [
+    Method(D2D1_FILL_MODE, "GetFillMode", [], const=True),
+    Method(UINT32, "GetSourceGeometryCount", [], const=True),
+    Method(Void, "GetSourceGeometries", [Out(OpaquePointer(OpaquePointer(ID2D1Geometry)), "geometries"), (UINT, "geometriesCount")], const=True),
+]
+
+ID2D1TransformedGeometry = Interface("ID2D1TransformedGeometry", ID2D1Geometry)
+ID2D1TransformedGeometry.methods += [
+    Method(Void, "GetSourceGeometry", [Out(OpaquePointer(OpaquePointer(ID2D1Geometry)), "sourceGeometry")], const=True),
+    Method(Void, "GetTransform", [Out(OpaquePointer(D2D1_MATRIX_3X2_F), "transform")], const=True),
+]
+
+ID2D1SimplifiedGeometrySink = Interface("ID2D1SimplifiedGeometrySink", IUnknown)
+ID2D1SimplifiedGeometrySink.methods += [
+    Method(Void, "SetFillMode", [(D2D1_FILL_MODE, "fillMode")]),
+    Method(Void, "SetSegmentFlags", [(D2D1_PATH_SEGMENT, "vertexFlags")]),
+    Method(Void, "BeginFigure", [(D2D1_POINT_2F, "startPoint"), (D2D1_FIGURE_BEGIN, "figureBegin")]),
+    Method(Void, "AddLines", [(OpaquePointer(Const(D2D1_POINT_2F)), "points"), (UINT, "pointsCount")]),
+    Method(Void, "AddBeziers", [(OpaquePointer(Const(D2D1_BEZIER_SEGMENT)), "beziers"), (UINT, "beziersCount")]),
+    Method(Void, "EndFigure", [(D2D1_FIGURE_END, "figureEnd")]),
+    Method(HRESULT, "Close", []),
+]
+
+ID2D1GeometrySink = Interface("ID2D1GeometrySink", ID2D1SimplifiedGeometrySink)
+ID2D1GeometrySink.methods += [
+    Method(Void, "AddLine", [(D2D1_POINT_2F, "point")]),
+    Method(Void, "AddBezier", [(OpaquePointer(Const(D2D1_BEZIER_SEGMENT)), "bezier")]),
+    Method(Void, "AddQuadraticBezier", [(OpaquePointer(Const(D2D1_QUADRATIC_BEZIER_SEGMENT)), "bezier")]),
+    Method(Void, "AddQuadraticBeziers", [(OpaquePointer(Const(D2D1_QUADRATIC_BEZIER_SEGMENT)), "beziers"), (UINT, "beziersCount")]),
+    Method(Void, "AddArc", [(OpaquePointer(Const(D2D1_ARC_SEGMENT)), "arc")]),
+]
+
+ID2D1TessellationSink = Interface("ID2D1TessellationSink", IUnknown)
+ID2D1TessellationSink.methods += [
+    Method(Void, "AddTriangles", [(OpaquePointer(Const(D2D1_TRIANGLE)), "triangles"), (UINT, "trianglesCount")]),
+    Method(HRESULT, "Close", []),
+]
+
+ID2D1PathGeometry = Interface("ID2D1PathGeometry", ID2D1Geometry)
+ID2D1PathGeometry.methods += [
+    Method(HRESULT, "Open", [Out(OpaquePointer(OpaquePointer(ID2D1GeometrySink)), "geometrySink")]),
+    Method(HRESULT, "Stream", [(OpaquePointer(ID2D1GeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "GetSegmentCount", [Out(OpaquePointer(UINT32), "count")], const=True),
+    Method(HRESULT, "GetFigureCount", [Out(OpaquePointer(UINT32), "count")], const=True),
+]
+
+ID2D1Mesh = Interface("ID2D1Mesh", ID2D1Resource)
+ID2D1Mesh.methods += [
+    Method(HRESULT, "Open", [Out(OpaquePointer(OpaquePointer(ID2D1TessellationSink)), "tessellationSink")]),
+]
+
+ID2D1Layer = Interface("ID2D1Layer", ID2D1Resource)
+ID2D1Layer.methods += [
+    Method(D2D1_SIZE_F, "GetSize", [], const=True),
+]
+
+ID2D1DrawingStateBlock = Interface("ID2D1DrawingStateBlock", ID2D1Resource)
+ID2D1DrawingStateBlock.methods += [
+    Method(Void, "GetDescription", [Out(OpaquePointer(D2D1_DRAWING_STATE_DESCRIPTION), "stateDescription")], const=True),
+    Method(Void, "SetDescription", [(OpaquePointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "stateDescription")]),
+    Method(Void, "SetTextRenderingParams", [(OpaquePointer(IDWriteRenderingParams), "textRenderingParams")]),
+    Method(Void, "GetTextRenderingParams", [Out(OpaquePointer(OpaquePointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
+]
+
+ID2D1RenderTarget = Interface("ID2D1RenderTarget", ID2D1Resource)
+ID2D1RenderTarget.methods += [
+    Method(HRESULT, "CreateBitmap", [(D2D1_SIZE_U, "size"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch"), (OpaquePointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(OpaquePointer(OpaquePointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateBitmapFromWicBitmap", [(OpaquePointer(IWICBitmapSource), "wicBitmapSource"), (OpaquePointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(OpaquePointer(OpaquePointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateSharedBitmap", [(REFIID, "riid"), Out(OpaquePointer(Void), "data"), (OpaquePointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(OpaquePointer(OpaquePointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateBitmapBrush", [(OpaquePointer(ID2D1Bitmap), "bitmap"), (OpaquePointer(Const(D2D1_BITMAP_BRUSH_PROPERTIES)), "bitmapBrushProperties"), (OpaquePointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(OpaquePointer(OpaquePointer(ID2D1BitmapBrush)), "bitmapBrush")]),
+    Method(HRESULT, "CreateSolidColorBrush", [(OpaquePointer(Const(D2D1_COLOR_F)), "color"), (OpaquePointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(OpaquePointer(OpaquePointer(ID2D1SolidColorBrush)), "solidColorBrush")]),
+    Method(HRESULT, "CreateGradientStopCollection", [(OpaquePointer(Const(D2D1_GRADIENT_STOP)), "gradientStops"), (UINT, "gradientStopsCount"), (D2D1_GAMMA, "colorInterpolationGamma"), (D2D1_EXTEND_MODE, "extendMode"), Out(OpaquePointer(OpaquePointer(ID2D1GradientStopCollection)), "gradientStopCollection")]),
+    Method(HRESULT, "CreateLinearGradientBrush", [(OpaquePointer(Const(D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)), "linearGradientBrushProperties"), (OpaquePointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (OpaquePointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(OpaquePointer(OpaquePointer(ID2D1LinearGradientBrush)), "linearGradientBrush")]),
+    Method(HRESULT, "CreateRadialGradientBrush", [(OpaquePointer(Const(D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES)), "radialGradientBrushProperties"), (OpaquePointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (OpaquePointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(OpaquePointer(OpaquePointer(ID2D1RadialGradientBrush)), "radialGradientBrush")]),
+    Method(HRESULT, "CreateCompatibleRenderTarget", [(OpaquePointer(Const(D2D1_SIZE_F)), "desiredSize"), (OpaquePointer(Const(D2D1_SIZE_U)), "desiredPixelSize"), (OpaquePointer(Const(D2D1_PIXEL_FORMAT)), "desiredFormat"), (D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS, "options"), Out(OpaquePointer(OpaquePointer(ID2D1BitmapRenderTarget)), "bitmapRenderTarget")]),
+    Method(HRESULT, "CreateLayer", [(OpaquePointer(Const(D2D1_SIZE_F)), "size"), Out(OpaquePointer(OpaquePointer(ID2D1Layer)), "layer")]),
+    Method(HRESULT, "CreateMesh", [Out(OpaquePointer(OpaquePointer(ID2D1Mesh)), "mesh")]),
+    Method(Void, "DrawLine", [(D2D1_POINT_2F, "point0"), (D2D1_POINT_2F, "point1"), (OpaquePointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "DrawRectangle", [(OpaquePointer(Const(D2D1_RECT_F)), "rect"), (OpaquePointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillRectangle", [(OpaquePointer(Const(D2D1_RECT_F)), "rect"), (OpaquePointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawRoundedRectangle", [(OpaquePointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (OpaquePointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillRoundedRectangle", [(OpaquePointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (OpaquePointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawEllipse", [(OpaquePointer(Const(D2D1_ELLIPSE)), "ellipse"), (OpaquePointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillEllipse", [(OpaquePointer(Const(D2D1_ELLIPSE)), "ellipse"), (OpaquePointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawGeometry", [(OpaquePointer(ID2D1Geometry), "geometry"), (OpaquePointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (OpaquePointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillGeometry", [(OpaquePointer(ID2D1Geometry), "geometry"), (OpaquePointer(ID2D1Brush), "brush"), (OpaquePointer(ID2D1Brush), "opacityBrush")]),
+    Method(Void, "FillMesh", [(OpaquePointer(ID2D1Mesh), "mesh"), (OpaquePointer(ID2D1Brush), "brush")]),
+    Method(Void, "FillOpacityMask", [(OpaquePointer(ID2D1Bitmap), "opacityMask"), (OpaquePointer(ID2D1Brush), "brush"), (D2D1_OPACITY_MASK_CONTENT, "content"), (OpaquePointer(Const(D2D1_RECT_F)), "destinationRectangle"), (OpaquePointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
+    Method(Void, "DrawBitmap", [(OpaquePointer(ID2D1Bitmap), "bitmap"), (OpaquePointer(Const(D2D1_RECT_F)), "destinationRectangle"), (FLOAT, "opacity"), (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"), (OpaquePointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
+    Method(Void, "DrawText", [(OpaquePointer(Const(WCHAR)), "string"), (UINT, "stringLength"), (OpaquePointer(IDWriteTextFormat), "textFormat"), (OpaquePointer(Const(D2D1_RECT_F)), "layoutRect"), (OpaquePointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options"), (DWRITE_MEASURING_MODE, "measuringMode")]),
+    Method(Void, "DrawTextLayout", [(D2D1_POINT_2F, "origin"), (OpaquePointer(IDWriteTextLayout), "textLayout"), (OpaquePointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options")]),
+    Method(Void, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (OpaquePointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (OpaquePointer(ID2D1Brush), "foregroundBrush"), (DWRITE_MEASURING_MODE, "measuringMode")]),
+    Method(Void, "SetTransform", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "transform")]),
+    Method(Void, "GetTransform", [Out(OpaquePointer(D2D1_MATRIX_3X2_F), "transform")], const=True),
+    Method(Void, "SetAntialiasMode", [(D2D1_ANTIALIAS_MODE, "antialiasMode")]),
+    Method(D2D1_ANTIALIAS_MODE, "GetAntialiasMode", [], const=True),
+    Method(Void, "SetTextAntialiasMode", [(D2D1_TEXT_ANTIALIAS_MODE, "textAntialiasMode")]),
+    Method(D2D1_TEXT_ANTIALIAS_MODE, "GetTextAntialiasMode", [], const=True),
+    Method(Void, "SetTextRenderingParams", [(OpaquePointer(IDWriteRenderingParams), "textRenderingParams")]),
+    Method(Void, "GetTextRenderingParams", [Out(OpaquePointer(OpaquePointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
+    Method(Void, "SetTags", [(D2D1_TAG, "tag1"), (D2D1_TAG, "tag2")]),
+    Method(Void, "GetTags", [Out(OpaquePointer(D2D1_TAG), "tag1"), Out(OpaquePointer(D2D1_TAG), "tag2")], const=True),
+    Method(Void, "PushLayer", [(OpaquePointer(Const(D2D1_LAYER_PARAMETERS)), "layerParameters"), (OpaquePointer(ID2D1Layer), "layer")]),
+    Method(Void, "PopLayer", []),
+    Method(HRESULT, "Flush", [Out(OpaquePointer(D2D1_TAG), "tag1"), Out(OpaquePointer(D2D1_TAG), "tag2")]),
+    Method(Void, "SaveDrawingState", [Out(OpaquePointer(ID2D1DrawingStateBlock), "drawingStateBlock")], const=True),
+    Method(Void, "RestoreDrawingState", [(OpaquePointer(ID2D1DrawingStateBlock), "drawingStateBlock")]),
+    Method(Void, "PushAxisAlignedClip", [(OpaquePointer(Const(D2D1_RECT_F)), "clipRect"), (D2D1_ANTIALIAS_MODE, "antialiasMode")]),
+    Method(Void, "PopAxisAlignedClip", []),
+    Method(Void, "Clear", [(OpaquePointer(Const(D2D1_COLOR_F)), "clearColor")]),
+    Method(Void, "BeginDraw", []),
+    Method(HRESULT, "EndDraw", [Out(OpaquePointer(D2D1_TAG), "tag1"), Out(OpaquePointer(D2D1_TAG), "tag2")]),
+    Method(D2D1_PIXEL_FORMAT, "GetPixelFormat", [], const=True),
+    Method(Void, "SetDpi", [(FLOAT, "dpiX"), (FLOAT, "dpiY")]),
+    Method(Void, "GetDpi", [Out(OpaquePointer(FLOAT), "dpiX"), Out(OpaquePointer(FLOAT), "dpiY")], const=True),
+    Method(D2D1_SIZE_F, "GetSize", [], const=True),
+    Method(D2D1_SIZE_U, "GetPixelSize", [], const=True),
+    Method(UINT32, "GetMaximumBitmapSize", [], const=True),
+    Method(BOOL, "IsSupported", [(OpaquePointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties")], const=True),
+]
+
+ID2D1BitmapRenderTarget = Interface("ID2D1BitmapRenderTarget", ID2D1RenderTarget)
+ID2D1BitmapRenderTarget.methods += [
+    Method(HRESULT, "GetBitmap", [Out(OpaquePointer(OpaquePointer(ID2D1Bitmap)), "bitmap")]),
+]
+
+ID2D1HwndRenderTarget = Interface("ID2D1HwndRenderTarget", ID2D1RenderTarget)
+ID2D1HwndRenderTarget.methods += [
+    Method(D2D1_WINDOW_STATE, "CheckWindowState", []),
+    Method(HRESULT, "Resize", [(OpaquePointer(Const(D2D1_SIZE_U)), "pixelSize")]),
+    Method(HWND, "GetHwnd", [], const=True),
+]
+
+ID2D1GdiInteropRenderTarget = Interface("ID2D1GdiInteropRenderTarget", IUnknown)
+ID2D1GdiInteropRenderTarget.methods += [
+    Method(HRESULT, "GetDC", [(D2D1_DC_INITIALIZE_MODE, "mode"), Out(OpaquePointer(HDC), "hdc")]),
+    Method(HRESULT, "ReleaseDC", [(OpaquePointer(Const(RECT)), "update")]),
+]
+
+ID2D1DCRenderTarget = Interface("ID2D1DCRenderTarget", ID2D1RenderTarget)
+ID2D1DCRenderTarget.methods += [
+    Method(HRESULT, "BindDC", [(Const(HDC), "hDC"), (OpaquePointer(Const(RECT)), "pSubRect")]),
+]
+
+ID2D1Factory = Interface("ID2D1Factory", IUnknown)
+ID2D1Factory.methods += [
+    Method(HRESULT, "ReloadSystemMetrics", []),
+    Method(Void, "GetDesktopDpi", [Out(OpaquePointer(FLOAT), "dpiX"), Out(OpaquePointer(FLOAT), "dpiY")]),
+    Method(HRESULT, "CreateRectangleGeometry", [(OpaquePointer(Const(D2D1_RECT_F)), "rectangle"), Out(OpaquePointer(OpaquePointer(ID2D1RectangleGeometry)), "rectangleGeometry")]),
+    Method(HRESULT, "CreateRoundedRectangleGeometry", [(OpaquePointer(Const(D2D1_ROUNDED_RECT)), "roundedRectangle"), Out(OpaquePointer(OpaquePointer(ID2D1RoundedRectangleGeometry)), "roundedRectangleGeometry")]),
+    Method(HRESULT, "CreateEllipseGeometry", [(OpaquePointer(Const(D2D1_ELLIPSE)), "ellipse"), Out(OpaquePointer(OpaquePointer(ID2D1EllipseGeometry)), "ellipseGeometry")]),
+    Method(HRESULT, "CreateGeometryGroup", [(D2D1_FILL_MODE, "fillMode"), (OpaquePointer(OpaquePointer(ID2D1Geometry)), "geometries"), (UINT, "geometriesCount"), Out(OpaquePointer(OpaquePointer(ID2D1GeometryGroup)), "geometryGroup")]),
+    Method(HRESULT, "CreateTransformedGeometry", [(OpaquePointer(ID2D1Geometry), "sourceGeometry"), (OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "transform"), Out(OpaquePointer(OpaquePointer(ID2D1TransformedGeometry)), "transformedGeometry")]),
+    Method(HRESULT, "CreatePathGeometry", [Out(OpaquePointer(OpaquePointer(ID2D1PathGeometry)), "pathGeometry")]),
+    Method(HRESULT, "CreateStrokeStyle", [(OpaquePointer(Const(D2D1_STROKE_STYLE_PROPERTIES)), "strokeStyleProperties"), (OpaquePointer(Const(FLOAT)), "dashes"), (UINT, "dashesCount"), Out(OpaquePointer(OpaquePointer(ID2D1StrokeStyle)), "strokeStyle")]),
+    Method(HRESULT, "CreateDrawingStateBlock", [(OpaquePointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "drawingStateDescription"), (OpaquePointer(IDWriteRenderingParams), "textRenderingParams"), Out(OpaquePointer(OpaquePointer(ID2D1DrawingStateBlock)), "drawingStateBlock")]),
+    Method(HRESULT, "CreateWicBitmapRenderTarget", [(OpaquePointer(IWICBitmap), "target"), (OpaquePointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(OpaquePointer(OpaquePointer(ID2D1RenderTarget)), "renderTarget")]),
+    Method(HRESULT, "CreateHwndRenderTarget", [(OpaquePointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), (OpaquePointer(Const(D2D1_HWND_RENDER_TARGET_PROPERTIES)), "hwndRenderTargetProperties"), Out(OpaquePointer(OpaquePointer(ID2D1HwndRenderTarget)), "hwndRenderTarget")]),
+    Method(HRESULT, "CreateDxgiSurfaceRenderTarget", [(OpaquePointer(IDXGISurface), "dxgiSurface"), (OpaquePointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(OpaquePointer(OpaquePointer(ID2D1RenderTarget)), "renderTarget")]),
+    Method(HRESULT, "CreateDCRenderTarget", [(OpaquePointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(OpaquePointer(OpaquePointer(ID2D1DCRenderTarget)), "dcRenderTarget")]),
+]
+
+    StdFunction(HRESULT, "D2D1CreateFactory", [(D2D1_FACTORY_TYPE, "factoryType"), (REFIID, "riid"), (OpaquePointer(Const(D2D1_FACTORY_OPTIONS)), "pFactoryOptions"), Out(OpaquePointer(OpaquePointer(Void)), "ppIFactory")]),
+    StdFunction(Void, "D2D1MakeRotateMatrix", [(FLOAT, "angle"), (D2D1_POINT_2F, "center"), Out(OpaquePointer(D2D1_MATRIX_3X2_F), "matrix")]),
+    StdFunction(Void, "D2D1MakeSkewMatrix", [(FLOAT, "angleX"), (FLOAT, "angleY"), (D2D1_POINT_2F, "center"), Out(OpaquePointer(D2D1_MATRIX_3X2_F), "matrix")]),
+    StdFunction(BOOL, "D2D1IsMatrixInvertible", [(OpaquePointer(Const(D2D1_MATRIX_3X2_F)), "matrix")]),
+    StdFunction(BOOL, "D2D1InvertMatrix", [Out(OpaquePointer(D2D1_MATRIX_3X2_F), "matrix")]),
index 17256aaec759c7eeabad190e46735ef0503ff1f1..94764362bda51708fa85b4d4bca6fb977b64b1a7 100644 (file)
@@ -150,6 +150,30 @@ HMODULE = Opaque("HMODULE")
 
 IUnknown = Interface("IUnknown")
 
+FILETIME = Struct("FILETIME", [
+    (DWORD, "dwLowDateTime"),
+    (DWORD, "dwHighDateTime"),
+])
+
+COLORREF = Alias("COLORREF", DWORD)
+
+LOGFONTW = Struct("LOGFONTW", [
+    (LONG, "lfHeight"),
+    (LONG, "lfWidth"),
+    (LONG, "lfEscapement"),
+    (LONG, "lfOrientation"),
+    (LONG, "lfWeight"),
+    (BYTE, "lfItalic"),
+    (BYTE, "lfUnderline"),
+    (BYTE, "lfStrikeOut"),
+    (BYTE, "lfCharSet"),
+    (BYTE, "lfOutPrecision"),
+    (BYTE, "lfClipPrecision"),
+    (BYTE, "lfQuality"),
+    (BYTE, "lfPitchAndFamily"),
+    (WString, "lfFaceName"),
+])
+
 HRESULT_com = FakeEnum(HRESULT, [
     "S_OK",
     "E_NOINTERFACE",