]> git.cworth.org Git - apitrace/commitdiff
Merge branch 'master' into d2d
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 21 Jan 2012 00:06:19 +0000 (00:06 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 21 Jan 2012 00:12:31 +0000 (00:12 +0000)
Conflicts:
compat.h
trace.py

12 files changed:
1  2 
.gitignore
CMakeLists.txt
compat.h
d2d1trace.py
d3d9trace.py
dwritetrace.py
specs/d2d1.py
specs/dwrite.py
specs/scripts/cdecl.py
specs/stdapi.py
specs/winapi.py
trace.py

diff --cc .gitignore
index 455b6aff1e3271968b40f899a53919a2b73a866e,e16a1f7a6f7100e4fc505e0123596d9c0c5fd352..89057b768b83236cf841158e9a38bd57888c211e
@@@ -28,15 -28,16 +28,18 @@@ _CPack_Package
  CMakeCache.txt
  CMakeFiles
  Makefile
+ apitrace
  build
  cgltrace.cpp
 +d2d1trace.cpp
  d3d10trace.cpp
  d3d8trace.cpp
  d3d9trace.cpp
  ddrawtrace.cpp
 +dwritetrace.cpp
  dxsdk
+ egltrace.cpp
+ eglretrace
  glproc.hpp
  glretrace
  glretrace_gl.cpp
diff --cc CMakeLists.txt
index 0cb0acec21e69952a6ef4b8e61fb488936af8b2f,24e2afc06bcdeb5e52a6e8ccb7ce9f3e1a2851de..e65c529f322a39b6047c3e406eb82fbd90fadb66
@@@ -304,40 -376,9 +376,40 @@@ if (WIN32
              RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
              LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
          )
-         install (TARGETS d3d10 LIBRARY DESTINATION wrappers)
+         install (TARGETS d3d10 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
      endif (DirectX_D3D10_INCLUDE_DIR)
  
 +    # d2d1.dll, dwrite.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)
 +
 +        add_custom_command (
 +            OUTPUT dwritetrace.cpp
 +            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dwritetrace.py > ${CMAKE_CURRENT_BINARY_DIR}/dwritetrace.cpp
 +            DEPENDS dwritetrace.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 (dwrite MODULE specs/dwrite.def dwritetrace.cpp)
 +        set_target_properties (dwrite
 +            PROPERTIES PREFIX ""
 +            RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
 +            LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
 +        )
 +        install (TARGETS dwrite LIBRARY DESTINATION wrappers)
 +    endif (DirectX_D2D1_INCLUDE_DIR)
 +
      # opengl32.dll
      add_custom_command (
          OUTPUT wgltrace.cpp
diff --cc compat.h
index 4573b97794daeb39f2f4daea55cb2bec01785b11,74b45c3c211535955f25ef69f6c880e4627466aa..b74bfd47d69155ce092bc6e2566cd729b37e1ee3
+++ b/compat.h
  #define __field_bcount(x) /**/
  #define __field_ecount(x) /**/
  #define __field_ecount_full(x) /**/
- #define __inline __inline__
+ #define __inline static __inline__
 +#define __deref_out /**/
 +#define __deref_out_opt /**/
 +#define __deref_out_bcount(x)
 +#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
  
- #include <stdint.h>
- #define INT8 int8_t
- #define UINT8 uint8_t
- #define INT16 int16_t
- #define UINT16 uint16_t
 +#ifndef DECLSPEC_NOVTABLE
 +#define DECLSPEC_NOVTABLE
 +#endif
 +
+ #ifndef __MINGW64_VERSION_MAJOR
++#define INT8 signed char
+ #define UINT8 unsigned char
++#define INT16 signed short
++#define UINT16 unsigned short
+ #endif
  
  #endif /* __MINGW32__ */
  
diff --cc d2d1trace.py
index 37cd53e0fc207fdca46359ea5e5ec4fb1864e42b,0000000000000000000000000000000000000000..a99abdaf8e2dc49f51ed16cbc435e41c33d860c1
mode 100644,000000..100644
--- /dev/null
@@@ -1,62 -1,0 +1,62 @@@
- from trace import DllTracer
 +##########################################################################
 +#
 +# 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.
 +#
 +##########################################################################/
 +
 +
-     def wrap_arg(self, function, arg):
++from dlltrace import DllTracer
 +from specs.d2d1 import d2d1
 +
 +
 +class D2D1Tracer(DllTracer):
 +
-         DllTracer.wrap_arg(self, function, arg)
++    def wrapArg(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 '    }'
 +
-     print '#include "trace_writer.hpp"'
++        DllTracer.wrapArg(self, function, arg)
 +
 +
 +if __name__ == '__main__':
 +    print '#define INITGUID'
 +    print
++    print '#include "trace_writer_local.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
 +    print 'DEFINE_GUID(IID_ID2D1Factory,0x06152247,0x6f50,0x465a,0x92,0x45,0x11,0x8b,0xfd,0x3b,0x60,0x07);'
 +    print
 +
 +    tracer = D2D1Tracer('d2d1.dll')
 +    tracer.trace_api(d2d1)
diff --cc d3d9trace.py
index c489be6a6f53a2221533acb12e2898d63db82231,d2ff7d5fccf60ec1ae4fdc63a52629480f77085c..a40ae7f5f1eed1bcb189a3ea78ed848ec0e1d88f
@@@ -30,13 -30,43 +30,43 @@@ from specs.d3d9 import d3d
  
  class D3D9Tracer(DllTracer):
  
-     def dump_arg_instance(self, function, arg):
+     def serializeArgValue(self, function, arg):
          # Dump shaders as strings
          if function.name in ('CreateVertexShader', 'CreatePixelShader') and arg.name == 'pFunction':
-             print '    DumpShader(Trace::localWriter, %s);' % (arg.name)
+             print '    DumpShader(trace::localWriter, %s);' % (arg.name)
              return
  
-         DllTracer.dump_arg_instance(self, function, arg)
+         DllTracer.serializeArgValue(self, function, arg)
+     def declareWrapperInterfaceVariables(self, interface):
+         DllTracer.declareWrapperInterfaceVariables(self, interface)
+         
+         if interface.name == 'IDirect3DVertexBuffer9':
+             print '    UINT m_OffsetToLock;'
+             print '    UINT m_SizeToLock;'
+             print '    VOID *m_pbData;'
 -    def implementWrapperInterfaceMethodBody(self, interface, method):
++    def implementWrapperInterfaceMethodBody(self, interface, base, method):
+         if interface.name == 'IDirect3DVertexBuffer9' and method.name == 'Unlock':
+             print '    if (m_pbData) {'
+             print '        if (!m_SizeToLock) {'
+             print '            D3DVERTEXBUFFER_DESC Desc;'
+             print '            m_pInstance->GetDesc(&Desc);'
+             print '            m_SizeToLock = Desc.Size;'
+             print '        }'
+             self.emit_memcpy('(LPBYTE)m_pbData + m_OffsetToLock', '(LPBYTE)m_pbData + m_OffsetToLock', 'm_SizeToLock')
+             print '    }'
 -        DllTracer.implementWrapperInterfaceMethodBody(self, interface, method)
++        DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method)
+         if interface.name == 'IDirect3DVertexBuffer9' and method.name == 'Lock':
+             print '    if (__result == D3D_OK && !(Flags & D3DLOCK_READONLY)) {'
+             print '        m_OffsetToLock = OffsetToLock;'
+             print '        m_SizeToLock = SizeToLock;'
+             print '        m_pbData = *ppbData;'
+             print '    } else {'
+             print '        m_pbData = NULL;'
+             print '    }'
  
  
  if __name__ == '__main__':
diff --cc dwritetrace.py
index 94f1fbfb36de60e3ea020532fb92424eabd30329,0000000000000000000000000000000000000000..4fc380d4b5d57c1dd8e21cc4ab8202b2f8c2e161
mode 100644,000000..100644
--- /dev/null
@@@ -1,65 -1,0 +1,65 @@@
- from trace import DllTracer
 +##########################################################################
 +#
 +# 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.
 +#
 +##########################################################################/
 +
 +
-     def wrap_arg(self, function, arg):
++from dlltrace import DllTracer
 +from specs.dwrite import dwrite
 +from specs.d2d1 import d2d1 # cyclic dependency
 +
 +
 +class D2D1Tracer(DllTracer):
 +
-         DllTracer.wrap_arg(self, function, arg)
++    def wrapArg(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 = (%s) new Wrap%s((%s *)*%s);' % (arg.name, arg.type, iface.name, iface.name, arg.name)
 +                print '        }'
 +            print '    }'
 +
-     print '#include "trace_writer.hpp"'
++        DllTracer.wrapArg(self, function, arg)
 +
 +
 +if __name__ == '__main__':
 +    print '#define INITGUID'
 +    print
++    print '#include "trace_writer_local.hpp"'
 +    print '#include "os.hpp"'
 +    print
 +    print '#include <windows.h>'
 +    print
 +    print '#include "compat.h"'
 +    print
 +    print '#define DWRITE_EXPORT WINAPI'
 +    print
 +    print '#include <d2d1.h>'
 +    print '#include <dwrite.h>'
 +    print
 +    print 'DEFINE_GUID(IID_IDWriteFactory,0xb859ee5a,0xd838,0x4b5b,0xa2,0xe8,0x1a,0xdc,0x7d,0x93,0xdb,0x48);'
 +    print
 +
 +    tracer = D2D1Tracer('dwrite.dll')
 +    tracer.trace_api(dwrite)
diff --cc specs/d2d1.py
index eed4d6f01de8471e8a56a60e9e230fd30f2b4258,0000000000000000000000000000000000000000..e7ac8df308556420628744ffe813042f86b3f26a
mode 100644,000000..100644
--- /dev/null
@@@ -1,633 -1,0 +1,633 @@@
- d2d1.add_interface(ID2D1Factory)
- d2d1.add_functions([
 +##########################################################################
 +#
 +# 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_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(Array(FLOAT, "dashesCount"), "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(Array(Pointer(ID2D1Geometry), "geometriesCount"), "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", [(Array(Const(D2D1_POINT_2F), "pointsCount"), "points"), (UINT, "pointsCount")]),
 +    Method(Void, "AddBeziers", [(Array(Const(D2D1_BEZIER_SEGMENT), "beziersCount"), "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", [(Array(Const(D2D1_QUADRATIC_BEZIER_SEGMENT), "beziersCount"), "beziers"), (UINT, "beziersCount")]),
 +    Method(Void, "AddArc", [(Pointer(Const(D2D1_ARC_SEGMENT)), "arc")]),
 +]
 +
 +ID2D1TessellationSink.methods += [
 +    Method(Void, "AddTriangles", [(Array(Const(D2D1_TRIANGLE), "trianglesCount"), "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", [(Array(Const(D2D1_GRADIENT_STOP), "gradientStopsCount"), "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.addInterface(ID2D1Factory)
++d2d1.addFunctions([
 +    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 --cc specs/dwrite.py
index dd9286255a3cdc07da6b35f9e60382a37485374a,0000000000000000000000000000000000000000..dac621100456750a83004be400184ae810d07618
mode 100644,000000..100644
--- /dev/null
@@@ -1,776 -1,0 +1,776 @@@
- dwrite.add_interface(IDWriteFactory)
- dwrite.add_functions([
 +##########################################################################
 +#
 +# 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")]),
 +    Method(HRESULT, "GetGdiCompatibleMetrics", [(FLOAT, "emSize"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), Out(Pointer(DWRITE_FONT_METRICS), "fontFaceMetrics")]),
 +    Method(HRESULT, "GetGdiCompatibleGlyphMetrics", [(FLOAT, "emSize"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), (Array(Const(UINT16), "glyphCount"), "glyphIndices"), (UINT32, "glyphCount"), Out(Array(DWRITE_GLYPH_METRICS, "glyphCount"), "glyphMetrics"), (BOOL, "isSideways")]),
 +]
 +
 +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", [(Array(Const(WCHAR), "textLength"), "textString"), (Array(Const(UINT16), "textLength"), "clusterMap"), (Array(DWRITE_SHAPING_TEXT_PROPERTIES, "textLength"), "textProps"), (UINT32, "textLength"), (Array(Const(UINT16), "glyphCount"), "glyphIndices"), (Array(Const(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphCount"), "glyphProps"), (UINT32, "glyphCount"), (Pointer(IDWriteFontFace), "fontFace"), (FLOAT, "fontEmSize"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (LPCWSTR, "localeName"), (Array(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES)), "featureRanges"), "features"), (Array(Const(UINT32), "featureRanges"), "featureRangeLengths"), (UINT32, "featureRanges"), Out(Array(FLOAT, "glyphCount"), "glyphAdvances"), Out(Array(DWRITE_GLYPH_OFFSET, "glyphCount"), "glyphOffsets")]), 
 +    Method(HRESULT, "GetGdiCompatibleGlyphPlacements", [(Array(Const(WCHAR), "textLength"), "textString"), (Array(Const(UINT16), "textLength"), "clusterMap"), (Array(DWRITE_SHAPING_TEXT_PROPERTIES, "textLength"), "textProps"), (UINT32, "textLength"), (Array(Const(UINT16), "glyphCount"), "glyphIndices"), (Array(Const(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphCount"), "glyphProps"), (UINT32, "glyphCount"), (Pointer(IDWriteFontFace), "fontFace"), (FLOAT, "fontEmSize"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (LPCWSTR, "localeName"), (Array(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES)), "featureRanges"), "features"), (Array(Const(UINT32), "featureRanges"), "featureRangeLengths"), (UINT32, "featureRanges"), Out(Array(FLOAT, "glyphCount"), "glyphAdvances"), Out(Array(DWRITE_GLYPH_OFFSET, "glyphCount"), "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.addInterface(IDWriteFactory)
++dwrite.addFunctions([
 +    StdFunction(HRESULT, "DWriteCreateFactory", [(DWRITE_FACTORY_TYPE, "factoryType"), (REFIID, "iid"), Out(Pointer(Pointer(IUnknown)), "factory")]),
 +])
Simple merge
diff --cc specs/stdapi.py
index c4fc14af7ee2ffd7f3b68d535103605abbe8066c,44d4680a7e53467a8a464bddac2a2c63b2050416..b6bab8f542e2744ee642b3a7ffafa4663e05d9f1
@@@ -295,14 -349,6 +349,14 @@@ class Interface(Type)
          for method in self.methods:
              yield method
          raise StopIteration
-     def itermethods2(self):
 +    
-             for iface, method in self.base.itermethods2():
++    def iterBaseMethods(self):
 +        if self.base is not None:
++            for iface, method in self.base.iterBaseMethods():
 +                yield iface, method
 +        for method in self.methods:
 +            yield self, method
 +        raise StopIteration
  
  
  class Method(Function):
diff --cc specs/winapi.py
Simple merge
diff --cc trace.py
index 53045f260f892c9d17e624bd4f23b9e73fbcd493,4d2f055794c4974646dcb0f27e2ee480e5d88236..38005008941efeb4e3744cbecf1ac3a9a5a01a66
+++ b/trace.py
@@@ -397,43 -458,51 +458,51 @@@ class Tracer
          print '    m_pInstance = pInstance;'
          print '}'
          print
-         print '%s::~%s() {' % (interface_wrap_name(interface), interface_wrap_name(interface))
+         print '%s::~%s() {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface))
          print '}'
          print
-         for base, method in interface.itermethods2():
-             self.trace_method(interface, base, method)
 -        for method in interface.iterMethods():
 -            self.implementWrapperInterfaceMethod(interface, method)
++        for base, method in interface.iterBaseMethods():
++            self.implementWrapperInterfaceMethod(interface, base, method)
+         print
 -    def implementWrapperInterfaceMethod(self, interface, method):
++    def implementWrapperInterfaceMethod(self, interface, base, method):
+         print method.prototype(getWrapperInterfaceName(interface) + '::' + method.name) + ' {'
+         if method.type is not stdapi.Void:
+             print '    %s __result;' % method.type
+     
 -        self.implementWrapperInterfaceMethodBody(interface, method)
++        self.implementWrapperInterfaceMethodBody(interface, base, method)
+     
+         if method.type is not stdapi.Void:
+             print '    return __result;'
+         print '}'
          print
  
-     def trace_method(self, interface, base, method):
-         print method.prototype(interface_wrap_name(interface) + '::' + method.name) + ' {'
 -    def implementWrapperInterfaceMethodBody(self, interface, method):
++    def implementWrapperInterfaceMethodBody(self, interface, base, method):
          print '    static const char * __args[%u] = {%s};' % (len(method.args) + 1, ', '.join(['"this"'] + ['"%s"' % arg.name for arg in method.args]))
-         print '    static const Trace::FunctionSig __sig = {%u, "%s", %u, __args};' % (int(method.id), interface.name + '::' + method.name, len(method.args) + 1)
-         print '    unsigned __call = Trace::localWriter.beginEnter(&__sig);'
-         print '    Trace::localWriter.beginArg(0);'
-         print '    Trace::localWriter.writeOpaque((const void *)m_pInstance);'
-         print '    Trace::localWriter.endArg();'
+         print '    static const trace::FunctionSig __sig = {%u, "%s", %u, __args};' % (method.id, interface.name + '::' + method.name, len(method.args) + 1)
+         print '    unsigned __call = trace::localWriter.beginEnter(&__sig);'
+         print '    trace::localWriter.beginArg(0);'
+         print '    trace::localWriter.writeOpaque((const void *)m_pInstance);'
+         print '    trace::localWriter.endArg();'
          for arg in method.args:
              if not arg.output:
-                 self.unwrap_arg(method, arg)
-                 self.dump_arg(method, arg)
-         if method.type is stdapi.Void:
-             result = ''
-         else:
-             print '    %s __result;' % method.type
-             result = '__result = '
-         print '    Trace::localWriter.endEnter();'
-         print '    %sstatic_cast<%s *>(m_pInstance)->%s(%s);' % (result, base, method.name, ', '.join([str(arg.name) for arg in method.args]))
-         print '    Trace::localWriter.beginLeave(__call);'
+                 self.unwrapArg(method, arg)
+                 self.serializeArg(method, arg)
+         print '    trace::localWriter.endEnter();'
+         
 -        self.invokeMethod(interface, method)
++        self.invokeMethod(interface, base, method)
+         print '    trace::localWriter.beginLeave(__call);'
          for arg in method.args:
              if arg.output:
-                 self.dump_arg(method, arg)
-                 self.wrap_arg(method, arg)
+                 self.serializeArg(method, arg)
+                 self.wrapArg(method, arg)
          if method.type is not stdapi.Void:
-             print '    Trace::localWriter.beginReturn();'
-             dump_instance(method.type, "__result")
-             print '    Trace::localWriter.endReturn();'
-             wrap_instance(method.type, '__result')
-         print '    Trace::localWriter.endLeave();'
+             print '    trace::localWriter.beginReturn();'
+             self.serializeValue(method.type, "__result")
+             print '    trace::localWriter.endReturn();'
+             self.wrapValue(method.type, '__result')
+         print '    trace::localWriter.endLeave();'
          if method.name == 'QueryInterface':
              print '    if (ppvObj && *ppvObj) {'
              print '        if (*ppvObj == m_pInstance) {'
              assert method.type is not stdapi.Void
              print '    if (!__result)'
              print '        delete this;'
-         if method.type is not stdapi.Void:
-             print '    return __result;'
-         print '}'
-         print
- class DllTracer(Tracer):
  
-     def __init__(self, dllname):
-         self.dllname = dllname
 -    def invokeMethod(self, interface, method):
++    def invokeMethod(self, interface, base, method):
+         if method.type is stdapi.Void:
+             result = ''
+         else:
+             result = '__result = '
 -        print '    %sm_pInstance->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args]))
++        print '    %sstatic_cast<%s *>(m_pInstance)->%s(%s);' % (result, base, method.name, ', '.join([str(arg.name) for arg in method.args]))
      
-     def header(self, api):
-         print '''
- static HINSTANCE g_hDll = NULL;
- static PROC
- __getPublicProcAddress(LPCSTR lpProcName)
- {
-     if (!g_hDll) {
-         char szDll[MAX_PATH] = {0};
-         
-         if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
-             return NULL;
-         }
-         
-         strcat(szDll, "\\\\%s");
-         
-         g_hDll = LoadLibraryA(szDll);
-         if (!g_hDll) {
-             return NULL;
-         }
-     }
-         
-     return GetProcAddress(g_hDll, lpProcName);
- }
- ''' % self.dllname
-         dispatcher = Dispatcher()
-         dispatcher.dispatch_api(api)
-         Tracer.header(self, api)
+     def emit_memcpy(self, dest, src, length):
+         print '        unsigned __call = trace::localWriter.beginEnter(&trace::memcpy_sig);'
+         print '        trace::localWriter.beginArg(0);'
+         print '        trace::localWriter.writeOpaque(%s);' % dest
+         print '        trace::localWriter.endArg();'
+         print '        trace::localWriter.beginArg(1);'
+         print '        trace::localWriter.writeBlob(%s, %s);' % (src, length)
+         print '        trace::localWriter.endArg();'
+         print '        trace::localWriter.beginArg(2);'
+         print '        trace::localWriter.writeUInt(%s);' % length
+         print '        trace::localWriter.endArg();'
+         print '        trace::localWriter.endEnter();'
+         print '        trace::localWriter.beginLeave(__call);'
+         print '        trace::localWriter.endLeave();'
+