]> git.cworth.org Git - apitrace/commitdiff
Merge branch 'master' into d2d
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 7 Nov 2012 07:20:06 +0000 (07:20 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 7 Nov 2012 07:20:06 +0000 (07:20 +0000)
14 files changed:
cmake/FindDirectX.cmake
dispatch/d2dimports.hpp [new file with mode: 0644]
specs/d2d1.py [new file with mode: 0644]
specs/d2dbasetypes.py [new file with mode: 0644]
specs/d2derr.py [new file with mode: 0644]
specs/dcommon.py [new file with mode: 0644]
specs/dwrite.py [new file with mode: 0644]
wrappers/.gitignore
wrappers/CMakeLists.txt
wrappers/d2d1.def [new file with mode: 0644]
wrappers/d2d1trace.py [new file with mode: 0644]
wrappers/dwrite.def [new file with mode: 0644]
wrappers/dwritetrace.py [new file with mode: 0644]
wrappers/trace.py

index cbbe4f134506e6f4c2d7a3e52b1c1f8a8f37c77a..43472fad19306fcea027928943717dd9ef0be8e1 100644 (file)
@@ -213,6 +213,21 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                DOC "Path to fxc.exe executable.")
 
 
+       find_path (DirectX_D2D1_INCLUDE_DIR d2d1.h
+               PATHS
+                       "${DirectX_ROOT_DIR}/Include"
+               DOC "The directory where d2d1.h resides")
+
+       find_library (DirectX_D2D1_LIBRARY d2d1
+               PATHS
+                       "${DirectX_ROOT_DIR}/Lib/x86"
+               DOC "The directory where d2d1 resides")
+
+       if (DirectX_D2D1_INCLUDE_DIR AND DirectX_D2D1_LIBRARY)
+               set (DirectX_D2D1_FOUND 1)
+       endif (DirectX_D2D1_INCLUDE_DIR AND DirectX_D2D1_LIBRARY)
+
+
        mark_as_advanced (
                DirectX_D3D_INCLUDE_DIR
                DirectX_D3D_INCLUDE_DIR
@@ -245,6 +260,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                DirectX_D3DX11_INCLUDE_DIR
                DirectX_D3DX11_LIBRARY
                DirectX_D3D11_1_INCLUDE_DIR
+               DirectX_D2D1_INCLUDE_DIR
+               DirectX_D2D1_LIBRARY
        )
 
 
@@ -264,6 +281,7 @@ mark_as_advanced (
        DirectX_D3D11_FOUND
        DirectX_D3DX11_FOUND
        DirectX_D3D11_1_FOUND
+       DirectX_D2D1_FOUND
 )
 
 
