From 2f72c13c379322ab99cd316eb80ccf9c99ce4152 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 12 May 2014 09:34:03 +0200 Subject: [PATCH] d2d1: Add the ID2D1Geometry interface. --- include/d2d1.idl | 115 +++++++++++++++++++++++++++++++++++++++++ include/d2dbasetypes.h | 18 +++++++ 2 files changed, 133 insertions(+) diff --git a/include/d2d1.idl b/include/d2d1.idl index b208f713457..63ca96eac37 100644 --- a/include/d2d1.idl +++ b/include/d2d1.idl @@ -20,6 +20,8 @@ import "unknwn.idl"; import "d2dbasetypes.h"; typedef D2D_POINT_2F D2D1_POINT_2F; +typedef D2D_MATRIX_3X2_F D2D1_MATRIX_3X2_F; +typedef D2D_RECT_F D2D1_RECT_F; typedef enum D2D1_DEBUG_LEVEL { @@ -95,6 +97,32 @@ typedef enum D2D1_DASH_STYLE D2D1_DASH_STYLE_FORCE_DWORD = 0xffffffff, } D2D1_DASH_STYLE; +typedef enum D2D1_GEOMETRY_RELATION +{ + D2D1_GEOMETRY_RELATION_UNKNOWN = 0, + D2D1_GEOMETRY_RELATION_DISJOINT = 1, + D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2, + D2D1_GEOMETRY_RELATION_CONTAINS = 3, + D2D1_GEOMETRY_RELATION_OVERLAP = 4, + D2D1_GEOMETRY_RELATION_FORCE_DWORD = 0xffffffff, +} D2D1_GEOMETRY_RELATION; + +typedef enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION +{ + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD = 0xffffffff, +} D2D1_GEOMETRY_SIMPLIFICATION_OPTION; + +typedef enum D2D1_COMBINE_MODE +{ + D2D1_COMBINE_MODE_UNION = 0, + D2D1_COMBINE_MODE_INTERSECT = 1, + D2D1_COMBINE_MODE_XOR = 2, + D2D1_COMBINE_MODE_EXCLUDE = 3, + D2D1_COMBINE_MODE_FORCE_DWORD = 0xffffffff, +} D2D1_COMBINE_MODE; + typedef struct D2D1_BEZIER_SEGMENT { D2D1_POINT_2F point1; @@ -179,5 +207,92 @@ interface ID2D1TessellationSink : IUnknown HRESULT Close(); } +[ + local, + object, + uuid(2cd906a1-12e2-11dc-9fed-001143a055f9) +] +interface ID2D1Geometry : ID2D1Resource +{ + HRESULT GetBounds( + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [out] D2D1_RECT_F *bounds + ); + HRESULT GetWidenedBounds( + [in] float stroke_width, + [in, optional] ID2D1StrokeStyle *stroke_style, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out] D2D1_RECT_F *bounds + ); + HRESULT StrokeContainsPoint( + [in] D2D1_POINT_2F point, + [in] float stroke_width, + [in, optional] ID2D1StrokeStyle *stroke_style, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out] BOOL *contains + ); + HRESULT FillContainsPoint( + [in] D2D1_POINT_2F point, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out] BOOL *contains + ); + HRESULT CompareWithGeometry( + [in] ID2D1Geometry *geometry, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out] D2D1_GEOMETRY_RELATION *relation + ); + HRESULT Simplify( + [in] D2D1_GEOMETRY_SIMPLIFICATION_OPTION option, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [in] ID2D1SimplifiedGeometrySink *sink + ); + HRESULT Tessellate( + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [in] ID2D1TessellationSink *sink + ); + HRESULT CombineWithGeometry( + [in] ID2D1Geometry *geometry, + [in] D2D1_COMBINE_MODE combine_mode, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [in] ID2D1SimplifiedGeometrySink *sink + ); + HRESULT Outline( + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [in] ID2D1SimplifiedGeometrySink *sink + ); + HRESULT ComputeArea( + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out] float *area + ); + HRESULT ComputeLength( + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out] float *length + ); + HRESULT ComputePointAtLength( + [in] float length, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [out, optional] D2D1_POINT_2F *point, + [out, optional] D2D1_POINT_2F *tangent + ); + HRESULT Widen( + [in] float stroke_width, + [in, optional] ID2D1StrokeStyle *stroke_style, + [in, optional] const D2D1_MATRIX_3X2_F *transform, + [in] float tolerance, + [in] ID2D1SimplifiedGeometrySink *sink + ); +} + [local] HRESULT __stdcall D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid, const D2D1_FACTORY_OPTIONS *factory_options, void **factory); diff --git a/include/d2dbasetypes.h b/include/d2dbasetypes.h index b306e2b4ca7..385e0b381c0 100644 --- a/include/d2dbasetypes.h +++ b/include/d2dbasetypes.h @@ -21,3 +21,21 @@ typedef struct D2D_POINT_2F FLOAT x; FLOAT y; } D2D_POINT_2F; + +typedef struct D2D_MATRIX_3X2_F +{ + float _11; + float _12; + float _21; + float _22; + float _31; + float _32; +} D2D_MATRIX_3X2_F; + +typedef struct D2D_RECT_F +{ + float left; + float top; + float right; + float bottom; +} D2D_RECT_F;