set (DirectX_D3D10_FOUND 1)
if (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3DX10_LIBRARY)
set (DirectX_D3DX10_FOUND 1)
- endif (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3DX10_LIBRARY)
- endif (DirectX_D3D10_INCLUDE_DIR AND DirectX_D3D10_LIBRARY)
+ endif ()
+ endif ()
+
+
+ find_path (DirectX_D3D10_1_INCLUDE_DIR d3d10_1.h
+ PATHS ${DirectX_INC_SEARCH_PATH}
+ DOC "The directory where d3d10_1.h resides")
+
+ find_library (DirectX_D3D10_1_LIBRARY d3d10_1
+ PATHS ${DirectX_LIB_SEARCH_PATH}
+ DOC "The directory where d3d10_1 resides")
+
+ if (DirectX_D3D10_1_INCLUDE_DIR AND DirectX_D3D10_1_LIBRARY)
+ set (DirectX_D3D10_1_FOUND 1)
+ endif ()
+
+
+ find_path (DirectX_D3D11_INCLUDE_DIR d3d11.h
+ PATHS ${DirectX_INC_SEARCH_PATH}
+ DOC "The directory where d3d11.h resides")
+
+ find_path (DirectX_D3DX11_INCLUDE_DIR d3dx11.h
+ PATHS ${DirectX_INC_SEARCH_PATH}
+ DOC "The directory where d3dx11.h resides")
+
+ find_library (DirectX_D3D11_LIBRARY d3d11
+ PATHS ${DirectX_LIB_SEARCH_PATH}
+ DOC "The directory where d3d11 resides")
+
+ find_library (DirectX_D3DX11_LIBRARY d3dx11
+ PATHS ${DirectX_LIB_SEARCH_PATH}
+ DOC "The directory where d3dx11 resides")
+
+ if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
+ set (DirectX_D3D11_FOUND 1)
+ if (DirectX_D3DX11_INCLUDE_DIR AND DirectX_D3DX11_LIBRARY)
+ set (DirectX_D3DX11_FOUND 1)
+ endif ()
+ endif ()
+
+
+ find_path (DirectX_D3D11_1_INCLUDE_DIR d3d11_1.h
+ PATHS ${DirectX_INC_SEARCH_PATH}
+ DOC "The directory where d3d11_1.h resides")
+
+ if (DirectX_D3D11_1_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
+ set (DirectX_D3D11_1_FOUND 1)
+ endif ()
+
+
+ find_program (DirectX_FXC_EXECUTABLE fxc
+ PATHS ${DirectX_BIN_SEARCH_PATH}
+ DOC "Path to fxc.exe executable.")
- mark_as_advanced(
+ 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
DirectX_DDRAW_LIBRARY
DirectX_D3D10_LIBRARY
DirectX_D3DX10_INCLUDE_DIR
DirectX_D3DX10_LIBRARY
+ DirectX_D3D10_1_INCLUDE_DIR
+ DirectX_D3D10_1_LIBRARY
+ DirectX_D3D11_INCLUDE_DIR
+ DirectX_D3D11_LIBRARY
+ DirectX_D3DX11_INCLUDE_DIR
+ DirectX_D3DX11_LIBRARY
+ DirectX_D3D11_1_INCLUDE_DIR
+ DirectX_D2D1_INCLUDE_DIR
+ DirectX_D2D1_LIBRARY
)
- endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+
+ endif ()
+
mark_as_advanced (
DirectX_D3D_FOUND
DirectX_D3DX9_FOUND
DirectX_D3D10_FOUND
DirectX_D3DX10_FOUND
+ DirectX_D3D10_1_FOUND
+ DirectX_D3D11_FOUND
+ DirectX_D3DX11_FOUND
+ DirectX_D3D11_1_FOUND
+ DirectX_D2D1_FOUND
)
+
+
+ # vim:set sw=4 ts=4 noet:
--- /dev/null
--- /dev/null
++/**************************************************************************
++ *
++ * 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_ */
--- /dev/null
- (Pointer(ID2D1Geometry), "geometricMask"),
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from winapi import *
+from dxgiformat import DXGI_FORMAT
+from dxgi import IDXGISurface
+from d2derr import *
+from d2dbasetypes import *
+from dwrite import *
+
+
+ID2D1Resource = Interface("ID2D1Resource", IUnknown)
+ID2D1Bitmap = Interface("ID2D1Bitmap", ID2D1Resource)
+ID2D1GradientStopCollection = Interface("ID2D1GradientStopCollection", ID2D1Resource)
+ID2D1Brush = Interface("ID2D1Brush", ID2D1Resource)
+ID2D1BitmapBrush = Interface("ID2D1BitmapBrush", ID2D1Brush)
+ID2D1SolidColorBrush = Interface("ID2D1SolidColorBrush", ID2D1Brush)
+ID2D1LinearGradientBrush = Interface("ID2D1LinearGradientBrush", ID2D1Brush)
+ID2D1RadialGradientBrush = Interface("ID2D1RadialGradientBrush", ID2D1Brush)
+ID2D1StrokeStyle = Interface("ID2D1StrokeStyle", ID2D1Resource)
+ID2D1Geometry = Interface("ID2D1Geometry", ID2D1Resource)
+ID2D1RectangleGeometry = Interface("ID2D1RectangleGeometry", ID2D1Geometry)
+ID2D1RoundedRectangleGeometry = Interface("ID2D1RoundedRectangleGeometry", ID2D1Geometry)
+ID2D1EllipseGeometry = Interface("ID2D1EllipseGeometry", ID2D1Geometry)
+ID2D1GeometryGroup = Interface("ID2D1GeometryGroup", ID2D1Geometry)
+ID2D1TransformedGeometry = Interface("ID2D1TransformedGeometry", ID2D1Geometry)
+ID2D1GeometrySink = Interface("ID2D1GeometrySink", ID2D1SimplifiedGeometrySink)
+ID2D1TessellationSink = Interface("ID2D1TessellationSink", IUnknown)
+ID2D1PathGeometry = Interface("ID2D1PathGeometry", ID2D1Geometry)
+ID2D1Mesh = Interface("ID2D1Mesh", ID2D1Resource)
+ID2D1Layer = Interface("ID2D1Layer", ID2D1Resource)
+ID2D1DrawingStateBlock = Interface("ID2D1DrawingStateBlock", ID2D1Resource)
+ID2D1RenderTarget = Interface("ID2D1RenderTarget", ID2D1Resource)
+ID2D1BitmapRenderTarget = Interface("ID2D1BitmapRenderTarget", ID2D1RenderTarget)
+ID2D1HwndRenderTarget = Interface("ID2D1HwndRenderTarget", ID2D1RenderTarget)
+ID2D1GdiInteropRenderTarget = Interface("ID2D1GdiInteropRenderTarget", IUnknown)
+ID2D1DCRenderTarget = Interface("ID2D1DCRenderTarget", ID2D1RenderTarget)
+ID2D1Factory = Interface("ID2D1Factory", IUnknown)
+
+
+D2D1_ALPHA_MODE = Enum("D2D1_ALPHA_MODE", [
+ "D2D1_ALPHA_MODE_UNKNOWN",
+ "D2D1_ALPHA_MODE_PREMULTIPLIED",
+ "D2D1_ALPHA_MODE_STRAIGHT",
+ "D2D1_ALPHA_MODE_IGNORE",
+])
+
+D2D1_GAMMA = Enum("D2D1_GAMMA", [
+ "D2D1_GAMMA_2_2",
+ "D2D1_GAMMA_1_0",
+])
+
+D2D1_OPACITY_MASK_CONTENT = Enum("D2D1_OPACITY_MASK_CONTENT", [
+ "D2D1_OPACITY_MASK_CONTENT_GRAPHICS",
+ "D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL",
+ "D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE",
+])
+
+D2D1_EXTEND_MODE = Enum("D2D1_EXTEND_MODE", [
+ "D2D1_EXTEND_MODE_CLAMP",
+ "D2D1_EXTEND_MODE_WRAP",
+ "D2D1_EXTEND_MODE_MIRROR",
+])
+
+D2D1_ANTIALIAS_MODE = Enum("D2D1_ANTIALIAS_MODE", [
+ "D2D1_ANTIALIAS_MODE_PER_PRIMITIVE",
+ "D2D1_ANTIALIAS_MODE_ALIASED",
+])
+
+D2D1_TEXT_ANTIALIAS_MODE = Enum("D2D1_TEXT_ANTIALIAS_MODE", [
+ "D2D1_TEXT_ANTIALIAS_MODE_DEFAULT",
+ "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE",
+ "D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE",
+ "D2D1_TEXT_ANTIALIAS_MODE_ALIASED",
+])
+
+D2D1_BITMAP_INTERPOLATION_MODE = Enum("D2D1_BITMAP_INTERPOLATION_MODE", [
+ "D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR",
+ "D2D1_BITMAP_INTERPOLATION_MODE_LINEAR",
+])
+
+D2D1_DRAW_TEXT_OPTIONS = EnumFlag("D2D1_DRAW_TEXT_OPTIONS", [
+ "D2D1_DRAW_TEXT_OPTIONS_NONE",
+ "D2D1_DRAW_TEXT_OPTIONS_NO_SNAP",
+ "D2D1_DRAW_TEXT_OPTIONS_CLIP",
+])
+
+D2D1_PIXEL_FORMAT = Struct("D2D1_PIXEL_FORMAT", [
+ (DXGI_FORMAT, "format"),
+ (D2D1_ALPHA_MODE, "alphaMode"),
+])
+
+D2D1_POINT_2U = Alias("D2D1_POINT_2U", D2D_POINT_2U)
+D2D1_POINT_2F = Alias("D2D1_POINT_2F", D2D_POINT_2F)
+D2D1_RECT_F = Alias("D2D1_RECT_F", D2D_RECT_F)
+D2D1_RECT_U = Alias("D2D1_RECT_U", D2D_RECT_U)
+D2D1_SIZE_F = Alias("D2D1_SIZE_F", D2D_SIZE_F)
+D2D1_SIZE_U = Alias("D2D1_SIZE_U", D2D_SIZE_U)
+D2D1_COLOR_F = Alias("D2D1_COLOR_F", D2D_COLOR_F)
+D2D1_MATRIX_3X2_F = Alias("D2D1_MATRIX_3X2_F", D2D_MATRIX_3X2_F)
+D2D1_TAG = Alias("D2D1_TAG", UINT64)
+D2D1_BITMAP_PROPERTIES = Struct("D2D1_BITMAP_PROPERTIES", [
+ (D2D1_PIXEL_FORMAT, "pixelFormat"),
+ (FLOAT, "dpiX"),
+ (FLOAT, "dpiY"),
+])
+
+D2D1_GRADIENT_STOP = Struct("D2D1_GRADIENT_STOP", [
+ (FLOAT, "position"),
+ (D2D1_COLOR_F, "color"),
+])
+
+D2D1_BRUSH_PROPERTIES = Struct("D2D1_BRUSH_PROPERTIES", [
+ (FLOAT, "opacity"),
+ (D2D1_MATRIX_3X2_F, "transform"),
+])
+
+D2D1_BITMAP_BRUSH_PROPERTIES = Struct("D2D1_BITMAP_BRUSH_PROPERTIES", [
+ (D2D1_EXTEND_MODE, "extendModeX"),
+ (D2D1_EXTEND_MODE, "extendModeY"),
+ (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"),
+])
+
+D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES", [
+ (D2D1_POINT_2F, "startPoint"),
+ (D2D1_POINT_2F, "endPoint"),
+])
+
+D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES = Struct("D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES", [
+ (D2D1_POINT_2F, "center"),
+ (D2D1_POINT_2F, "gradientOriginOffset"),
+ (FLOAT, "radiusX"),
+ (FLOAT, "radiusY"),
+])
+
+D2D1_ARC_SIZE = Enum("D2D1_ARC_SIZE", [
+ "D2D1_ARC_SIZE_SMALL",
+ "D2D1_ARC_SIZE_LARGE",
+])
+
+D2D1_CAP_STYLE = Enum("D2D1_CAP_STYLE", [
+ "D2D1_CAP_STYLE_FLAT",
+ "D2D1_CAP_STYLE_SQUARE",
+ "D2D1_CAP_STYLE_ROUND",
+ "D2D1_CAP_STYLE_TRIANGLE",
+])
+
+D2D1_DASH_STYLE = Enum("D2D1_DASH_STYLE", [
+ "D2D1_DASH_STYLE_SOLID",
+ "D2D1_DASH_STYLE_DASH",
+ "D2D1_DASH_STYLE_DOT",
+ "D2D1_DASH_STYLE_DASH_DOT",
+ "D2D1_DASH_STYLE_DASH_DOT_DOT",
+ "D2D1_DASH_STYLE_CUSTOM",
+])
+
+D2D1_LINE_JOIN = Enum("D2D1_LINE_JOIN", [
+ "D2D1_LINE_JOIN_MITER",
+ "D2D1_LINE_JOIN_BEVEL",
+ "D2D1_LINE_JOIN_ROUND",
+ "D2D1_LINE_JOIN_MITER_OR_BEVEL",
+])
+
+D2D1_COMBINE_MODE = Enum("D2D1_COMBINE_MODE", [
+ "D2D1_COMBINE_MODE_UNION",
+ "D2D1_COMBINE_MODE_INTERSECT",
+ "D2D1_COMBINE_MODE_XOR",
+ "D2D1_COMBINE_MODE_EXCLUDE",
+])
+
+D2D1_GEOMETRY_RELATION = Enum("D2D1_GEOMETRY_RELATION", [
+ "D2D1_GEOMETRY_RELATION_UNKNOWN",
+ "D2D1_GEOMETRY_RELATION_DISJOINT",
+ "D2D1_GEOMETRY_RELATION_IS_CONTAINED",
+ "D2D1_GEOMETRY_RELATION_CONTAINS",
+ "D2D1_GEOMETRY_RELATION_OVERLAP",
+])
+
+D2D1_GEOMETRY_SIMPLIFICATION_OPTION = Enum("D2D1_GEOMETRY_SIMPLIFICATION_OPTION", [
+ "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES",
+ "D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES",
+])
+
+D2D1_FIGURE_BEGIN = Enum("D2D1_FIGURE_BEGIN", [
+ "D2D1_FIGURE_BEGIN_FILLED",
+ "D2D1_FIGURE_BEGIN_HOLLOW",
+])
+
+D2D1_FIGURE_END = Enum("D2D1_FIGURE_END", [
+ "D2D1_FIGURE_END_OPEN",
+ "D2D1_FIGURE_END_CLOSED",
+])
+
+D2D1_BEZIER_SEGMENT = Struct("D2D1_BEZIER_SEGMENT", [
+ (D2D1_POINT_2F, "point1"),
+ (D2D1_POINT_2F, "point2"),
+ (D2D1_POINT_2F, "point3"),
+])
+
+D2D1_TRIANGLE = Struct("D2D1_TRIANGLE", [
+ (D2D1_POINT_2F, "point1"),
+ (D2D1_POINT_2F, "point2"),
+ (D2D1_POINT_2F, "point3"),
+])
+
+D2D1_PATH_SEGMENT = EnumFlag("D2D1_PATH_SEGMENT", [
+ "D2D1_PATH_SEGMENT_NONE",
+ "D2D1_PATH_SEGMENT_FORCE_UNSTROKED",
+ "D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN",
+])
+
+D2D1_SWEEP_DIRECTION = Enum("D2D1_SWEEP_DIRECTION", [
+ "D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE",
+ "D2D1_SWEEP_DIRECTION_CLOCKWISE",
+])
+
+D2D1_FILL_MODE = Enum("D2D1_FILL_MODE", [
+ "D2D1_FILL_MODE_ALTERNATE",
+ "D2D1_FILL_MODE_WINDING",
+])
+
+D2D1_ARC_SEGMENT = Struct("D2D1_ARC_SEGMENT", [
+ (D2D1_POINT_2F, "point"),
+ (D2D1_SIZE_F, "size"),
+ (FLOAT, "rotationAngle"),
+ (D2D1_SWEEP_DIRECTION, "sweepDirection"),
+ (D2D1_ARC_SIZE, "arcSize"),
+])
+
+D2D1_QUADRATIC_BEZIER_SEGMENT = Struct("D2D1_QUADRATIC_BEZIER_SEGMENT", [
+ (D2D1_POINT_2F, "point1"),
+ (D2D1_POINT_2F, "point2"),
+])
+
+D2D1_ELLIPSE = Struct("D2D1_ELLIPSE", [
+ (D2D1_POINT_2F, "point"),
+ (FLOAT, "radiusX"),
+ (FLOAT, "radiusY"),
+])
+
+D2D1_ROUNDED_RECT = Struct("D2D1_ROUNDED_RECT", [
+ (D2D1_RECT_F, "rect"),
+ (FLOAT, "radiusX"),
+ (FLOAT, "radiusY"),
+])
+
+D2D1_STROKE_STYLE_PROPERTIES = Struct("D2D1_STROKE_STYLE_PROPERTIES", [
+ (D2D1_CAP_STYLE, "startCap"),
+ (D2D1_CAP_STYLE, "endCap"),
+ (D2D1_CAP_STYLE, "dashCap"),
+ (D2D1_LINE_JOIN, "lineJoin"),
+ (FLOAT, "miterLimit"),
+ (D2D1_DASH_STYLE, "dashStyle"),
+ (FLOAT, "dashOffset"),
+])
+
+D2D1_LAYER_OPTIONS = EnumFlag("D2D1_LAYER_OPTIONS", [
+ "D2D1_LAYER_OPTIONS_NONE",
+ "D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE",
+])
+
+D2D1_LAYER_PARAMETERS = Struct("D2D1_LAYER_PARAMETERS", [
+ (D2D1_RECT_F, "contentBounds"),
- (Pointer(ID2D1Brush), "opacityBrush"),
++ (ObjPointer(ID2D1Geometry), "geometricMask"),
+ (D2D1_ANTIALIAS_MODE, "maskAntialiasMode"),
+ (D2D1_MATRIX_3X2_F, "maskTransform"),
+ (FLOAT, "opacity"),
- Method(Void, "GetFactory", [Out(Pointer(Pointer(ID2D1Factory)), "factory")], const=True),
++ (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(HRESULT, "CopyFromBitmap", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (Pointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
- Method(HRESULT, "CopyFromRenderTarget", [(Pointer(Const(D2D1_POINT_2U)), "destPoint"), (Pointer(ID2D1RenderTarget), "renderTarget"), (Pointer(Const(D2D1_RECT_U)), "srcRect")]),
++ Method(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(Void, "SetBitmap", [(Pointer(ID2D1Bitmap), "bitmap")]),
++ 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, "GetBitmap", [Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")], const=True),
++ 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, "GetGradientStopCollection", [Out(Pointer(Pointer(ID2D1GradientStopCollection)), "gradientStopCollection")], 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(Pointer(ID2D1GradientStopCollection)), "gradientStopCollection")], 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(HRESULT, "GetWidenedBounds", [(FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_RECT_F), "bounds")], const=True),
- Method(HRESULT, "StrokeContainsPoint", [(D2D1_POINT_2F, "point"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(BOOL), "contains")], const=True),
++ Method(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, "CompareWithGeometry", [(Pointer(ID2D1Geometry), "inputGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), Out(Pointer(D2D1_GEOMETRY_RELATION), "relation")], const=True),
- Method(HRESULT, "Simplify", [(D2D1_GEOMETRY_SIMPLIFICATION_OPTION, "simplificationOption"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
- Method(HRESULT, "Tessellate", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1TessellationSink), "tessellationSink")], const=True),
- Method(HRESULT, "CombineWithGeometry", [(Pointer(ID2D1Geometry), "inputGeometry"), (D2D1_COMBINE_MODE, "combineMode"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "inputGeometryTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
- Method(HRESULT, "Outline", [(Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], const=True),
++ Method(HRESULT, "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, "Widen", [(FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "worldTransform"), (FLOAT, "flatteningTolerance"), (Pointer(ID2D1SimplifiedGeometrySink), "geometrySink")], 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(Void, "GetSourceGeometries", [Out(Array(Pointer(ID2D1Geometry), "geometriesCount"), "geometries"), (UINT, "geometriesCount")], 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, "GetSourceGeometry", [Out(Pointer(Pointer(ID2D1Geometry)), "sourceGeometry")], const=True),
++ Method(Void, "GetSourceGeometries", [Out(Array(ObjPointer(ID2D1Geometry), "geometriesCount"), "geometries"), (UINT, "geometriesCount")], const=True),
+]
+
+ID2D1TransformedGeometry.methods += [
- Method(HRESULT, "Open", [Out(Pointer(Pointer(ID2D1GeometrySink)), "geometrySink")]),
- Method(HRESULT, "Stream", [(Pointer(ID2D1GeometrySink), "geometrySink")], const=True),
++ 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(Pointer(ID2D1TessellationSink)), "tessellationSink")]),
++ 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(Void, "SetTextRenderingParams", [(Pointer(IDWriteRenderingParams), "textRenderingParams")]),
- Method(Void, "GetTextRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
++ 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(HRESULT, "CreateBitmap", [(D2D1_SIZE_U, "size"), (OpaquePointer(Const(Void)), "srcData"), (UINT32, "pitch"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
- Method(HRESULT, "CreateBitmapFromWicBitmap", [(Opaque("IWICBitmapSource *"), "wicBitmapSource"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
- Method(HRESULT, "CreateSharedBitmap", [(REFIID, "riid"), Out(OpaquePointer(Void), "data"), (Pointer(Const(D2D1_BITMAP_PROPERTIES)), "bitmapProperties"), Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
- Method(HRESULT, "CreateBitmapBrush", [(Pointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_BITMAP_BRUSH_PROPERTIES)), "bitmapBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(Pointer(ID2D1BitmapBrush)), "bitmapBrush")]),
- Method(HRESULT, "CreateSolidColorBrush", [(Pointer(Const(D2D1_COLOR_F)), "color"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), Out(Pointer(Pointer(ID2D1SolidColorBrush)), "solidColorBrush")]),
- Method(HRESULT, "CreateGradientStopCollection", [(Array(Const(D2D1_GRADIENT_STOP), "gradientStopsCount"), "gradientStops"), (UINT, "gradientStopsCount"), (D2D1_GAMMA, "colorInterpolationGamma"), (D2D1_EXTEND_MODE, "extendMode"), Out(Pointer(Pointer(ID2D1GradientStopCollection)), "gradientStopCollection")]),
- Method(HRESULT, "CreateLinearGradientBrush", [(Pointer(Const(D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)), "linearGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (Pointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(Pointer(ID2D1LinearGradientBrush)), "linearGradientBrush")]),
- Method(HRESULT, "CreateRadialGradientBrush", [(Pointer(Const(D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES)), "radialGradientBrushProperties"), (Pointer(Const(D2D1_BRUSH_PROPERTIES)), "brushProperties"), (Pointer(ID2D1GradientStopCollection), "gradientStopCollection"), Out(Pointer(Pointer(ID2D1RadialGradientBrush)), "radialGradientBrush")]),
- Method(HRESULT, "CreateCompatibleRenderTarget", [(Pointer(Const(D2D1_SIZE_F)), "desiredSize"), (Pointer(Const(D2D1_SIZE_U)), "desiredPixelSize"), (Pointer(Const(D2D1_PIXEL_FORMAT)), "desiredFormat"), (D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS, "options"), Out(Pointer(Pointer(ID2D1BitmapRenderTarget)), "bitmapRenderTarget")]),
- Method(HRESULT, "CreateLayer", [(Pointer(Const(D2D1_SIZE_F)), "size"), Out(Pointer(Pointer(ID2D1Layer)), "layer")]),
- Method(HRESULT, "CreateMesh", [Out(Pointer(Pointer(ID2D1Mesh)), "mesh")]),
- Method(Void, "DrawLine", [(D2D1_POINT_2F, "point0"), (D2D1_POINT_2F, "point1"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
- Method(Void, "DrawRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
- Method(Void, "FillRectangle", [(Pointer(Const(D2D1_RECT_F)), "rect"), (Pointer(ID2D1Brush), "brush")]),
- Method(Void, "DrawRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
- Method(Void, "FillRoundedRectangle", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRect"), (Pointer(ID2D1Brush), "brush")]),
- Method(Void, "DrawEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
- Method(Void, "FillEllipse", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), (Pointer(ID2D1Brush), "brush")]),
- Method(Void, "DrawGeometry", [(Pointer(ID2D1Geometry), "geometry"), (Pointer(ID2D1Brush), "brush"), (FLOAT, "strokeWidth"), (Pointer(ID2D1StrokeStyle), "strokeStyle")]),
- Method(Void, "FillGeometry", [(Pointer(ID2D1Geometry), "geometry"), (Pointer(ID2D1Brush), "brush"), (Pointer(ID2D1Brush), "opacityBrush")]),
- Method(Void, "FillMesh", [(Pointer(ID2D1Mesh), "mesh"), (Pointer(ID2D1Brush), "brush")]),
- Method(Void, "FillOpacityMask", [(Pointer(ID2D1Bitmap), "opacityMask"), (Pointer(ID2D1Brush), "brush"), (D2D1_OPACITY_MASK_CONTENT, "content"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
- Method(Void, "DrawBitmap", [(Pointer(ID2D1Bitmap), "bitmap"), (Pointer(Const(D2D1_RECT_F)), "destinationRectangle"), (FLOAT, "opacity"), (D2D1_BITMAP_INTERPOLATION_MODE, "interpolationMode"), (Pointer(Const(D2D1_RECT_F)), "sourceRectangle")]),
- Method(Void, "DrawText", [(Pointer(Const(WCHAR)), "string"), (UINT, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (Pointer(Const(D2D1_RECT_F)), "layoutRect"), (Pointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options"), (DWRITE_MEASURING_MODE, "measuringMode")]),
- Method(Void, "DrawTextLayout", [(D2D1_POINT_2F, "origin"), (Pointer(IDWriteTextLayout), "textLayout"), (Pointer(ID2D1Brush), "defaultForegroundBrush"), (D2D1_DRAW_TEXT_OPTIONS, "options")]),
- Method(Void, "DrawGlyphRun", [(D2D1_POINT_2F, "baselineOrigin"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(ID2D1Brush), "foregroundBrush"), (DWRITE_MEASURING_MODE, "measuringMode")]),
++ Method(Void, "SetTextRenderingParams", [(ObjPointer(IDWriteRenderingParams), "textRenderingParams")]),
++ Method(Void, "GetTextRenderingParams", [Out(Pointer(ObjPointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
+]
+
+ID2D1RenderTarget.methods += [
- Method(Void, "SetTextRenderingParams", [(Pointer(IDWriteRenderingParams), "textRenderingParams")]),
- Method(Void, "GetTextRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "textRenderingParams")], const=True),
++ 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, "PushLayer", [(Pointer(Const(D2D1_LAYER_PARAMETERS)), "layerParameters"), (Pointer(ID2D1Layer), "layer")]),
++ 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, "SaveDrawingState", [Out(Pointer(ID2D1DrawingStateBlock), "drawingStateBlock")], const=True),
- Method(Void, "RestoreDrawingState", [(Pointer(ID2D1DrawingStateBlock), "drawingStateBlock")]),
++ 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(HRESULT, "GetBitmap", [Out(Pointer(Pointer(ID2D1Bitmap)), "bitmap")]),
++ 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, "CreateRectangleGeometry", [(Pointer(Const(D2D1_RECT_F)), "rectangle"), Out(Pointer(Pointer(ID2D1RectangleGeometry)), "rectangleGeometry")]),
- Method(HRESULT, "CreateRoundedRectangleGeometry", [(Pointer(Const(D2D1_ROUNDED_RECT)), "roundedRectangle"), Out(Pointer(Pointer(ID2D1RoundedRectangleGeometry)), "roundedRectangleGeometry")]),
- Method(HRESULT, "CreateEllipseGeometry", [(Pointer(Const(D2D1_ELLIPSE)), "ellipse"), Out(Pointer(Pointer(ID2D1EllipseGeometry)), "ellipseGeometry")]),
- Method(HRESULT, "CreateGeometryGroup", [(D2D1_FILL_MODE, "fillMode"), (Pointer(Pointer(ID2D1Geometry)), "geometries"), (UINT, "geometriesCount"), Out(Pointer(Pointer(ID2D1GeometryGroup)), "geometryGroup")]),
- Method(HRESULT, "CreateTransformedGeometry", [(Pointer(ID2D1Geometry), "sourceGeometry"), (Pointer(Const(D2D1_MATRIX_3X2_F)), "transform"), Out(Pointer(Pointer(ID2D1TransformedGeometry)), "transformedGeometry")]),
- Method(HRESULT, "CreatePathGeometry", [Out(Pointer(Pointer(ID2D1PathGeometry)), "pathGeometry")]),
- Method(HRESULT, "CreateStrokeStyle", [(Pointer(Const(D2D1_STROKE_STYLE_PROPERTIES)), "strokeStyleProperties"), (Pointer(Const(FLOAT)), "dashes"), (UINT, "dashesCount"), Out(Pointer(Pointer(ID2D1StrokeStyle)), "strokeStyle")]),
- Method(HRESULT, "CreateDrawingStateBlock", [(Pointer(Const(D2D1_DRAWING_STATE_DESCRIPTION)), "drawingStateDescription"), (Pointer(IDWriteRenderingParams), "textRenderingParams"), Out(Pointer(Pointer(ID2D1DrawingStateBlock)), "drawingStateBlock")]),
- Method(HRESULT, "CreateWicBitmapRenderTarget", [(Opaque("IWICBitmap *"), "target"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(Pointer(ID2D1RenderTarget)), "renderTarget")]),
- Method(HRESULT, "CreateHwndRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), (Pointer(Const(D2D1_HWND_RENDER_TARGET_PROPERTIES)), "hwndRenderTargetProperties"), Out(Pointer(Pointer(ID2D1HwndRenderTarget)), "hwndRenderTarget")]),
- Method(HRESULT, "CreateDxgiSurfaceRenderTarget", [(Pointer(IDXGISurface), "dxgiSurface"), (Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(Pointer(ID2D1RenderTarget)), "renderTarget")]),
- Method(HRESULT, "CreateDCRenderTarget", [(Pointer(Const(D2D1_RENDER_TARGET_PROPERTIES)), "renderTargetProperties"), Out(Pointer(Pointer(ID2D1DCRenderTarget)), "dcRenderTarget")]),
++ 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")]),
+])
--- /dev/null
- Method(HRESULT, "CreateStreamFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(Pointer(IDWriteFontFileStream)), "fontFileStream")]),
+##########################################################################
+#
+# 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, "GetLoader", [Out(Pointer(Pointer(IDWriteFontFileLoader)), "fontFileLoader")]),
++ 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, "GetFiles", [(OpaquePointer(UINT32), "numberOfFiles"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFiles")]),
++ 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, "GetGlyphRunOutline", [(FLOAT, "emSize"), (Pointer(Const(UINT16)), "glyphIndices"), (Pointer(Const(FLOAT)), "glyphAdvances"), (Pointer(Const(DWRITE_GLYPH_OFFSET)), "glyphOffsets"), (UINT32, "glyphCount"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IDWriteGeometrySink), "geometrySink")]),
- Method(HRESULT, "GetRecommendedRenderingMode", [(FLOAT, "emSize"), (FLOAT, "pixelsPerDip"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(DWRITE_RENDERING_MODE), "renderingMode")]),
++ Method(HRESULT, "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, "CreateEnumeratorFromKey", [(Pointer(IDWriteFactory), "factory"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(Pointer(IDWriteFontFileEnumerator)), "fontFileEnumerator")]),
++ 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, "GetCurrentFontFile", [Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
++ 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, "GetFontFamily", [(UINT32, "index"), Out(Pointer(Pointer(IDWriteFontFamily)), "fontFamily")]),
++ 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, "GetFontFromFontFace", [(Pointer(IDWriteFontFace), "fontFace"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
++ 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, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
++ Method(HRESULT, "GetFontFromFontFace", [(ObjPointer(IDWriteFontFace), "fontFace"), Out(Pointer(ObjPointer(IDWriteFont)), "font")]),
+]
+
+IDWriteFontList.methods += [
- Method(HRESULT, "GetFont", [(UINT32, "index"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
++ Method(HRESULT, "GetFontCollection", [Out(Pointer(ObjPointer(IDWriteFontCollection)), "fontCollection")]),
+ Method(UINT32, "GetFontCount", []),
- Method(HRESULT, "GetFamilyNames", [Out(Pointer(Pointer(IDWriteLocalizedStrings)), "names")]),
- Method(HRESULT, "GetFirstMatchingFont", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(Pointer(IDWriteFont)), "matchingFont")]),
- Method(HRESULT, "GetMatchingFonts", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(Pointer(IDWriteFontList)), "matchingFonts")]),
++ Method(HRESULT, "GetFont", [(UINT32, "index"), Out(Pointer(ObjPointer(IDWriteFont)), "font")]),
+]
+
+IDWriteFontFamily.methods += [
- Method(HRESULT, "GetFontFamily", [Out(Pointer(Pointer(IDWriteFontFamily)), "fontFamily")]),
++ 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, "GetFaceNames", [Out(Pointer(Pointer(IDWriteLocalizedStrings)), "names")]),
- Method(HRESULT, "GetInformationalStrings", [(DWRITE_INFORMATIONAL_STRING_ID, "informationalStringID"), Out(Pointer(Pointer(IDWriteLocalizedStrings)), "informationalStrings"), Out(Pointer(BOOL), "exists")]),
++ 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, "CreateFontFace", [Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
++ 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, "SetTrimming", [(Pointer(Const(DWRITE_TRIMMING)), "trimmingOptions"), (Pointer(IDWriteInlineObject), "trimmingSign")]),
++ 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, "GetTrimming", [Out(Pointer(DWRITE_TRIMMING), "trimmingOptions"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
++ 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, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
++ 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, "GetNumberSubstitution", [(UINT32, "textPosition"), Out(Pointer(UINT32), "textLength"), Out(Pointer(Pointer(IDWriteNumberSubstitution)), "numberSubstitution")]),
++ 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, "SetNumberSubstitution", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteNumberSubstitution), "numberSubstitution")]),
++ 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, "AnalyzeScript", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
- Method(HRESULT, "AnalyzeBidi", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
- Method(HRESULT, "AnalyzeNumberSubstitution", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
- Method(HRESULT, "AnalyzeLineBreakpoints", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
- Method(HRESULT, "GetGlyphs", [(Pointer(Const(WCHAR)), "textString"), (UINT32, "textLength"), (Pointer(IDWriteFontFace), "fontFace"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (Pointer(Const(WCHAR)), "localeName"), (Pointer(IDWriteNumberSubstitution), "numberSubstitution"), (OpaquePointer(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES))), "features"), (Pointer(Const(UINT32)), "featureRangeLengths"), (UINT32, "featureRanges"), (UINT32, "maxGlyphCount"), Out(Pointer(UINT16), "clusterMap"), Out(Pointer(DWRITE_SHAPING_TEXT_PROPERTIES), "textProps"), Out(Pointer(UINT16), "glyphIndices"), Out(Pointer(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphProps"), Out(Pointer(UINT32), "actualGlyphCount")]),
- Method(HRESULT, "GetGlyphPlacements", [(Array(Const(WCHAR), "textLength"), "textString"), (Array(Const(UINT16), "textLength"), "clusterMap"), (Array(DWRITE_SHAPING_TEXT_PROPERTIES, "textLength"), "textProps"), (UINT32, "textLength"), (Array(Const(UINT16), "glyphCount"), "glyphIndices"), (Array(Const(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphCount"), "glyphProps"), (UINT32, "glyphCount"), (Pointer(IDWriteFontFace), "fontFace"), (FLOAT, "fontEmSize"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (LPCWSTR, "localeName"), (Array(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES)), "featureRanges"), "features"), (Array(Const(UINT32), "featureRanges"), "featureRangeLengths"), (UINT32, "featureRanges"), Out(Array(FLOAT, "glyphCount"), "glyphAdvances"), Out(Array(DWRITE_GLYPH_OFFSET, "glyphCount"), "glyphOffsets")]),
- Method(HRESULT, "GetGdiCompatibleGlyphPlacements", [(Array(Const(WCHAR), "textLength"), "textString"), (Array(Const(UINT16), "textLength"), "clusterMap"), (Array(DWRITE_SHAPING_TEXT_PROPERTIES, "textLength"), "textProps"), (UINT32, "textLength"), (Array(Const(UINT16), "glyphCount"), "glyphIndices"), (Array(Const(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphCount"), "glyphProps"), (UINT32, "glyphCount"), (Pointer(IDWriteFontFace), "fontFace"), (FLOAT, "fontEmSize"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (LPCWSTR, "localeName"), (Array(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES)), "featureRanges"), "features"), (Array(Const(UINT32), "featureRanges"), "featureRangeLengths"), (UINT32, "featureRanges"), Out(Array(FLOAT, "glyphCount"), "glyphAdvances"), Out(Array(DWRITE_GLYPH_OFFSET, "glyphCount"), "glyphOffsets")]),
++ Method(HRESULT, "SetNumberSubstitution", [(UINT32, "textPosition"), (UINT32, "textLength"), (ObjPointer(IDWriteNumberSubstitution), "numberSubstitution")]),
+]
+
+IDWriteTextAnalyzer.methods += [
- (Pointer(IDWriteFontFace), "fontFace"),
++ 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", [
- Method(HRESULT, "Draw", [(OpaquePointer(Void), "clientDrawingContext"), (Pointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IUnknown), "clientDrawingEffect")]),
++ (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, "DrawGlyphRun", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(Const(DWRITE_GLYPH_RUN_DESCRIPTION)), "glyphRunDescription"), (Pointer(IUnknown), "clientDrawingEffect")]),
- Method(HRESULT, "DrawUnderline", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_UNDERLINE)), "underline"), (Pointer(IUnknown), "clientDrawingEffect")]),
- Method(HRESULT, "DrawStrikethrough", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_STRIKETHROUGH)), "strikethrough"), (Pointer(IUnknown), "clientDrawingEffect")]),
- Method(HRESULT, "DrawInlineObject", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "originX"), (FLOAT, "originY"), (Pointer(IDWriteInlineObject), "inlineObject"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IUnknown), "clientDrawingEffect")]),
++ 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, "SetFontCollection", [(Pointer(IDWriteFontCollection), "fontCollection"), (DWRITE_TEXT_RANGE, "textRange")]),
++ 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, "SetDrawingEffect", [(Pointer(IUnknown), "drawingEffect"), (DWRITE_TEXT_RANGE, "textRange")]),
- Method(HRESULT, "SetInlineObject", [(Pointer(IDWriteInlineObject), "inlineObject"), (DWRITE_TEXT_RANGE, "textRange")]),
- Method(HRESULT, "SetTypography", [(Pointer(IDWriteTypography), "typography"), (DWRITE_TEXT_RANGE, "textRange")]),
++ Method(HRESULT, "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, "GetFontCollection", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection"), Out(Pointer(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, "GetDrawingEffect", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IUnknown)), "drawingEffect"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
- Method(HRESULT, "GetInlineObject", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteInlineObject)), "inlineObject"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
- Method(HRESULT, "GetTypography", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteTypography)), "typography"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
++ Method(HRESULT, "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, "Draw", [(OpaquePointer(Void), "clientDrawingContext"), (Pointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY")]),
++ 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, "DrawGlyphRun", [(FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(IDWriteRenderingParams), "renderingParams"), (COLORREF, "textColor"), Out(Pointer(RECT), "blackBoxRect")]),
++ Method(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, "CreateFontFromLOGFONT", [(Pointer(Const(LOGFONTW)), "logFont"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
- Method(HRESULT, "ConvertFontToLOGFONT", [(Pointer(IDWriteFont), "font"), Out(Pointer(LOGFONTW), "logFont"), Out(Pointer(BOOL), "isSystemFont")]),
- Method(HRESULT, "ConvertFontFaceToLOGFONT", [(Pointer(IDWriteFontFace), "font"), Out(Pointer(LOGFONTW), "logFont")]),
- Method(HRESULT, "CreateFontFaceFromHdc", [(HDC, "hdc"), Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
- Method(HRESULT, "CreateBitmapRenderTarget", [(HDC, "hdc"), (UINT32, "width"), (UINT32, "height"), Out(Pointer(Pointer(IDWriteBitmapRenderTarget)), "renderTarget")]),
++ 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, "GetAlphaBlendParams", [(Pointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(FLOAT), "blendGamma"), Out(Pointer(FLOAT), "blendEnhancedContrast"), Out(Pointer(FLOAT), "blendClearTypeLevel")]),
++ 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, "GetSystemFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection"), (BOOL, "checkForUpdates")]),
- Method(HRESULT, "CreateCustomFontCollection", [(Pointer(IDWriteFontCollectionLoader), "collectionLoader"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
- Method(HRESULT, "RegisterFontCollectionLoader", [(Pointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
- Method(HRESULT, "UnregisterFontCollectionLoader", [(Pointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
- Method(HRESULT, "CreateFontFileReference", [(Pointer(Const(WCHAR)), "filePath"), (Pointer(Const(FILETIME)), "lastWriteTime"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
- Method(HRESULT, "CreateCustomFontFileReference", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), (Pointer(IDWriteFontFileLoader), "fontFileLoader"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
- Method(HRESULT, "CreateFontFace", [(DWRITE_FONT_FACE_TYPE, "fontFaceType"), (UINT32, "numberOfFiles"), (Pointer(Const(Pointer(IDWriteFontFile))), "fontFiles"), (UINT32, "faceIndex"), (DWRITE_FONT_SIMULATIONS, "fontFaceSimulationFlags"), Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
- Method(HRESULT, "CreateRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
- Method(HRESULT, "CreateMonitorRenderingParams", [(HMONITOR, "monitor"), Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
- Method(HRESULT, "CreateCustomRenderingParams", [(FLOAT, "gamma"), (FLOAT, "enhancedContrast"), (FLOAT, "clearTypeLevel"), (DWRITE_PIXEL_GEOMETRY, "pixelGeometry"), (DWRITE_RENDERING_MODE, "renderingMode"), Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
- Method(HRESULT, "RegisterFontFileLoader", [(Pointer(IDWriteFontFileLoader), "fontFileLoader")]),
- Method(HRESULT, "UnregisterFontFileLoader", [(Pointer(IDWriteFontFileLoader), "fontFileLoader")]),
- Method(HRESULT, "CreateTextFormat", [(Pointer(Const(WCHAR)), "fontFamilyName"), (Pointer(IDWriteFontCollection), "fontCollection"), (DWRITE_FONT_WEIGHT, "fontWeight"), (DWRITE_FONT_STYLE, "fontStyle"), (DWRITE_FONT_STRETCH, "fontStretch"), (FLOAT, "fontSize"), (Pointer(Const(WCHAR)), "localeName"), Out(Pointer(Pointer(IDWriteTextFormat)), "textFormat")]),
- Method(HRESULT, "CreateTypography", [Out(Pointer(Pointer(IDWriteTypography)), "typography")]),
- Method(HRESULT, "GetGdiInterop", [Out(Pointer(Pointer(IDWriteGdiInterop)), "gdiInterop")]),
- Method(HRESULT, "CreateTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (FLOAT, "maxWidth"), (FLOAT, "maxHeight"), Out(Pointer(Pointer(IDWriteTextLayout)), "textLayout")]),
- Method(HRESULT, "CreateGdiCompatibleTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (FLOAT, "layoutWidth"), (FLOAT, "layoutHeight"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), Out(Pointer(Pointer(IDWriteTextLayout)), "textLayout")]),
- Method(HRESULT, "CreateEllipsisTrimmingSign", [(Pointer(IDWriteTextFormat), "textFormat"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
- Method(HRESULT, "CreateTextAnalyzer", [Out(Pointer(Pointer(IDWriteTextAnalyzer)), "textAnalyzer")]),
- Method(HRESULT, "CreateNumberSubstitution", [(DWRITE_NUMBER_SUBSTITUTION_METHOD, "substitutionMethod"), (Pointer(Const(WCHAR)), "localeName"), (BOOL, "ignoreUserOverride"), Out(Pointer(Pointer(IDWriteNumberSubstitution)), "numberSubstitution")]),
- Method(HRESULT, "CreateGlyphRunAnalysis", [(Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (DWRITE_RENDERING_MODE, "renderingMode"), (DWRITE_MEASURING_MODE, "measuringMode"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), Out(Pointer(Pointer(IDWriteGlyphRunAnalysis)), "glyphRunAnalysis")]),
++ Method(HRESULT, "GetAlphaBlendParams", [(ObjPointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(FLOAT), "blendGamma"), Out(Pointer(FLOAT), "blendEnhancedContrast"), Out(Pointer(FLOAT), "blendClearTypeLevel")]),
+]
+
+IDWriteFactory.methods += [
- StdFunction(HRESULT, "DWriteCreateFactory", [(DWRITE_FACTORY_TYPE, "factoryType"), (REFIID, "iid"), Out(Pointer(Pointer(IUnknown)), "factory")]),
++ 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")]),
+])
--- /dev/null
+ cgltrace.cpp
++d2d1trace.cpp
+ d3d10_1trace.cpp
+ d3d10trace.cpp
+ d3d11trace.cpp
+ d3d8trace.cpp
+ d3d9trace.cpp
+ ddrawtrace.cpp
+ dlltrace.cpp
++dwritetrace.cpp
+ egltrace.cpp
+ gltrace.cpp
+ glxtrace.cpp
+ wgltrace.cpp
--- /dev/null
+ ##############################################################################
+ # API tracers
+
+
+ include_directories (
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/helpers
+ ${CMAKE_BINARY_DIR}/dispatch
+ ${CMAKE_SOURCE_DIR}/dispatch
+ )
+
+ add_library (common_trace STATIC
+ trace.cpp
+ )
+
+ set_target_properties (common_trace PROPERTIES
+ # Ensure it can be statically linked in shared libraries
+ COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
+ )
+
+ if (WIN32)
+ if (MINGW)
+ # Silence warnings about @nn suffix mismatch
+ set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
+ endif ()
+
+ # ddraw.dll
+ if (DirectX_D3D_INCLUDE_DIR)
+ include_directories (SYSTEM ${DirectX_D3D_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT ddrawtrace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ddrawtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/ddrawtrace.cpp
+ DEPENDS
+ ddrawtrace.py
+ dlltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dtypes.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dcaps.py
+ ${CMAKE_SOURCE_DIR}/specs/ddraw.py
+ ${CMAKE_SOURCE_DIR}/specs/winapi.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+ add_library (ddrawtrace MODULE ddraw.def ddrawtrace.cpp)
+ target_link_libraries (ddrawtrace
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (ddrawtrace PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME ddraw
+ )
+ install (TARGETS ddrawtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
+
+ # d3d8.dll
+ if (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3DX9_INCLUDE_DIR)
+ include_directories (SYSTEM ${DirectX_D3D8_INCLUDE_DIR} ${DirectX_D3DX9_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d8trace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8trace.cpp
+ DEPENDS
+ d3d8trace.py
+ dlltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d8.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d8types.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d8caps.py
+ ${CMAKE_SOURCE_DIR}/specs/winapi.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+ add_library (d3d8trace MODULE d3d8.def d3d8trace.cpp d3d9shader.cpp)
+ target_link_libraries (d3d8trace
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (d3d8trace PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME d3d8
+ )
+ install (TARGETS d3d8trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
+
+ # d3d9.dll
+ if (DirectX_D3DX9_INCLUDE_DIR)
+ include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d9trace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9trace.cpp
+ DEPENDS
+ d3d9trace.py
+ dlltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d9.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d9types.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d9caps.py
+ ${CMAKE_SOURCE_DIR}/specs/winapi.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+ add_library (d3d9trace MODULE d3d9.def d3d9trace.cpp d3d9shader.cpp)
+ target_link_libraries (d3d9trace
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (d3d9trace PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME d3d9
+ )
+ install (TARGETS d3d9trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
+
+ # d3d10.dll
+ if (DirectX_D3D10_INCLUDE_DIR)
+ include_directories (SYSTEM ${DirectX_D3D10_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d10trace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10trace.cpp
+ DEPENDS
+ d3d10trace.py
+ dlltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10misc.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10shader.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10effect.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dcommon.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 (d3d10trace MODULE d3d10.def d3d10trace.cpp d3d10shader.cpp)
+ target_link_libraries (d3d10trace
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (d3d10trace PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME d3d10
+ )
+ install (TARGETS d3d10trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
+
+ # d3d10_1.dll
+ if (DirectX_D3D10_1_INCLUDE_DIR)
+ include_directories (SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d10_1trace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10_1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10_1trace.cpp
+ DEPENDS
+ d3d10_1trace.py
+ dlltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10_1.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dcommon.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 (d3d10_1trace MODULE d3d10_1.def d3d10_1trace.cpp)
+ target_link_libraries (d3d10_1trace
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (d3d10_1trace
+ PROPERTIES PREFIX ""
+ OUTPUT_NAME d3d10_1
+ )
+ install (TARGETS d3d10_1trace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
+
+ # d3d11.dll
+ if (DirectX_D3D11_INCLUDE_DIR)
+ if (DirectX_D3D11_1_INCLUDE_DIR)
+ set (HAVE_D3D11_1 1)
+ else ()
+ set (HAVE_D3D11_1 0)
+ endif ()
+
+ include_directories (SYSTEM ${DirectX_D3D11_INCLUDE_DIR})
+ add_custom_command (
+ OUTPUT d3d11trace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d11trace.py ${HAVE_D3D11_1} > ${CMAKE_CURRENT_BINARY_DIR}/d3d11trace.cpp
+ DEPENDS
+ d3d11trace.py
+ dlltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d11_1.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d11.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d11sdklayers.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dcommon.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 (d3d11trace MODULE d3d11.def d3d11trace.cpp)
+ target_link_libraries (d3d11trace
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (d3d11trace
+ PROPERTIES PREFIX ""
+ OUTPUT_NAME d3d11
+ )
+ 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
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/wgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/wgltrace.cpp
+ DEPENDS
+ wgltrace.py
+ gltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/wglapi.py
+ ${CMAKE_SOURCE_DIR}/specs/wglenum.py
+ ${CMAKE_SOURCE_DIR}/specs/glapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glparams.py
+ ${CMAKE_SOURCE_DIR}/specs/gltypes.py
+ ${CMAKE_SOURCE_DIR}/specs/winapi.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+ add_library (wgltrace MODULE opengl32.def
+ wgltrace.cpp
+ glcaps.cpp
+ gltrace_state.cpp
+ )
+ add_dependencies (wgltrace glproc)
+ target_link_libraries (wgltrace
+ glproc_gl
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ )
+ set_target_properties (wgltrace PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME opengl32
+ )
+ install (TARGETS wgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+
+ elseif (APPLE)
+ # OpenGL framework
+ add_custom_command (
+ OUTPUT cgltrace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cgltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/cgltrace.cpp
+ DEPENDS
+ cgltrace.py
+ gltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/specs/cglapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glparams.py
+ ${CMAKE_SOURCE_DIR}/specs/gltypes.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+
+ add_library (cgltrace SHARED
+ cgltrace.cpp
+ glcaps.cpp
+ gltrace_state.cpp
+ )
+
+ add_dependencies (cgltrace glproc)
+
+ set_target_properties (cgltrace PROPERTIES
+ # OpenGL framework name
+ PREFIX "" OUTPUT_NAME "OpenGL" SUFFIX ""
+ # Specificy the version and reexport GLU symbols
+ LINK_FLAGS "-compatibility_version 1 -current_version 1.0.0 -Wl,-reexport_library,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib"
+ )
+
+ target_link_libraries (cgltrace
+ glproc_gl
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ dl
+ )
+
+ install (TARGETS cgltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ elseif (X11_FOUND)
+ # libGL.so
+ add_custom_command (
+ OUTPUT glxtrace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
+ DEPENDS
+ glxtrace.py
+ gltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/specs/glxapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glparams.py
+ ${CMAKE_SOURCE_DIR}/specs/gltypes.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+
+ add_library (glxtrace SHARED
+ glxtrace.cpp
+ glcaps.cpp
+ gltrace_state.cpp
+ )
+
+ add_dependencies (glxtrace glproc)
+
+ set_target_properties (glxtrace PROPERTIES
+ # avoid the default "lib" prefix
+ PREFIX ""
+ # Prevent symbol relocations internal to our wrapper library to be
+ # overwritten by the application.
+ LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
+ )
+
+ target_link_libraries (glxtrace
+ glproc_gl
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ ${X11_X11_LIB}
+ ${CMAKE_THREAD_LIBS_INIT}
+ dl
+ )
+
+ install (TARGETS glxtrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
+
+
+ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
+ # libEGL.so/libGL.so
+ add_custom_command (
+ OUTPUT egltrace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/egltrace.py > ${CMAKE_CURRENT_BINARY_DIR}/egltrace.cpp
+ DEPENDS
+ egltrace.py
+ gltrace.py
+ trace.py
+ ${CMAKE_SOURCE_DIR}/specs/eglapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glesapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glapi.py
+ ${CMAKE_SOURCE_DIR}/specs/glparams.py
+ ${CMAKE_SOURCE_DIR}/specs/gltypes.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+
+ add_library (egltrace SHARED
+ egltrace.cpp
+ glcaps.cpp
+ gltrace_state.cpp
+ ${CMAKE_SOURCE_DIR}/helpers/eglsize.cpp
+ )
+
+ add_dependencies (egltrace glproc)
+
+ set_target_properties (egltrace PROPERTIES
+ # avoid the default "lib" prefix
+ PREFIX ""
+ # Prevent symbol relocations internal to our wrapper library to be
+ # overwritten by the application.
+ LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions"
+ )
+
+ target_link_libraries (egltrace
+ glproc_egl
+ common_trace
+ common
+ ${ZLIB_LIBRARIES}
+ ${SNAPPY_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ dl
+ )
+
+ install (TARGETS egltrace LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
+ endif ()
--- /dev/null
--- /dev/null
++LIBRARY "d2d1"
++
++EXPORTS
++ D2D1CreateFactory
++ D2D1InvertMatrix
++ D2D1IsMatrixInvertible
++ D2D1MakeRotateMatrix
++ D2D1MakeSkewMatrix
--- /dev/null
--- /dev/null
++##########################################################################
++#
++# 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)
--- /dev/null
--- /dev/null
++LIBRARY "d2d1"
++
++EXPORTS
++ DWriteCreateFactory
--- /dev/null
--- /dev/null
++##########################################################################
++#
++# 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)
--- /dev/null
+ ##########################################################################
+ #
+ # Copyright 2008-2010 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.
+ #
+ ##########################################################################/
+
+ """Common trace code generation."""
+
+
+ # Adjust path
+ import os.path
+ import sys
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
+
+
+ import specs.stdapi as stdapi
+
+
+ def getWrapperInterfaceName(interface):
+ return "Wrap" + interface.expr
+
+
+ class ComplexValueSerializer(stdapi.OnceVisitor):
+ '''Type visitors which generates serialization functions for
+ complex types.
+
+ Simple types are serialized inline.
+ '''
+
+ def __init__(self, serializer):
+ stdapi.OnceVisitor.__init__(self)
+ self.serializer = serializer
+
+ def visitVoid(self, literal):
+ pass
+
+ def visitLiteral(self, literal):
+ pass
+
+ def visitString(self, string):
+ pass
+
+ def visitConst(self, const):
+ self.visit(const.type)
+
+ def visitStruct(self, struct):
+ for type, name in struct.members:
+ self.visit(type)
+ print 'static void _write__%s(const %s &value) {' % (struct.tag, struct.expr)
+ print ' static const char * members[%u] = {' % (len(struct.members),)
+ for type, name, in struct.members:
+ print ' "%s",' % (name,)
+ print ' };'
+ print ' static const trace::StructSig sig = {'
+ print ' %u, "%s", %u, members' % (struct.id, struct.name, len(struct.members))
+ print ' };'
+ print ' trace::localWriter.beginStruct(&sig);'
+ for type, name in struct.members:
+ self.serializer.visit(type, 'value.%s' % (name,))
+ print ' trace::localWriter.endStruct();'
+ print '}'
+ print
+
+ def visitArray(self, array):
+ self.visit(array.type)
+
+ def visitBlob(self, array):
+ pass
+
+ def visitEnum(self, enum):
+ print 'static const trace::EnumValue _enum%s_values[] = {' % (enum.tag)
+ for value in enum.values:
+ print ' {"%s", %s},' % (value, value)
+ print '};'
+ print
+ print 'static const trace::EnumSig _enum%s_sig = {' % (enum.tag)
+ print ' %u, %u, _enum%s_values' % (enum.id, len(enum.values), enum.tag)
+ print '};'
+ print
+
+ def visitBitmask(self, bitmask):
+ print 'static const trace::BitmaskFlag _bitmask%s_flags[] = {' % (bitmask.tag)
+ for value in bitmask.values:
+ print ' {"%s", %s},' % (value, value)
+ print '};'
+ print
+ print 'static const trace::BitmaskSig _bitmask%s_sig = {' % (bitmask.tag)
+ print ' %u, %u, _bitmask%s_flags' % (bitmask.id, len(bitmask.values), bitmask.tag)
+ print '};'
+ print
+
+ def visitPointer(self, pointer):
+ self.visit(pointer.type)
+
+ def visitIntPointer(self, pointer):
+ pass
+
+ def visitObjPointer(self, pointer):
+ self.visit(pointer.type)
+
+ def visitLinearPointer(self, pointer):
+ self.visit(pointer.type)
+
+ def visitHandle(self, handle):
+ self.visit(handle.type)
+
+ def visitReference(self, reference):
+ self.visit(reference.type)
+
+ def visitAlias(self, alias):
+ self.visit(alias.type)
+
+ def visitOpaque(self, opaque):
+ pass
+
+ def visitInterface(self, interface):
+ pass
+
+ def visitPolymorphic(self, polymorphic):
+ if not polymorphic.contextLess:
+ return
+ print 'static void _write__%s(int selector, const %s & value) {' % (polymorphic.tag, polymorphic.expr)
+ print ' switch (selector) {'
+ for cases, type in polymorphic.iterSwitch():
+ for case in cases:
+ print ' %s:' % case
+ self.serializer.visit(type, 'static_cast<%s>(value)' % (type,))
+ print ' break;'
+ print ' }'
+ print '}'
+ print
+
+
+ class ValueSerializer(stdapi.Visitor):
+ '''Visitor which generates code to serialize any type.
+
+ Simple types are serialized inline here, whereas the serialization of
+ complex types is dispatched to the serialization functions generated by
+ ComplexValueSerializer visitor above.
+ '''
+
+ def visitLiteral(self, literal, instance):
+ print ' trace::localWriter.write%s(%s);' % (literal.kind, instance)
+
+ def visitString(self, string, instance):
+ if not string.wide:
+ cast = 'const char *'
+ suffix = 'String'
+ else:
+ cast = 'const wchar_t *'
+ suffix = 'WString'
+ if cast != string.expr:
+ # reinterpret_cast is necessary for GLubyte * <=> char *
+ instance = 'reinterpret_cast<%s>(%s)' % (cast, instance)
+ if string.length is not None:
+ length = ', %s' % string.length
+ else:
+ length = ''
+ print ' trace::localWriter.write%s(%s%s);' % (suffix, instance, length)
+
+ def visitConst(self, const, instance):
+ self.visit(const.type, instance)
+
+ def visitStruct(self, struct, instance):
+ print ' _write__%s(%s);' % (struct.tag, instance)
+
+ def visitArray(self, array, instance):
+ length = '_c' + array.type.tag
+ index = '_i' + array.type.tag
+ print ' if (%s) {' % instance
+ print ' size_t %s = %s > 0 ? %s : 0;' % (length, array.length, array.length)
+ print ' trace::localWriter.beginArray(%s);' % length
+ print ' for (size_t %s = 0; %s < %s; ++%s) {' % (index, index, length, index)
+ print ' trace::localWriter.beginElement();'
+ self.visit(array.type, '(%s)[%s]' % (instance, index))
+ print ' trace::localWriter.endElement();'
+ print ' }'
+ print ' trace::localWriter.endArray();'
+ print ' } else {'
+ print ' trace::localWriter.writeNull();'
+ print ' }'
+
+ def visitBlob(self, blob, instance):
+ print ' trace::localWriter.writeBlob(%s, %s);' % (instance, blob.size)
+
+ def visitEnum(self, enum, instance):
+ print ' trace::localWriter.writeEnum(&_enum%s_sig, %s);' % (enum.tag, instance)
+
+ def visitBitmask(self, bitmask, instance):
+ print ' trace::localWriter.writeBitmask(&_bitmask%s_sig, %s);' % (bitmask.tag, instance)
+
+ def visitPointer(self, pointer, instance):
+ print ' if (%s) {' % instance
+ print ' trace::localWriter.beginArray(1);'
+ print ' trace::localWriter.beginElement();'
+ self.visit(pointer.type, "*" + instance)
+ print ' trace::localWriter.endElement();'
+ print ' trace::localWriter.endArray();'
+ print ' } else {'
+ print ' trace::localWriter.writeNull();'
+ print ' }'
+
+ def visitIntPointer(self, pointer, instance):
+ print ' trace::localWriter.writePointer((uintptr_t)%s);' % instance
+
+ def visitObjPointer(self, pointer, instance):
+ print ' trace::localWriter.writePointer((uintptr_t)%s);' % instance
+
+ def visitLinearPointer(self, pointer, instance):
+ print ' trace::localWriter.writePointer((uintptr_t)%s);' % instance
+
+ def visitReference(self, reference, instance):
+ self.visit(reference.type, instance)
+
+ def visitHandle(self, handle, instance):
+ self.visit(handle.type, instance)
+
+ def visitAlias(self, alias, instance):
+ self.visit(alias.type, instance)
+
+ def visitOpaque(self, opaque, instance):
+ print ' trace::localWriter.writePointer((uintptr_t)%s);' % instance
+
+ def visitInterface(self, interface, instance):
+ assert False
+
+ def visitPolymorphic(self, polymorphic, instance):
+ if polymorphic.contextLess:
+ print ' _write__%s(%s, %s);' % (polymorphic.tag, polymorphic.switchExpr, instance)
+ else:
+ print ' switch (%s) {' % polymorphic.switchExpr
+ for cases, type in polymorphic.iterSwitch():
+ for case in cases:
+ print ' %s:' % case
+ self.visit(type, 'static_cast<%s>(%s)' % (type, instance))
+ print ' break;'
+ print ' }'
+
+
+ class WrapDecider(stdapi.Traverser):
+ '''Type visitor which will decide wheter this type will need wrapping or not.
+
+ For complex types (arrays, structures), we need to know this before hand.
+ '''
+
+ def __init__(self):
+ self.needsWrapping = False
+
+ def visitLinearPointer(self, void):
+ pass
+
+ def visitInterface(self, interface):
+ self.needsWrapping = True
+
+
+ class ValueWrapper(stdapi.Traverser):
+ '''Type visitor which will generate the code to wrap an instance.
+
+ Wrapping is necessary mostly for interfaces, however interface pointers can
+ appear anywhere inside complex types.
+ '''
+
+ def visitStruct(self, struct, instance):
+ for type, name in struct.members:
+ self.visit(type, "(%s).%s" % (instance, name))
+
+ def visitArray(self, array, instance):
+ print " if (%s) {" % instance
+ print " for (size_t _i = 0, _s = %s; _i < _s; ++_i) {" % array.length
+ self.visit(array.type, instance + "[_i]")
+ print " }"
+ print " }"
+
+ def visitPointer(self, pointer, instance):
+ print " if (%s) {" % instance
+ self.visit(pointer.type, "*" + instance)
+ print " }"
+
+ def visitObjPointer(self, pointer, instance):
+ 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)
+
+ def visitInterface(self, interface, instance):
+ raise NotImplementedError
+
+ def visitInterfacePointer(self, interface, instance):
+ print " if (%s) {" % instance
+ print " %s = new %s(%s);" % (instance, getWrapperInterfaceName(interface), instance)
+ print " }"
+
+ def visitPolymorphic(self, type, instance):
+ # XXX: There might be polymorphic values that need wrapping in the future
+ raise NotImplementedError
+
+
+ class ValueUnwrapper(ValueWrapper):
+ '''Reverse of 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)
+ elem_type = array.type.mutable()
+ print " if (%s && %s) {" % (instance, array.length)
+ print " %s * _t = static_cast<%s *>(alloca(%s * sizeof *_t));" % (elem_type, elem_type, array.length)
+ print " for (size_t _i = 0, _s = %s; _i < _s; ++_i) {" % array.length
+ print " _t[_i] = %s[_i];" % instance
+ self.allocated = True
+ self.visit(array.type, "_t[_i]")
+ print " }"
+ print " %s = _t;" % instance
+ print " }"
+
+ def visitInterfacePointer(self, interface, instance):
+ print r' if (%s) {' % instance
+ print r' const %s *pWrapper = static_cast<const %s*>(%s);' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), instance)
+ print r' if (pWrapper && pWrapper->m_dwMagic == 0xd8365d6c) {'
+ print r' %s = pWrapper->m_pInstance;' % (instance,)
+ print r' } else {'
+ print r' os::log("apitrace: warning: %%s: unexpected %%s pointer\n", __FUNCTION__, "%s");' % interface.name
+ print r' }'
+ print r' }'
+
+
+ class Tracer:
+ '''Base class to orchestrate the code generation of API tracing.'''
+
+ def __init__(self):
+ self.api = None
+
+ def serializerFactory(self):
+ '''Create a serializer.
+
+ Can be overriden by derived classes to inject their own serialzer.
+ '''
+
+ return ValueSerializer()
+
+ def traceApi(self, api):
+ self.api = api
+
+ self.header(api)
+
+ # Includes
+ for header in api.headers:
+ print header
+ print
+
+ # Generate the serializer functions
+ types = api.getAllTypes()
+ visitor = ComplexValueSerializer(self.serializerFactory())
+ map(visitor.visit, types)
+ print
+
+ # Interfaces wrapers
+ self.traceInterfaces(api)
+
+ # Function wrappers
+ self.interface = None
+ self.base = None
+ map(self.traceFunctionDecl, api.functions)
+ map(self.traceFunctionImpl, api.functions)
+ print
+
+ self.footer(api)
+
+ def header(self, api):
+ print '#ifdef _WIN32'
+ print '# include <malloc.h> // alloca'
+ print '# ifndef alloca'
+ print '# define alloca _alloca'
+ print '# endif'
+ print '#else'
+ print '# include <alloca.h> // alloca'
+ print '#endif'
+ print
+ print '#include "trace.hpp"'
+ print
+
+ def footer(self, api):
+ pass
+
+ def traceFunctionDecl(self, function):
+ # Per-function declarations
+
+ if not function.internal:
+ if function.args:
+ print 'static const char * _%s_args[%u] = {%s};' % (function.name, len(function.args), ', '.join(['"%s"' % arg.name for arg in function.args]))
+ else:
+ print 'static const char ** _%s_args = NULL;' % (function.name,)
+ print 'static const trace::FunctionSig _%s_sig = {%u, "%s", %u, _%s_args};' % (function.name, function.id, function.name, len(function.args), function.name)
+ print
+
+ def isFunctionPublic(self, function):
+ return True
+
+ def traceFunctionImpl(self, function):
+ if self.isFunctionPublic(function):
+ print 'extern "C" PUBLIC'
+ else:
+ print 'extern "C" PRIVATE'
+ print function.prototype() + ' {'
+ if function.type is not stdapi.Void:
+ print ' %s _result;' % function.type
+
+ # No-op if tracing is disabled
+ print ' if (!trace::isTracingEnabled()) {'
+ Tracer.invokeFunction(self, function)
+ if function.type is not stdapi.Void:
+ print ' return _result;'
+ else:
+ print ' return;'
+ print ' }'
+
+ self.traceFunctionImplBody(function)
+ if function.type is not stdapi.Void:
+ print ' return _result;'
+ print '}'
+ print
+
+ def traceFunctionImplBody(self, function):
+ if not function.internal:
+ print ' unsigned _call = trace::localWriter.beginEnter(&_%s_sig);' % (function.name,)
+ for arg in function.args:
+ if not arg.output:
+ self.unwrapArg(function, arg)
+ self.serializeArg(function, arg)
+ print ' trace::localWriter.endEnter();'
+ self.invokeFunction(function)
+ if not function.internal:
+ print ' trace::localWriter.beginLeave(_call);'
+ for arg in function.args:
+ if arg.output:
+ self.serializeArg(function, arg)
+ self.wrapArg(function, arg)
+ if function.type is not stdapi.Void:
+ self.serializeRet(function, "_result")
+ print ' trace::localWriter.endLeave();'
+ if function.type is not stdapi.Void:
+ self.wrapRet(function, "_result")
+
+ def invokeFunction(self, function, prefix='_', suffix=''):
+ if function.type is stdapi.Void:
+ result = ''
+ else:
+ result = '_result = '
+ dispatch = prefix + function.name + suffix
+ print ' %s%s(%s);' % (result, dispatch, ', '.join([str(arg.name) for arg in function.args]))
+
+ def serializeArg(self, function, arg):
+ print ' trace::localWriter.beginArg(%u);' % (arg.index,)
+ self.serializeArgValue(function, arg)
+ print ' trace::localWriter.endArg();'
+
+ def serializeArgValue(self, function, arg):
+ self.serializeValue(arg.type, arg.name)
+
+ def wrapArg(self, function, arg):
+ assert not isinstance(arg.type, stdapi.ObjPointer)
+
+ from specs.winapi import REFIID
+ riid = None
+ for other_arg in function.args:
+ if not other_arg.output and other_arg.type is REFIID:
+ riid = other_arg
+ if riid is not None \
+ and isinstance(arg.type, stdapi.Pointer) \
+ and isinstance(arg.type.type, stdapi.ObjPointer):
+ self.wrapIid(function, riid, arg)
+ return
+
+ self.wrapValue(arg.type, arg.name)
+
+ def unwrapArg(self, function, arg):
+ self.unwrapValue(arg.type, arg.name)
+
+ def serializeRet(self, function, instance):
+ print ' trace::localWriter.beginReturn();'
+ self.serializeValue(function.type, instance)
+ print ' trace::localWriter.endReturn();'
+
+ def serializeValue(self, type, instance):
+ serializer = self.serializerFactory()
+ serializer.visit(type, instance)
+
+ def wrapRet(self, function, instance):
+ self.wrapValue(function.type, instance)
+
+ def unwrapRet(self, function, instance):
+ self.unwrapValue(function.type, instance)
+
+ def needsWrapping(self, type):
+ visitor = WrapDecider()
+ visitor.visit(type)
+ return visitor.needsWrapping
+
+ def wrapValue(self, type, instance):
+ if self.needsWrapping(type):
+ visitor = ValueWrapper()
+ visitor.visit(type, instance)
+
+ def unwrapValue(self, type, instance):
+ if self.needsWrapping(type):
+ visitor = ValueUnwrapper()
+ visitor.visit(type, instance)
+
+ def traceInterfaces(self, api):
+ interfaces = api.getAllInterfaces()
+ if not interfaces:
+ return
+ map(self.declareWrapperInterface, interfaces)
+ self.implementIidWrapper(api)
+ map(self.implementWrapperInterface, interfaces)
+ print
+
+ def declareWrapperInterface(self, interface):
+ print "class %s : public %s " % (getWrapperInterfaceName(interface), interface.name)
+ print "{"
+ print "public:"
+ print " %s(%s * pInstance);" % (getWrapperInterfaceName(interface), interface.name)
+ print " virtual ~%s();" % getWrapperInterfaceName(interface)
+ print
+ for method in interface.iterMethods():
+ print " " + method.prototype() + ";"
+ print
+ #print "private:"
+ for type, name, value in self.enumWrapperInterfaceVariables(interface):
+ print ' %s %s;' % (type, name)
+ print "};"
+ print
+
+ def enumWrapperInterfaceVariables(self, interface):
+ return [
+ ("DWORD", "m_dwMagic", "0xd8365d6c"),
+ ("%s *" % interface.name, "m_pInstance", "pInstance"),
+ ]
+
+ def implementWrapperInterface(self, interface):
+ self.interface = interface
+
+ print '%s::%s(%s * pInstance) {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), interface.name)
+ for type, name, value in self.enumWrapperInterfaceVariables(interface):
+ print ' %s = %s;' % (name, value)
+ print '}'
+ print
+ print '%s::~%s() {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface))
+ print '}'
+ print
+
+ for base, method in interface.iterBaseMethods():
+ self.base = base
+ self.implementWrapperInterfaceMethod(interface, base, method)
+
+ print
+
+ def implementWrapperInterfaceMethod(self, interface, base, method):
+ print method.prototype(getWrapperInterfaceName(interface) + '::' + method.name) + ' {'
+ if method.type is not stdapi.Void:
+ print ' %s _result;' % method.type
+
+ self.implementWrapperInterfaceMethodBody(interface, base, method)
+
+ if method.type is not stdapi.Void:
+ print ' return _result;'
+ print '}'
+ print
+
+ def implementWrapperInterfaceMethodBody(self, interface, base, method):
+ assert not method.internal
+
+ print ' static const char * _args[%u] = {%s};' % (len(method.args) + 1, ', '.join(['"this"'] + ['"%s"' % arg.name for arg in method.args]))
+ print ' static const trace::FunctionSig _sig = {%u, "%s", %u, _args};' % (method.id, interface.name + '::' + method.name, len(method.args) + 1)
+
+ print ' %s *_this = static_cast<%s *>(m_pInstance);' % (base, base)
+
+ print ' unsigned _call = trace::localWriter.beginEnter(&_sig);'
+ print ' trace::localWriter.beginArg(0);'
+ print ' trace::localWriter.writePointer((uintptr_t)m_pInstance);'
+ print ' trace::localWriter.endArg();'
+ for arg in method.args:
+ if not arg.output:
+ self.unwrapArg(method, arg)
+ self.serializeArg(method, arg)
+ print ' trace::localWriter.endEnter();'
+
+ self.invokeMethod(interface, base, method)
+
+ print ' trace::localWriter.beginLeave(_call);'
+ for arg in method.args:
+ if arg.output:
+ self.serializeArg(method, arg)
+ self.wrapArg(method, arg)
+
+ if method.type is not stdapi.Void:
+ self.serializeRet(method, '_result')
+ print ' trace::localWriter.endLeave();'
+ if method.type is not stdapi.Void:
+ self.wrapRet(method, '_result')
+
+ if method.name == 'Release':
+ assert method.type is not stdapi.Void
+ print ' if (!_result)'
+ print ' delete this;'
+
+ def implementIidWrapper(self, api):
+ print r'static void'
+ print r'warnIID(const char *functionName, REFIID riid, const char *reason) {'
+ print r' os::log("apitrace: warning: %s: %s IID {0x%08lX,0x%04X,0x%04X,{0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X}}\n",'
+ print r' functionName, reason,'
+ print r' riid.Data1, riid.Data2, riid.Data3,'
+ print r' riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3], riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);'
+ print r'}'
+ print
+ print r'static void'
+ print r'wrapIID(const char *functionName, REFIID riid, void * * ppvObj) {'
+ print r' if (!ppvObj || !*ppvObj) {'
+ print r' return;'
+ print r' }'
+ else_ = ''
+ for iface in api.getAllInterfaces():
+ print r' %sif (riid == IID_%s) {' % (else_, iface.name)
+ print r' *ppvObj = new Wrap%s((%s *) *ppvObj);' % (iface.name, iface.name)
+ print r' }'
+ else_ = 'else '
+ print r' %s{' % else_
+ print r' warnIID(functionName, riid, "unknown");'
+ print r' }'
+ print r'}'
+ print
+
+ def wrapIid(self, function, riid, out):
+ # Cast output arg to `void **` if necessary
+ out_name = out.name
+ obj_type = out.type.type.type
+ if not obj_type is stdapi.Void:
+ assert isinstance(obj_type, stdapi.Interface)
+ out_name = 'reinterpret_cast<void * *>(%s)' % out_name
+
+ print r' if (%s && *%s) {' % (out.name, out.name)
+ functionName = function.name
+ else_ = ''
+ if self.interface is not None:
+ functionName = self.interface.name + '::' + functionName
+ print r' if (*%s == m_pInstance &&' % (out_name,)
+ print r' (%s)) {' % ' || '.join('%s == IID_%s' % (riid.name, iface.name) for iface in self.interface.iterBases())
+ print r' *%s = this;' % (out_name,)
+ print r' }'
+ else_ = 'else '
+ print r' %s{' % else_
+ print r' wrapIID("%s", %s, %s);' % (functionName, riid.name, out_name)
+ print r' }'
+ print r' }'
+
+ def invokeMethod(self, interface, base, method):
+ if method.type is stdapi.Void:
+ result = ''
+ else:
+ result = '_result = '
+ print ' %s_this->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args]))
+
+ def emit_memcpy(self, dest, src, length):
+ print ' unsigned _call = trace::localWriter.beginEnter(&trace::memcpy_sig);'
+ print ' trace::localWriter.beginArg(0);'
+ print ' trace::localWriter.writePointer((uintptr_t)%s);' % dest
+ print ' trace::localWriter.endArg();'
+ print ' trace::localWriter.beginArg(1);'
+ print ' trace::localWriter.writeBlob(%s, %s);' % (src, length)
+ print ' trace::localWriter.endArg();'
+ print ' trace::localWriter.beginArg(2);'
+ print ' trace::localWriter.writeUInt(%s);' % length
+ print ' trace::localWriter.endArg();'
+ print ' trace::localWriter.endEnter();'
+ print ' trace::localWriter.beginLeave(_call);'
+ print ' trace::localWriter.endLeave();'
+
+ def fake_call(self, function, args):
+ print ' unsigned _fake_call = trace::localWriter.beginEnter(&_%s_sig);' % (function.name,)
+ for arg, instance in zip(function.args, args):
+ assert not arg.output
+ print ' trace::localWriter.beginArg(%u);' % (arg.index,)
+ self.serializeValue(arg.type, instance)
+ print ' trace::localWriter.endArg();'
+ print ' trace::localWriter.endEnter();'
+ print ' trace::localWriter.beginLeave(_fake_call);'
+ print ' trace::localWriter.endLeave();'
+