diff --git a/src/D2DLib.sln b/src/D2DLib.sln index 63ad7e31c..4e43c41ec 100644 --- a/src/D2DLib.sln +++ b/src/D2DLib.sln @@ -1,16 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29020.237 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d2dlib", "d2dlib\d2dlib.vcxproj", "{E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D2DLibExport", "D2DLibExport\D2DLibExport.csproj", "{81DD53D8-FCF0-4384-A931-9370FA8E8E67}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "D2DLibExport", "D2DLibExport\D2DLibExport.csproj", "{81DD53D8-FCF0-4384-A931-9370FA8E8E67}" ProjectSection(ProjectDependencies) = postProject {E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9} = {E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{D653531B-D30C-4A20-8AE5-D46A6F03E274}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples", "Examples\Examples.csproj", "{D653531B-D30C-4A20-8AE5-D46A6F03E274}" ProjectSection(ProjectDependencies) = postProject {E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9} = {E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9} EndProjectSection @@ -37,11 +37,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snapshots", "snapshots", "{ ..\snapshots\whiteboard.png = ..\snapshots\whiteboard.png EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D2DWinForm", "D2DWinForm\D2DWinForm.csproj", "{40ED2809-ABA2-4655-82DD-E38AD12138BB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "D2DWinForm", "D2DWinForm\D2DWinForm.csproj", "{40ED2809-ABA2-4655-82DD-E38AD12138BB}" ProjectSection(ProjectDependencies) = postProject {E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9} = {E0A71FCE-69DD-40A6-87FB-2D63AB5D25C9} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Éléments de solution", "Éléments de solution", "{6E37D4A0-DB61-48D6-ADC3-F08557227322}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MTest1", "MTest1\MTest1\MTest1.csproj", "{C179F80B-1BC7-407E-8F8C-E1EE66F45709}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -82,6 +86,14 @@ Global {40ED2809-ABA2-4655-82DD-E38AD12138BB}.Release|x64.Build.0 = Release|x64 {40ED2809-ABA2-4655-82DD-E38AD12138BB}.Release|x86.ActiveCfg = Release|x86 {40ED2809-ABA2-4655-82DD-E38AD12138BB}.Release|x86.Build.0 = Release|x86 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Debug|x64.ActiveCfg = Debug|x64 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Debug|x64.Build.0 = Debug|x64 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Debug|x86.ActiveCfg = Debug|x86 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Debug|x86.Build.0 = Debug|x86 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Release|x64.ActiveCfg = Release|x64 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Release|x64.Build.0 = Release|x64 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Release|x86.ActiveCfg = Release|x86 + {C179F80B-1BC7-407E-8F8C-E1EE66F45709}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/D2DLibExport/D2DGraphics.cs b/src/D2DLibExport/D2DGraphics.cs index b4dfa99f4..8309f3a7f 100644 --- a/src/D2DLibExport/D2DGraphics.cs +++ b/src/D2DLibExport/D2DGraphics.cs @@ -489,7 +489,7 @@ public void FillPath(D2DGeometry path, D2DColor fillColor) { D2D.FillPathD(path.Handle, fillColor); } - + public void Clear(D2DColor color) { D2D.Clear(Handle, color); diff --git a/src/D2DLibExport/D2DLib.cs b/src/D2DLibExport/D2DLib.cs index d4bda2847..28451423a 100644 --- a/src/D2DLibExport/D2DLib.cs +++ b/src/D2DLibExport/D2DLib.cs @@ -285,7 +285,7 @@ public static extern void DrawPath(HANDLE path, D2DColor strokeColor, FLOAT stro [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] public static extern void FillPathD(HANDLE path, D2DColor fillColor); - + [DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)] public static extern void FillGeometryWithBrush(HANDLE path, HANDLE brush); diff --git a/src/D2DLibExport/D2DLibExport.csproj b/src/D2DLibExport/D2DLibExport.csproj index da6c4faa0..21f38811f 100644 --- a/src/D2DLibExport/D2DLibExport.csproj +++ b/src/D2DLibExport/D2DLibExport.csproj @@ -13,4 +13,8 @@ + + + + \ No newline at end of file diff --git a/src/d2dlib/Geometry.cpp b/src/d2dlib/Geometry.cpp index b9ab40277..85035ead5 100644 --- a/src/d2dlib/Geometry.cpp +++ b/src/d2dlib/Geometry.cpp @@ -181,10 +181,10 @@ void AddPathArc(HANDLE ctx, D2D1_POINT_2F endPoint, D2D1_SIZE_F size, FLOAT swee pathContext->sink->AddArc(&seg); } -void DrawPath(HANDLE pathCtx, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle) +void DrawPath(HANDLE geoCtx, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle) { - D2DPathContext* pathContext = reinterpret_cast(pathCtx); - D2DContext* context = pathContext->d2context; + D2DGeometryContext* geometryContext = reinterpret_cast(geoCtx); + D2DContext* context = geometryContext->d2context; ID2D1Factory* factory = context->factory; ID2D1RenderTarget* renderTarget = context->renderTarget; @@ -206,27 +206,27 @@ void DrawPath(HANDLE pathCtx, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_ 0.0f), NULL, 0, &strokeStyle); } - renderTarget->DrawGeometry(pathContext->path, strokeBrush, strokeWidth, strokeStyle); + renderTarget->DrawGeometry(geometryContext->geometry, strokeBrush, strokeWidth, strokeStyle); SafeRelease(&strokeBrush); SafeRelease(&strokeStyle); } -void DrawPathWithPen(HANDLE pathCtx, HANDLE strokePen, FLOAT strokeWidth) +void DrawPathWithPen(HANDLE geoCtx, HANDLE strokePen, FLOAT strokeWidth) { D2DPen* pen = reinterpret_cast(strokePen); - D2DPathContext* pathContext = reinterpret_cast(pathCtx); - ID2D1RenderTarget* renderTarget = pathContext->d2context->renderTarget; + D2DGeometryContext* geometryContext = reinterpret_cast(geoCtx); + ID2D1RenderTarget* renderTarget = geometryContext->d2context->renderTarget; if (pen->brush != NULL) { - renderTarget->DrawGeometry(pathContext->path, pen->brush, strokeWidth, pen->strokeStyle); + renderTarget->DrawGeometry(geometryContext->geometry, pen->brush, strokeWidth, pen->strokeStyle); } } -void FillPathD(HANDLE pathCtx, D2D1_COLOR_F fillColor) +void FillPathD(HANDLE geoCtx, D2D1_COLOR_F fillColor) { - D2DPathContext* pathContext = reinterpret_cast(pathCtx); - ID2D1RenderTarget* renderTarget = pathContext->d2context->renderTarget; + D2DGeometryContext* geometryContext = reinterpret_cast(geoCtx); + ID2D1RenderTarget* renderTarget = geometryContext->d2context->renderTarget; if (fillColor.a > 0) { @@ -234,7 +234,7 @@ void FillPathD(HANDLE pathCtx, D2D1_COLOR_F fillColor) renderTarget->CreateSolidColorBrush(fillColor, &fillBrush); if (fillBrush != NULL) { - renderTarget->FillGeometry(pathContext->path, fillBrush); + renderTarget->FillGeometry(geometryContext->geometry, fillBrush); } SafeRelease(&fillBrush); @@ -376,13 +376,13 @@ void DrawPolygonWithBrush(HANDLE ctx, D2D1_POINT_2F* points, UINT count, } -void FillPathWithBrush(HANDLE ctx, HANDLE brushHandle) +void FillPathWithBrush(HANDLE geoCtx, HANDLE brushHandle) { - D2DPathContext* pathContext = reinterpret_cast(ctx); + D2DGeometryContext* geoContext = reinterpret_cast(geoCtx); D2DBrushContext* brushContext = reinterpret_cast(brushHandle); - D2DContext* context = pathContext->d2context; + D2DContext* context = geoContext->d2context; - context->renderTarget->FillGeometry(pathContext->path, brushContext->brush); + context->renderTarget->FillGeometry(geoContext->geometry, brushContext->brush); } void FillGeometryWithBrush(HANDLE ctx, HANDLE geoHandle, _In_ HANDLE brushHandle, _In_opt_ HANDLE opacityBrushHandle) @@ -397,21 +397,21 @@ void FillGeometryWithBrush(HANDLE ctx, HANDLE geoHandle, _In_ HANDLE brushHandle opacityBrushContext == NULL ? NULL : opacityBrushContext->brush); } -bool PathFillContainsPoint(HANDLE pathCtx, D2D1_POINT_2F point) +bool PathFillContainsPoint(HANDLE geoCtx, D2D1_POINT_2F point) { - D2DPathContext* pathContext = reinterpret_cast(pathCtx); + D2DGeometryContext* geoContext = reinterpret_cast(geoCtx); BOOL contain = FALSE; - pathContext->path->FillContainsPoint(point, NULL, &contain); + geoContext->geometry->FillContainsPoint(point, NULL, &contain); return contain == TRUE; } -bool PathStrokeContainsPoint(HANDLE pathCtx, D2D1_POINT_2F point, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle) +bool PathStrokeContainsPoint(HANDLE geoCtx, D2D1_POINT_2F point, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle) { - D2DPathContext* pathContext = reinterpret_cast(pathCtx); - - ID2D1Factory* factory = pathContext->d2context->factory; + D2DGeometryContext* geoContext = reinterpret_cast(geoCtx); + + ID2D1Factory* factory = geoContext->d2context->factory; ID2D1StrokeStyle *strokeStyle = NULL; if (dashStyle != D2D1_DASH_STYLE_SOLID) @@ -427,7 +427,7 @@ bool PathStrokeContainsPoint(HANDLE pathCtx, D2D1_POINT_2F point, FLOAT strokeWi } BOOL contain = FALSE; - pathContext->path->StrokeContainsPoint(point, strokeWidth, strokeStyle, NULL, &contain); + geoContext->geometry->StrokeContainsPoint(point, strokeWidth, strokeStyle, NULL, &contain); SafeRelease(&strokeStyle); @@ -435,14 +435,14 @@ bool PathStrokeContainsPoint(HANDLE pathCtx, D2D1_POINT_2F point, FLOAT strokeWi } -void GetGeometryBounds(HANDLE pathCtx, __out D2D1_RECT_F* rect) +void GetGeometryBounds(HANDLE geoCtx, __out D2D1_RECT_F* rect) { - D2DPathContext* pathContext = reinterpret_cast(pathCtx); - pathContext->path->GetBounds(NULL, rect); + D2DGeometryContext* geoContext = reinterpret_cast(geoCtx); + geoContext->geometry->GetBounds(NULL, rect); } -void GetGeometryTransformedBounds(HANDLE pathCtx, __in D2D1_MATRIX_3X2_F* mat3x2, __out D2D1_RECT_F* rect) +void GetGeometryTransformedBounds(HANDLE geoCtx, __in D2D1_MATRIX_3X2_F* mat3x2, __out D2D1_RECT_F* rect) { - D2DPathContext* pathContext = reinterpret_cast(pathCtx); - pathContext->path->GetBounds(mat3x2, rect); + D2DGeometryContext* geoContext = reinterpret_cast(geoCtx); + geoContext->geometry->GetBounds(mat3x2, rect); } diff --git a/src/d2dlib/Geometry.h b/src/d2dlib/Geometry.h index 8341d984f..9d516635f 100644 --- a/src/d2dlib/Geometry.h +++ b/src/d2dlib/Geometry.h @@ -1,4 +1,4 @@ -/* +/* * MIT License * * Copyright (c) 2009-2021 Jingwood, unvell.com. All right reserved. @@ -54,22 +54,22 @@ extern "C" D2D1_COLOR_F strokeColor, FLOAT strokeWidth = 1, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE::D2D1_DASH_STYLE_SOLID); - D2DLIB_API void DrawPath(HANDLE pathCtx, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle); - D2DLIB_API void DrawPathWithPen(HANDLE pathCtx, HANDLE strokePen, FLOAT strokeWidth); - D2DLIB_API void FillPathD(HANDLE pathCtx, D2D1_COLOR_F fillColor); + D2DLIB_API void DrawPath(HANDLE geoCtx, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle); + D2DLIB_API void DrawPathWithPen(HANDLE geoCtx, HANDLE strokePen, FLOAT strokeWidth); + D2DLIB_API void FillPathD(HANDLE geoCtx, D2D1_COLOR_F fillColor); D2DLIB_API void FillGeometryWithBrush(HANDLE ctx, HANDLE geoHandle, __in HANDLE brushHandle, __in_opt HANDLE opacityBrushHandle = NULL); - D2DLIB_API bool PathFillContainsPoint(HANDLE pathCtx, D2D1_POINT_2F point); - D2DLIB_API bool PathStrokeContainsPoint(HANDLE pathCtx, D2D1_POINT_2F point, FLOAT strokeWidth = 1, + D2DLIB_API bool PathFillContainsPoint(HANDLE geoCtx, D2D1_POINT_2F point); + D2DLIB_API bool PathStrokeContainsPoint(HANDLE geoCtx, D2D1_POINT_2F point, FLOAT strokeWidth = 1, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE::D2D1_DASH_STYLE_SOLID); - D2DLIB_API void GetGeometryBounds(HANDLE pathCtx, __out D2D1_RECT_F* rect); - D2DLIB_API void GetGeometryTransformedBounds(HANDLE pathCtx, __in D2D1_MATRIX_3X2_F* mat3x2, __out D2D1_RECT_F* rect); + D2DLIB_API void GetGeometryBounds(HANDLE geoCtx, __out D2D1_RECT_F* rect); + D2DLIB_API void GetGeometryTransformedBounds(HANDLE geoCtx, __in D2D1_MATRIX_3X2_F* mat3x2, __out D2D1_RECT_F* rect); D2DLIB_API void DrawPolygon(HANDLE ctx, D2D1_POINT_2F* points, UINT count, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle, D2D1_COLOR_F fillColor); D2DLIB_API void DrawPolygonWithBrush(HANDLE ctx, D2D1_POINT_2F* points, UINT count, D2D1_COLOR_F strokeColor, FLOAT strokeWidth, D2D1_DASH_STYLE dashStyle, HANDLE brushHandle); -} \ No newline at end of file +}