diff --git a/dispatch/d2dimports.hpp b/dispatch/d2dimports.hpp
new file mode 100644 (file)
index 0000000..4a2594b
--- /dev/null
@@ -0,0 +1,98 @@
+/**************************************************************************
+ *
+ * Copyright 2012 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.
+ *
+ **************************************************************************/
+
+/*
+ * Central place for all D2D/DWRITE includes, and respective OS dependent headers.
+ */
+
+#ifndef _D2DIMPORTS_HPP_
+#define _D2DIMPORTS_HPP_
+
+#include <windows.h>
+#include <tchar.h>
+
+#include "compat.h"
+
+#include <d2d1.h>
+#include <dwrite.h>
+
+DEFINE_GUID(IID_ID2D1Resource,0x2cd90691,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1Bitmap,0xa2296057,0xea42,0x4099,0x98,0x3b,0x53,0x9f,0xb6,0x50,0x54,0x26);
+DEFINE_GUID(IID_ID2D1GradientStopCollection,0x2cd906a7,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1Brush,0x2cd906a8,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1BitmapBrush,0x2cd906aa,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1SolidColorBrush,0x2cd906a9,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1LinearGradientBrush,0x2cd906ab,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1RadialGradientBrush,0x2cd906ac,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1StrokeStyle,0x2cd9069d,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1Geometry,0x2cd906a1,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1RectangleGeometry,0x2cd906a2,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1RoundedRectangleGeometry,0x2cd906a3,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1EllipseGeometry,0x2cd906a4,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1GeometryGroup,0x2cd906a6,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1TransformedGeometry,0x2cd906bb,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1SimplifiedGeometrySink,0x2cd9069e,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1GeometrySink,0x2cd9069f,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1TessellationSink,0x2cd906c1,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1PathGeometry,0x2cd906a5,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1Mesh,0x2cd906c2,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1Layer,0x2cd9069b,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1DrawingStateBlock,0x28506e39,0xebf6,0x46a1,0xbb,0x47,0xfd,0x85,0x56,0x5a,0xb9,0x57);
+DEFINE_GUID(IID_ID2D1RenderTarget,0x2cd90694,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1BitmapRenderTarget,0x2cd90695,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1HwndRenderTarget,0x2cd90698,0x12e2,0x11dc,0x9f,0xed,0x00,0x11,0x43,0xa0,0x55,0xf9);
+DEFINE_GUID(IID_ID2D1GdiInteropRenderTarget,0xe0db51c3,0x6f77,0x4bae,0xb3,0xd5,0xe4,0x75,0x09,0xb3,0x58,0x38);
+DEFINE_GUID(IID_ID2D1DCRenderTarget,0x1c51bc64,0xde61,0x46fd,0x98,0x99,0x63,0xa5,0xd8,0xf0,0x39,0x50);
+DEFINE_GUID(IID_ID2D1Factory,0x06152247,0x6f50,0x465a,0x92,0x45,0x11,0x8b,0xfd,0x3b,0x60,0x07);
+
+DEFINE_GUID(IID_IDWriteFontFileLoader,0x727cad4e,0xd6af,0x4c9e,0x8a,0x08,0xd6,0x95,0xb1,0x1c,0xaa,0x49);
+DEFINE_GUID(IID_IDWriteLocalFontFileLoader,0xb2d9f3ec,0xc9fe,0x4a11,0xa2,0xec,0xd8,0x62,0x08,0xf7,0xc0,0xa2);
+DEFINE_GUID(IID_IDWriteFontFileStream,0x6d4865fe,0x0ab8,0x4d91,0x8f,0x62,0x5d,0xd6,0xbe,0x34,0xa3,0xe0);
+DEFINE_GUID(IID_IDWriteFontFile,0x739d886a,0xcef5,0x47dc,0x87,0x69,0x1a,0x8b,0x41,0xbe,0xbb,0xb0);
+DEFINE_GUID(IID_IDWriteRenderingParams,0x2f0da53a,0x2add,0x47cd,0x82,0xee,0xd9,0xec,0x34,0x68,0x8e,0x75);
+DEFINE_GUID(IID_IDWriteFontFace,0x5f49804d,0x7024,0x4d43,0xbf,0xa9,0xd2,0x59,0x84,0xf5,0x38,0x49);
+DEFINE_GUID(IID_IDWriteFontCollectionLoader,0xcca920e4,0x52f0,0x492b,0xbf,0xa8,0x29,0xc7,0x2e,0xe0,0xa4,0x68);
+DEFINE_GUID(IID_IDWriteFontFileEnumerator,0x72755049,0x5ff7,0x435d,0x83,0x48,0x4b,0xe9,0x7c,0xfa,0x6c,0x7c);
+DEFINE_GUID(IID_IDWriteLocalizedStrings,0x08256209,0x099a,0x4b34,0xb8,0x6d,0xc2,0x2b,0x11,0x0e,0x77,0x71);
+DEFINE_GUID(IID_IDWriteFontCollection,0xa84cee02,0x3eea,0x4eee,0xa8,0x27,0x87,0xc1,0xa0,0x2a,0x0f,0xcc);
+DEFINE_GUID(IID_IDWriteFontList,0x1a0d8438,0x1d97,0x4ec1,0xae,0xf9,0xa2,0xfb,0x86,0xed,0x6a,0xcb);
+DEFINE_GUID(IID_IDWriteFontFamily,0xda20d8ef,0x812a,0x4c43,0x98,0x02,0x62,0xec,0x4a,0xbd,0x7a,0xdd);
+DEFINE_GUID(IID_IDWriteFont,0xacd16696,0x8c14,0x4f5d,0x87,0x7e,0xfe,0x3f,0xc1,0xd3,0x27,0x37);
+DEFINE_GUID(IID_IDWriteTextFormat,0x9c906818,0x31d7,0x4fd3,0xa1,0x51,0x7c,0x5e,0x22,0x5d,0xb5,0x5a);
+DEFINE_GUID(IID_IDWriteTypography,0x55f1112b,0x1dc2,0x4b3c,0x95,0x41,0xf4,0x68,0x94,0xed,0x85,0xb6);
+DEFINE_GUID(IID_IDWriteNumberSubstitution,0x14885CC9,0xBAB0,0x4f90,0xB6,0xED,0x5C,0x36,0x6A,0x2C,0xD0,0x3D);
+DEFINE_GUID(IID_IDWriteTextAnalysisSource,0x688e1a58,0x5094,0x47c8,0xad,0xc8,0xfb,0xce,0xa6,0x0a,0xe9,0x2b);
+DEFINE_GUID(IID_IDWriteTextAnalysisSink,0x5810cd44,0x0ca0,0x4701,0xb3,0xfa,0xbe,0xc5,0x18,0x2a,0xe4,0xf6);
+DEFINE_GUID(IID_IDWriteTextAnalyzer,0xb7e6163e,0x7f46,0x43b4,0x84,0xb3,0xe4,0xe6,0x24,0x9c,0x36,0x5d);
+DEFINE_GUID(IID_IDWriteInlineObject,0x8339FDE3,0x106F,0x47ab,0x83,0x73,0x1C,0x62,0x95,0xEB,0x10,0xB3);
+DEFINE_GUID(IID_IDWritePixelSnapping,0xeaf3a2da,0xecf4,0x4d24,0xb6,0x44,0xb3,0x4f,0x68,0x42,0x02,0x4b);
+DEFINE_GUID(IID_IDWriteTextRenderer,0xef8a8135,0x5cc6,0x45fe,0x88,0x25,0xc5,0xa0,0x72,0x4e,0xb8,0x19);
+DEFINE_GUID(IID_IDWriteTextLayout,0x53737037,0x6d14,0x410b,0x9b,0xfe,0x0b,0x18,0x2b,0xb7,0x09,0x61);
+DEFINE_GUID(IID_IDWriteBitmapRenderTarget,0x5e5a32a3,0x8dff,0x4773,0x9f,0xf6,0x06,0x96,0xea,0xb7,0x72,0x67);
+DEFINE_GUID(IID_IDWriteGdiInterop,0x1edd9491,0x9853,0x4299,0x89,0x8f,0x64,0x32,0x98,0x3b,0x6f,0x3a);
+DEFINE_GUID(IID_IDWriteGlyphRunAnalysis,0x7d97dbf7,0xe085,0x42d4,0x81,0xe3,0x6a,0x88,0x3b,0xde,0xd1,0x18);
+DEFINE_GUID(IID_IDWriteFactory,0xb859ee5a,0xd838,0x4b5b,0xa2,0xe8,0x1a,0xdc,0x7d,0x93,0xdb,0x48);
+
+#endif /* _D2DIMPORTS_HPP_ */
diff --git a/specs/d2d1.py b/specs/d2d1.py
new file mode 100644 (file)
index 0000000..73e390c
--- /dev/null
@@ -0,0 +1,633 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+from dxgiformat import DXGI_FORMAT
+from dxgi import IDXGISurface
+from d2derr import *
+from d2dbasetypes import *
+from dwrite import *
+
+
+ID2D1Resource = Interface("ID2D1Resource", IUnknown)
+ID2D1Bitmap = Interface("ID2D1Bitmap", ID2D1Resource)
+ID2D1GradientStopCollection = Interface("ID2D1GradientStopCollection", ID2D1Resource)
+ID2D1Brush = Interface("ID2D1Brush", ID2D1Resource)
+ID2D1BitmapBrush = Interface("ID2D1BitmapBrush", ID2D1Brush)
+ID2D1SolidColorBrush = Interface("ID2D1SolidColorBrush", ID2D1Brush)
+ID2D1LinearGradientBrush = Interface("ID2D1LinearGradientBrush", ID2D1Brush)
+ID2D1RadialGradientBrush = Interface("ID2D1RadialGradientBrush", ID2D1Brush)
+ID2D1StrokeStyle = Interface("ID2D1StrokeStyle", ID2D1Resource)
+ID2D1Geometry = Interface("ID2D1Geometry", ID2D1Resource)
+ID2D1RectangleGeometry = Interface("ID2D1RectangleGeometry", ID2D1Geometry)
+ID2D1RoundedRectangleGeometry = Interface("ID2D1RoundedRectangleGeometry", ID2D1Geometry)
+ID2D1EllipseGeometry = Interface("ID2D1EllipseGeometry", ID2D1Geometry)
+ID2D1GeometryGroup = Interface("ID2D1GeometryGroup", ID2D1Geometry)
+ID2D1TransformedGeometry = Interface("ID2D1TransformedGeometry", ID2D1Geometry)
+ID2D1GeometrySink = Interface("ID2D1GeometrySink", ID2D1SimplifiedGeometrySink)
+ID2D1TessellationSink = Interface("ID2D1TessellationSink", IUnknown)
+ID2D1PathGeometry = Interface("ID2D1PathGeometry", ID2D1Geometry)
+ID2D1Mesh = Interface("ID2D1Mesh", ID2D1Resource)
+ID2D1Layer = Interface("ID2D1Layer", ID2D1Resource)
+ID2D1DrawingStateBlock = Interface("ID2D1DrawingStateBlock", ID2D1Resource)
+ID2D1RenderTarget = Interface("ID2D1RenderTarget", ID2D1Resource)
+ID2D1BitmapRenderTarget = Interface("ID2D1BitmapRenderTarget", ID2D1RenderTarget)
+ID2D1HwndRenderTarget = Interface("ID2D1HwndRenderTarget", ID2D1RenderTarget)
+ID2D1GdiInteropRenderTarget = Interface("ID2D1GdiInteropRenderTarget", IUnknown)
+ID2D1DCRenderTarget = Interface("ID2D1DCRenderTarget", ID2D1RenderTarget)
+ID2D1Factory = Interface("ID2D1Factory", IUnknown)
+
+
+D2D1_ALPHA_MODE = Enum("D2D1_ALPHA_MODE", [
+    "D2D1_ALPHA_MODE_UNKNOWN",
+    "D2D1_ALPHA_MODE_PREMULTIPLIED",
+    "D2D1_ALPHA_MODE_STRAIGHT",
+    "D2D1_ALPHA_MODE_IGNORE",
+])
+
+D2D1_GAMMA = Enum("D2D1_GAMMA", [
+    "D2D1_GAMMA_2_2",
+    "D2D1_GAMMA_1_0",
+])
+
+D2D1_OPACITY_MASK_CONTENT = Enum("D2D1_OPACITY_MASK_CONTENT", [
+    "D2D1_OPACITY_MASK_CONTENT_GRAPHICS",
+    "D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL",
+    "D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE",
+])
+
+D2D1_EXTEND_MODE = Enum("D2D1_EXTEND_MODE", [
+    "D2D1_EXTEND_MODE_CLAMP",
+    "D2D1_EXTEND_MODE_WRAP",
+    "D2D1_EXTEND_MODE_MIRROR",
+])
+
+D2D1_ANTIALIAS_MODE = Enum("D2D1_ANTIALIAS_MODE", [
+    "D2D1_ANTIALIAS_MODE_PER_PRIMITIVE",
+    "D2D1_ANTIALIAS_MODE_ALIASED",
+])
+
+D2D1_TEXT_ANTIALIAS_MODE = Enum("D2D1_TEXT_ANTIALIAS_MODE", [
+    "D2D1_TEXT_ANTIALIAS_MODE_DEFAULT",
+    "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE",
+    "D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE",
+    "D2D1_TEXT_ANTIALIAS_MODE_ALIASED",
+])
+
+D2D1_BITMAP_INTERPOLATION_MODE = Enum("D2D1_BITMAP_INTERPOLATION_MODE", [
+    "D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR",
+    "D2D1_BITMAP_INTERPOLATION_MODE_LINEAR",
+])
+
+D2D1_DRAW_TEXT_OPTIONS = EnumFlag("D2D1_DRAW_TEXT_OPTIONS", [
+    "D2D1_DRAW_TEXT_OPTIONS_NONE",
+    "D2D1_DRAW_TEXT_OPTIONS_NO_SNAP",
+    "D2D1_DRAW_TEXT_OPTIONS_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"),
+    (ObjPointer(ID2D1Geometry), "geometricMask"),
+    (D2D1_ANTIALIAS_MODE, "maskAntialiasMode"),
+    (D2D1_MATRIX_3X2_F, "maskTransform"),
+    (FLOAT, "opacity"),
+    (ObjPointer(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(ObjPointer(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"), (ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
+    Method(HRESULT, "CopyFromRenderTarget", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (ObjPointer(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", [(ObjPointer(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(ObjPointer(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(ObjPointer(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(ObjPointer(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"), (ObjPointer(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"), (ObjPointer(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", [(ObjPointer(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"), (ObjPointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "Tessellate", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1TessellationSink), "tessellationSink")], const=True),
+    Method(HRESULT, "CombineWithGeometry", [(ObjPointer(ID2D1Geometry), "inputGeometry"), (D2D1_COMBINE_MODE, "combineMode"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
+    Method(HRESULT, "Outline", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(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"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (ObjPointer(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(ObjPointer(ID2D1Geometry), "geometriesCount"), "geometries"), (UINT, "geometriesCount")], const=True),
+]
+
+ID2D1TransformedGeometry.methods += [
+    Method(Void, "GetSourceGeometry", [Out(Pointer(ObjPointer(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(ObjPointer(ID2D1GeometrySink)), "geometrySink")]),
+    Method(HRESULT, "Stream", [(ObjPointer(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(ObjPointer(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", [(ObjPointer(IDWriteRenderingParams), "textRenderingParams")]),
+    Method(Void, "GetTextRenderingParams", [Out(Pointer(ObjPointer(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(ObjPointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateBitmapFromWicBitmap", [(Opaque("IWICBitmapSource *"), "wicBitmapSource"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateSharedBitmap", [(REFIID, "riid"), Out(OpaquePointer(Void), "data"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(ObjPointer(ID2D1Bitmap)), "bitmap")]),
+    Method(HRESULT, "CreateBitmapBrush", [(ObjPointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_BITMAP_BRUSH_PROPERTIES)), "bitmapBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(ObjPointer(ID2D1BitmapBrush)), "bitmapBrush")]),
+    Method(HRESULT, "CreateSolidColorBrush", [(Pointer(Const(D2D1_COLOR_F)), "color"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(ObjPointer(ID2D1SolidColorBrush)), "solidColorBrush")]),
+    Method(HRESULT, "CreateGradientStopCollection", [(Array(Const(D2D1_GRADIENT_STOP), "gradientStopsCount"), "gradientStops"), (UINT, "gradientStopsCount"), (D2D1_GAMMA, "colorInterpolationGamma"), (D2D1_EXTEND_MODE, "extendMode"), Out(Pointer(ObjPointer(ID2D1GradientStopCollection)), "gradientStopCollection")]),
+    Method(HRESULT, "CreateLinearGradientBrush", [(Pointer(Const(D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)), "linearGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (ObjPointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(ObjPointer(ID2D1LinearGradientBrush)), "linearGradientBrush")]),
+    Method(HRESULT, "CreateRadialGradientBrush", [(Pointer(Const(D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES)), "radialGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (ObjPointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(ObjPointer(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(ObjPointer(ID2D1BitmapRenderTarget)), "bitmapRenderTarget")]),
+    Method(HRESULT, "CreateLayer", [(Pointer(Const(D2D1_SIZE_F)), "size"), Out(Pointer(ObjPointer(ID2D1Layer)), "layer")]),
+    Method(HRESULT, "CreateMesh", [Out(Pointer(ObjPointer(ID2D1Mesh)), "mesh")]),
+    Method(Void, "DrawLine", [(D2D1_POINT_2F, "point0"), (D2D1_POINT_2F, "point1"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "DrawRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (ObjPointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (ObjPointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (ObjPointer(ID2D1Brush), "brush")]),
+    Method(Void, "DrawGeometry", [(ObjPointer(ID2D1Geometry), "geometry"), (ObjPointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (ObjPointer(ID2D1StrokeStyle), "strokeStyle")]),
+    Method(Void, "FillGeometry", [(ObjPointer(ID2D1Geometry), "geometry"), (ObjPointer(ID2D1Brush), "brush"), (ObjPointer(ID2D1Brush), "opacityBrush")]),
+    Method(Void, "FillMesh", [(ObjPointer(ID2D1Mesh), "mesh"), (ObjPointer(ID2D1Brush), "brush")]),
+    Method(Void, "FillOpacityMask", [(ObjPointer(ID2D1Bitmap), "opacityMask"), (ObjPointer(ID2D1Brush), "brush"), (D2D1_OPACITY_MASK_CONTENT, "content"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
+    Method(Void, "DrawBitmap", [(ObjPointer(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"), (ObjPointer(IDWriteTextFormat), "textFormat"), (Pointer(Const(D2D1_RECT_F)), "layoutRect"), (ObjPointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options"), (DWRITE_MEASURING_MODE, "measuringMode")]),
+    Method(Void, "DrawTextLayout", [(D2D1_POINT_2F, "origin"), (ObjPointer(IDWriteTextLayout), "textLayout"), (ObjPointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options")]),
+    Method(Void, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (ObjPointer(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", [(ObjPointer(IDWriteRenderingParams), "textRenderingParams")]),
+    Method(Void, "GetTextRenderingParams", [Out(Pointer(ObjPointer(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"), (ObjPointer(ID2D1Layer), "layer")]),
+    Method(Void, "PopLayer", []),
+    Method(HRESULT, "Flush", [Out(Pointer(D2D1_TAG), "tag1"), Out(Pointer(D2D1_TAG), "tag2")]),
+    Method(Void, "SaveDrawingState", [(ObjPointer(ID2D1DrawingStateBlock), "drawingStateBlock")], const=True),
+    Method(Void, "RestoreDrawingState", [(ObjPointer(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(ObjPointer(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(ObjPointer(ID2D1RectangleGeometry)), "rectangleGeometry")]),
+    Method(HRESULT, "CreateRoundedRectangleGeometry", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRectangle"), Out(Pointer(ObjPointer(ID2D1RoundedRectangleGeometry)), "roundedRectangleGeometry")]),
+    Method(HRESULT, "CreateEllipseGeometry", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), Out(Pointer(ObjPointer(ID2D1EllipseGeometry)), "ellipseGeometry")]),
+    Method(HRESULT, "CreateGeometryGroup", [(D2D1_FILL_MODE, "fillMode"), (Pointer(ObjPointer(ID2D1Geometry)), "geometries"), (UINT, "geometriesCount"), Out(Pointer(ObjPointer(ID2D1GeometryGroup)), "geometryGroup")]),
+    Method(HRESULT, "CreateTransformedGeometry", [(ObjPointer(ID2D1Geometry), "sourceGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "transform"), Out(Pointer(ObjPointer(ID2D1TransformedGeometry)), "transformedGeometry")]),
+    Method(HRESULT, "CreatePathGeometry", [Out(Pointer(ObjPointer(ID2D1PathGeometry)), "pathGeometry")]),
+    Method(HRESULT, "CreateStrokeStyle", [(Pointer(Const(D2D1_STROKE_STYLE_PROPERTIES)), "strokeStyleProperties"), (Pointer(Const(FLOAT)), "dashes"), (UINT, "dashesCount"), Out(Pointer(ObjPointer(ID2D1StrokeStyle)), "strokeStyle")]),
+    Method(HRESULT, "CreateDrawingStateBlock", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "drawingStateDescription"), (ObjPointer(IDWriteRenderingParams), "textRenderingParams"), Out(Pointer(ObjPointer(ID2D1DrawingStateBlock)), "drawingStateBlock")]),
+    Method(HRESULT, "CreateWicBitmapRenderTarget", [(Opaque("IWICBitmap *"), "target"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(ObjPointer(ID2D1RenderTarget)), "renderTarget")]),
+    Method(HRESULT, "CreateHwndRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), (Pointer(Const(D2D1_HWND_RENDER_TARGET_PROPERTIES)), "hwndRenderTargetProperties"), Out(Pointer(ObjPointer(ID2D1HwndRenderTarget)), "hwndRenderTarget")]),
+    Method(HRESULT, "CreateDxgiSurfaceRenderTarget", [(ObjPointer(IDXGISurface), "dxgiSurface"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(ObjPointer(ID2D1RenderTarget)), "renderTarget")]),
+    Method(HRESULT, "CreateDCRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(ObjPointer(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 --git a/specs/d2dbasetypes.py b/specs/d2dbasetypes.py
new file mode 100644 (file)
index 0000000..86ba794
--- /dev/null
@@ -0,0 +1,80 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+
+
+D3DCOLORVALUE = Struct("D3DCOLORVALUE", [
+    (FLOAT, "r"),
+    (FLOAT, "g"),
+    (FLOAT, "b"),
+    (FLOAT, "a"),
+])
+
+D2D_POINT_2U = Struct("D2D_POINT_2U", [
+    (UINT32, "x"),
+    (UINT32, "y"),
+])
+
+D2D_POINT_2F = Struct("D2D_POINT_2F", [
+    (FLOAT, "x"),
+    (FLOAT, "y"),
+])
+
+D2D_RECT_F = Struct("D2D_RECT_F", [
+    (FLOAT, "left"),
+    (FLOAT, "top"),
+    (FLOAT, "right"),
+    (FLOAT, "bottom"),
+])
+
+D2D_RECT_U = Struct("D2D_RECT_U", [
+    (UINT32, "left"),
+    (UINT32, "top"),
+    (UINT32, "right"),
+    (UINT32, "bottom"),
+])
+
+D2D_SIZE_F = Struct("D2D_SIZE_F", [
+    (FLOAT, "width"),
+    (FLOAT, "height"),
+])
+
+D2D_SIZE_U = Struct("D2D_SIZE_U", [
+    (UINT32, "width"),
+    (UINT32, "height"),
+])
+
+D2D_COLOR_F = Alias("D2D_COLOR_F", D3DCOLORVALUE)
+D2D_MATRIX_3X2_F = Struct("D2D_MATRIX_3X2_F", [
+    (FLOAT, "_11"),
+    (FLOAT, "_12"),
+    (FLOAT, "_21"),
+    (FLOAT, "_22"),
+    (FLOAT, "_31"),
+    (FLOAT, "_32"),
+])
+
diff --git a/specs/d2derr.py b/specs/d2derr.py
new file mode 100644 (file)
index 0000000..35898ac
--- /dev/null
@@ -0,0 +1,62 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+
+
+HRESULT = Enum("HRESULT", [
+    "D2DERR_UNSUPPORTED_PIXEL_FORMAT",
+    "D2DERR_INSUFFICIENT_BUFFER",
+    "D2DERR_WRONG_STATE",
+    "D2DERR_NOT_INITIALIZED",
+    "D2DERR_UNSUPPORTED_OPERATION",
+    "D2DERR_SCANNER_FAILED",
+    "D2DERR_SCREEN_ACCESS_DENIED",
+    "D2DERR_DISPLAY_STATE_INVALID",
+    "D2DERR_ZERO_VECTOR",
+    "D2DERR_INTERNAL_ERROR",
+    "D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED",
+    "D2DERR_INVALID_CALL",
+    "D2DERR_NO_HARDWARE_DEVICE",
+    "D2DERR_RECREATE_TARGET",
+    "D2DERR_TOO_MANY_SHADER_ELEMENTS",
+    "D2DERR_SHADER_COMPILE_FAILED",
+    "D2DERR_MAX_TEXTURE_SIZE_EXCEEDED",
+    "D2DERR_UNSUPPORTED_VERSION",
+    "D2DERR_BAD_NUMBER",
+    "D2DERR_WRONG_FACTORY",
+    "D2DERR_LAYER_ALREADY_IN_USE",
+    "D2DERR_POP_CALL_DID_NOT_MATCH_PUSH",
+    "D2DERR_WRONG_RENDER_TARGET",
+    "D2DERR_PUSH_POP_UNBALANCED",
+    "D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT",
+    "D2DERR_INCOMPATIBLE_BRUSH_TYPES",
+    "D2DERR_WIN32_ERROR",
+    "D2DERR_TARGET_NOT_GDI_COMPATIBLE",
+    "D2DERR_TEXT_EFFECT_IS_WRONG_TYPE",
+    "D2DERR_TEXT_RENDERER_NOT_RELEASED",
+    "D2DERR_EXCEEDS_MAX_BITMAP_SIZE",
+])
diff --git a/specs/dcommon.py b/specs/dcommon.py
new file mode 100644 (file)
index 0000000..21659a5
--- /dev/null
@@ -0,0 +1,34 @@
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+
+
+DWRITE_MEASURING_MODE = Enum("DWRITE_MEASURING_MODE", [
+    "DWRITE_MEASURING_MODE_NATURAL",
+    "DWRITE_MEASURING_MODE_GDI_CLASSIC",
+    "DWRITE_MEASURING_MODE_GDI_NATURAL",
+])
diff --git a/specs/dwrite.py b/specs/dwrite.py
new file mode 100644 (file)
index 0000000..88c6b83
--- /dev/null
@@ -0,0 +1,776 @@
+##########################################################################
+#
+# 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(ObjPointer(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(ObjPointer(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(ObjPointer(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"), (ObjPointer(IDWriteGeometrySink), "geometrySink")]),
+    Method(HRESULT, "GetRecommendedRenderingMode", [(FLOAT, "emSize"), (FLOAT, "pixelsPerDip"), (DWRITE_MEASURING_MODE, "measuringMode"), (ObjPointer(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", [(ObjPointer(IDWriteFactory), "factory"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(ObjPointer(IDWriteFontFileEnumerator)), "fontFileEnumerator")]),
+]
+
+IDWriteFontFileEnumerator.methods += [
+    Method(HRESULT, "MoveNext", [Out(Pointer(BOOL), "hasCurrentFile")]),
+    Method(HRESULT, "GetCurrentFontFile", [Out(Pointer(ObjPointer(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(ObjPointer(IDWriteFontFamily)), "fontFamily")]),
+    Method(HRESULT, "FindFamilyName", [(Pointer(Const(WCHAR)), "familyName"), Out(Pointer(UINT32), "index"), Out(Pointer(BOOL), "exists")]),
+    Method(HRESULT, "GetFontFromFontFace", [(ObjPointer(IDWriteFontFace), "fontFace"), Out(Pointer(ObjPointer(IDWriteFont)), "font")]),
+]
+
+IDWriteFontList.methods += [
+    Method(HRESULT, "GetFontCollection", [Out(Pointer(ObjPointer(IDWriteFontCollection)), "fontCollection")]),
+    Method(UINT32, "GetFontCount", []),
+    Method(HRESULT, "GetFont", [(UINT32, "index"), Out(Pointer(ObjPointer(IDWriteFont)), "font")]),
+]
+
+IDWriteFontFamily.methods += [
+    Method(HRESULT, "GetFamilyNames", [Out(Pointer(ObjPointer(IDWriteLocalizedStrings)), "names")]),
+    Method(HRESULT, "GetFirstMatchingFont", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(ObjPointer(IDWriteFont)), "matchingFont")]),
+    Method(HRESULT, "GetMatchingFonts", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(ObjPointer(IDWriteFontList)), "matchingFonts")]),
+]
+
+IDWriteFont.methods += [
+    Method(HRESULT, "GetFontFamily", [Out(Pointer(ObjPointer(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(ObjPointer(IDWriteLocalizedStrings)), "names")]),
+    Method(HRESULT, "GetInformationalStrings", [(DWRITE_INFORMATIONAL_STRING_ID, "informationalStringID"), Out(Pointer(ObjPointer(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(ObjPointer(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"), (ObjPointer(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(ObjPointer(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(ObjPointer(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(ObjPointer(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"), (ObjPointer(IDWriteNumberSubstitution), "numberSubstitution")]),
+]
+
+IDWriteTextAnalyzer.methods += [
+    Method(HRESULT, "AnalyzeScript", [(ObjPointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (ObjPointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "AnalyzeBidi", [(ObjPointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (ObjPointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "AnalyzeNumberSubstitution", [(ObjPointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (ObjPointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "AnalyzeLineBreakpoints", [(ObjPointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (ObjPointer(IDWriteTextAnalysisSink), "analysisSink")]),
+    Method(HRESULT, "GetGlyphs", [(Pointer(Const(WCHAR)), "textString"), (UINT32, "textLength"), (ObjPointer(IDWriteFontFace), "fontFace"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (Pointer(Const(WCHAR)), "localeName"), (ObjPointer(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"), (ObjPointer(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"), (ObjPointer(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", [
+    (ObjPointer(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"), (ObjPointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (ObjPointer(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"), (ObjPointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "DrawUnderline", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_UNDERLINE)), "underline"), (ObjPointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "DrawStrikethrough", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_STRIKETHROUGH)), "strikethrough"), (ObjPointer(IUnknown), "clientDrawingEffect")]),
+    Method(HRESULT, "DrawInlineObject", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "originX"), (FLOAT, "originY"), (ObjPointer(IDWriteInlineObject), "inlineObject"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (ObjPointer(IUnknown), "clientDrawingEffect")]),
+]
+
+IDWriteTextLayout.methods += [
+    Method(HRESULT, "SetMaxWidth", [(FLOAT, "maxWidth")]),
+    Method(HRESULT, "SetMaxHeight", [(FLOAT, "maxHeight")]),
+    Method(HRESULT, "SetFontCollection", [(ObjPointer(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", [(ObjPointer(IUnknown), "drawingEffect"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetInlineObject", [(ObjPointer(IDWriteInlineObject), "inlineObject"), (DWRITE_TEXT_RANGE, "textRange")]),
+    Method(HRESULT, "SetTypography", [(ObjPointer(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(ObjPointer(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(ObjPointer(IUnknown)), "drawingEffect"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetInlineObject", [(UINT32, "currentPosition"), Out(Pointer(ObjPointer(IDWriteInlineObject)), "inlineObject"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
+    Method(HRESULT, "GetTypography", [(UINT32, "currentPosition"), Out(Pointer(ObjPointer(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"), (ObjPointer(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"), (ObjPointer(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(ObjPointer(IDWriteFont)), "font")]),
+    Method(HRESULT, "ConvertFontToLOGFONT", [(ObjPointer(IDWriteFont), "font"), Out(Pointer(LOGFONTW), "logFont"), Out(Pointer(BOOL), "isSystemFont")]),
+    Method(HRESULT, "ConvertFontFaceToLOGFONT", [(ObjPointer(IDWriteFontFace), "font"), Out(Pointer(LOGFONTW), "logFont")]),
+    Method(HRESULT, "CreateFontFaceFromHdc", [(HDC, "hdc"), Out(Pointer(ObjPointer(IDWriteFontFace)), "fontFace")]),
+    Method(HRESULT, "CreateBitmapRenderTarget", [(HDC, "hdc"), (UINT32, "width"), (UINT32, "height"), Out(Pointer(ObjPointer(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", [(ObjPointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(FLOAT), "blendGamma"), Out(Pointer(FLOAT), "blendEnhancedContrast"), Out(Pointer(FLOAT), "blendClearTypeLevel")]),
+]
+
+IDWriteFactory.methods += [
+    Method(HRESULT, "GetSystemFontCollection", [Out(Pointer(ObjPointer(IDWriteFontCollection)), "fontCollection"), (BOOL, "checkForUpdates")]),
+    Method(HRESULT, "CreateCustomFontCollection", [(ObjPointer(IDWriteFontCollectionLoader), "collectionLoader"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(ObjPointer(IDWriteFontCollection)), "fontCollection")]),
+    Method(HRESULT, "RegisterFontCollectionLoader", [(ObjPointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
+    Method(HRESULT, "UnregisterFontCollectionLoader", [(ObjPointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
+    Method(HRESULT, "CreateFontFileReference", [(Pointer(Const(WCHAR)), "filePath"), (Pointer(Const(FILETIME)), "lastWriteTime"), Out(Pointer(ObjPointer(IDWriteFontFile)), "fontFile")]),
+    Method(HRESULT, "CreateCustomFontFileReference", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), (ObjPointer(IDWriteFontFileLoader), "fontFileLoader"), Out(Pointer(ObjPointer(IDWriteFontFile)), "fontFile")]),
+    Method(HRESULT, "CreateFontFace", [(DWRITE_FONT_FACE_TYPE, "fontFaceType"), (UINT32, "numberOfFiles"), (Array(Const(ObjPointer(IDWriteFontFile)), "numberOfFiles"), "fontFiles"), (UINT32, "faceIndex"), (DWRITE_FONT_SIMULATIONS, "fontFaceSimulationFlags"), Out(Pointer(ObjPointer(IDWriteFontFace)), "fontFace")]),
+    Method(HRESULT, "CreateRenderingParams", [Out(Pointer(ObjPointer(IDWriteRenderingParams)), "renderingParams")]),
+    Method(HRESULT, "CreateMonitorRenderingParams", [(HMONITOR, "monitor"), Out(Pointer(ObjPointer(IDWriteRenderingParams)), "renderingParams")]),
+    Method(HRESULT, "CreateCustomRenderingParams", [(FLOAT, "gamma"), (FLOAT, "enhancedContrast"), (FLOAT, "clearTypeLevel"), (DWRITE_PIXEL_GEOMETRY, "pixelGeometry"), (DWRITE_RENDERING_MODE, "renderingMode"), Out(Pointer(ObjPointer(IDWriteRenderingParams)), "renderingParams")]),
+    Method(HRESULT, "RegisterFontFileLoader", [(ObjPointer(IDWriteFontFileLoader), "fontFileLoader")]),
+    Method(HRESULT, "UnregisterFontFileLoader", [(ObjPointer(IDWriteFontFileLoader), "fontFileLoader")]),
+    Method(HRESULT, "CreateTextFormat", [(Pointer(Const(WCHAR)), "fontFamilyName"), (ObjPointer(IDWriteFontCollection), "fontCollection"), (DWRITE_FONT_WEIGHT, "fontWeight"), (DWRITE_FONT_STYLE, "fontStyle"), (DWRITE_FONT_STRETCH, "fontStretch"), (FLOAT, "fontSize"), (Pointer(Const(WCHAR)), "localeName"), Out(Pointer(ObjPointer(IDWriteTextFormat)), "textFormat")]),
+    Method(HRESULT, "CreateTypography", [Out(Pointer(ObjPointer(IDWriteTypography)), "typography")]),
+    Method(HRESULT, "GetGdiInterop", [Out(Pointer(ObjPointer(IDWriteGdiInterop)), "gdiInterop")]),
+    Method(HRESULT, "CreateTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (ObjPointer(IDWriteTextFormat), "textFormat"), (FLOAT, "maxWidth"), (FLOAT, "maxHeight"), Out(Pointer(ObjPointer(IDWriteTextLayout)), "textLayout")]),
+    Method(HRESULT, "CreateGdiCompatibleTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (ObjPointer(IDWriteTextFormat), "textFormat"), (FLOAT, "layoutWidth"), (FLOAT, "layoutHeight"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), Out(Pointer(ObjPointer(IDWriteTextLayout)), "textLayout")]),
+    Method(HRESULT, "CreateEllipsisTrimmingSign", [(ObjPointer(IDWriteTextFormat), "textFormat"), Out(Pointer(ObjPointer(IDWriteInlineObject)), "trimmingSign")]),
+    Method(HRESULT, "CreateTextAnalyzer", [Out(Pointer(ObjPointer(IDWriteTextAnalyzer)), "textAnalyzer")]),
+    Method(HRESULT, "CreateNumberSubstitution", [(DWRITE_NUMBER_SUBSTITUTION_METHOD, "substitutionMethod"), (Pointer(Const(WCHAR)), "localeName"), (BOOL, "ignoreUserOverride"), Out(Pointer(ObjPointer(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(ObjPointer(IDWriteGlyphRunAnalysis)), "glyphRunAnalysis")]),
+]
+
+dwrite = API("dwrite")
+dwrite.addInterface(IDWriteFactory)
+dwrite.addFunctions([
+    StdFunction(HRESULT, "DWriteCreateFactory", [(DWRITE_FACTORY_TYPE, "factoryType"), (REFIID, "iid"), Out(Pointer(ObjPointer(IUnknown)), "factory")]),
+])
index eeacd9f1a0e8dcfa1217a5f1dc123acde6b20302..cc5f074b65f5017f7ec6a52e5d9304c5d3c128a6 100644 (file)
@@ -1,5 +1,6 @@
 OpenGL
 cgltrace.cpp
+d2d1trace.cpp
 d3d10_1trace.cpp
 d3d10trace.cpp
 d3d11trace.cpp
@@ -7,6 +8,7 @@ d3d8trace.cpp
 d3d9trace.cpp
 ddrawtrace.cpp
 dlltrace.cpp
+dwritetrace.cpp
 egltrace.cpp
 gltrace.cpp
 glxtrace.cpp
index 6fa615c5bc07e173db9a9f4bba63281c7c0b621b..01cbdea4ac42af18c4d86d8cf011414b019bcb55 100644 (file)
@@ -233,6 +233,73 @@ if (WIN32)
         install (TARGETS d3d11trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
     endif ()
 
+    # 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
+                ${CMAKE_SOURCE_DIR}/specs/d2d1.py
+                ${CMAKE_SOURCE_DIR}/specs/d2d1.py
+                ${CMAKE_SOURCE_DIR}/specs/d2dbasetypes.py
+                ${CMAKE_SOURCE_DIR}/specs/d2derr.py
+                ${CMAKE_SOURCE_DIR}/specs/dwrite.py
+                ${CMAKE_SOURCE_DIR}/specs/dcommon.py
+                ${CMAKE_SOURCE_DIR}/specs/dxgi.py
+                ${CMAKE_SOURCE_DIR}/specs/dxgitype.py
+                ${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
+                ${CMAKE_SOURCE_DIR}/specs/winapi.py
+                ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+        )
+        add_library (d2d1 MODULE d2d1.def d2d1trace.cpp)
+        target_link_libraries (d2d1
+            common_trace
+            common
+            ${ZLIB_LIBRARIES}
+            ${SNAPPY_LIBRARIES}
+        )
+        set_target_properties (d2d1
+            PROPERTIES PREFIX ""
+            OUTPUT_NAME d2d1
+        )
+        install (TARGETS d2d1 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+
+        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
+                ${CMAKE_SOURCE_DIR}/specs/d2d1.py
+                ${CMAKE_SOURCE_DIR}/specs/d2d1.py
+                ${CMAKE_SOURCE_DIR}/specs/d2dbasetypes.py
+                ${CMAKE_SOURCE_DIR}/specs/d2derr.py
+                ${CMAKE_SOURCE_DIR}/specs/dwrite.py
+                ${CMAKE_SOURCE_DIR}/specs/dcommon.py
+                ${CMAKE_SOURCE_DIR}/specs/dxgi.py
+                ${CMAKE_SOURCE_DIR}/specs/dxgitype.py
+                ${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
+                ${CMAKE_SOURCE_DIR}/specs/winapi.py
+                ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+        )
+        add_library (dwrite MODULE dwrite.def dwritetrace.cpp)
+        target_link_libraries (dwrite
+            common_trace
+            common
+            ${ZLIB_LIBRARIES}
+            ${SNAPPY_LIBRARIES}
+        )
+        set_target_properties (dwrite
+            PROPERTIES PREFIX ""
+            OUTPUT_NAME dwrite
+        )
+        install (TARGETS dwrite LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+    endif (DirectX_D2D1_INCLUDE_DIR)
+
     # opengl32.dll
     add_custom_command (
         OUTPUT wgltrace.cpp
diff --git a/wrappers/d2d1.def b/wrappers/d2d1.def
new file mode 100644 (file)
index 0000000..58c897b
--- /dev/null
@@ -0,0 +1,8 @@
+LIBRARY "d2d1"
+
+EXPORTS
+       D2D1CreateFactory
+       D2D1InvertMatrix
+       D2D1IsMatrixInvertible
+       D2D1MakeRotateMatrix
+       D2D1MakeSkewMatrix
diff --git a/wrappers/d2d1trace.py b/wrappers/d2d1trace.py
new file mode 100644 (file)
index 0000000..a614285
--- /dev/null
@@ -0,0 +1,55 @@
+##########################################################################
+#
+# Copyright 2008-2009 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from dlltrace import DllTracer
+from specs.d2d1 import d2d1
+
+
+class D2D1Tracer(DllTracer):
+
+    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 '    }'
+        else:
+            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 "d2dimports.hpp"'
+    print
+
+    tracer = D2D1Tracer('d2d1.dll')
+    tracer.traceApi(d2d1)
diff --git a/wrappers/dwrite.def b/wrappers/dwrite.def
new file mode 100644 (file)
index 0000000..4cc6785
--- /dev/null
@@ -0,0 +1,4 @@
+LIBRARY "d2d1"
+
+EXPORTS
+       DWriteCreateFactory
diff --git a/wrappers/dwritetrace.py b/wrappers/dwritetrace.py
new file mode 100644 (file)
index 0000000..7fb77e2
--- /dev/null
@@ -0,0 +1,58 @@
+##########################################################################
+#
+# Copyright 2008-2009 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from dlltrace import DllTracer
+from specs.dwrite import dwrite
+from specs.d2d1 import d2d1 # cyclic dependency
+
+
+class DWriteTracer(DllTracer):
+
+    def wrapArg(self, function, arg):
+        if function.name == 'DWriteCreateFactory' and arg.output:
+            print '    if (*%s) {' % arg.name
+            for iface in dwrite.interfaces:
+                print '        if (iid == IID_%s) {' % iface.name
+                print '            *%s = new Wrap%s(static_cast<%s *>(*%s));' % (arg.name, iface.name, iface.name, arg.name)
+                print '        }'
+            print '    }'
+        else:
+            DllTracer.wrapArg(self, function, arg)
+
+
+if __name__ == '__main__':
+    print '#define INITGUID'
+    print
+    print '#include "trace_writer_local.hpp"'
+    print '#include "os.hpp"'
+    print
+    print '#define DWRITE_EXPORT WINAPI'
+    print
+    print '#include "d2dimports.hpp"'
+    print
+
+    tracer = DWriteTracer('dwrite.dll')
+    tracer.traceApi(dwrite)
index 5d0a566f413b77119cf26ccf8b4831d038e88090..4563f454f710822887ad9bd5eaa4de5606db7d4f 100644 (file)
@@ -340,6 +340,8 @@ class ValueWrapper(stdapi.Traverser, ExpanderMixin):
         elem_type = pointer.type.mutable()
         if isinstance(elem_type, stdapi.Interface):
             self.visitInterfacePointer(elem_type, instance)
+        elif isinstance(elem_type, stdapi.Alias) and isinstance(elem_type.type, stdapi.Interface):
+            self.visitInterfacePointer(elem_type.type, instance)
         else:
             self.visitPointer(pointer, instance)
     
@@ -361,6 +363,23 @@ class ValueUnwrapper(ValueWrapper):
 
     allocated = False
 
+    def visitStruct(self, struct, instance):
+        if not self.allocated:
+            # Argument is constant. We need to create a non const
+            print '    {'
+            print "        %s * _t = static_cast<%s *>(alloca(sizeof *_t));" % (struct, struct)
+            print '        *_t = %s;' % (instance,)
+            assert instance.startswith('*')
+            print '        %s = _t;' % (instance[1:],)
+            instance = '*_t'
+            self.allocated = True
+            try:
+                return ValueWrapper.visitStruct(self, struct, instance)
+            finally:
+                print '    }'
+        else:
+            return ValueWrapper.visitStruct(self, struct, instance)
+
     def visitArray(self, array, instance):
         if self.allocated or isinstance(instance, stdapi.Interface):
             return ValueWrapper.visitArray(self, array, instance)