diff --git a/DesktopEditor/graphics/GraphicsPath.cpp b/DesktopEditor/graphics/GraphicsPath.cpp index 14ac2b159b..4f15063441 100644 --- a/DesktopEditor/graphics/GraphicsPath.cpp +++ b/DesktopEditor/graphics/GraphicsPath.cpp @@ -1515,31 +1515,3 @@ namespace Aggplus return false; } } - -HRESULT IRenderer::AddPath(const Aggplus::CGraphicsPath& path) -{ - if (path.GetPointCount() == 0) - return S_FALSE; - - unsigned length = path.GetPointCount() + path.GetCloseCount(); - auto points = path.GetPoints(0, length); - - for (unsigned i = 0; i < length; i++) - { - if (path.IsCurvePoint(i)) - { - PathCommandCurveTo(points[i].X, points[i].Y, - points[i + 1].X, points[i + 1].Y, - points[i + 2].X, points[i + 2].Y); - i += 2; - } - else if (path.IsMovePoint(i)) - PathCommandMoveTo(points[i].X, points[i].Y); - else if (path.IsLinePoint(i)) - PathCommandLineTo(points[i].X, points[i].Y); - else - PathCommandClose(); - } - - return S_OK; -} diff --git a/DesktopEditor/graphics/GraphicsRenderer.cpp b/DesktopEditor/graphics/GraphicsRenderer.cpp index 934709d9bb..25439758e9 100644 --- a/DesktopEditor/graphics/GraphicsRenderer.cpp +++ b/DesktopEditor/graphics/GraphicsRenderer.cpp @@ -1170,6 +1170,34 @@ HRESULT CGraphicsRenderer::PathCommandTextEx(const std::wstring& bsUnicodeText, return PathCommandText(bsUnicodeText, x, y, w, h); } +HRESULT CGraphicsRenderer::AddPath(const Aggplus::CGraphicsPath& path) +{ + if (path.GetPointCount() == 0) + return S_FALSE; + + size_t length = path.GetPointCount() + path.GetCloseCount(); + std::vector points = path.GetPoints(0, length); + + for (size_t i = 0; i < length; i++) + { + if (path.IsCurvePoint(i)) + { + PathCommandCurveTo(points[i].X, points[i].Y, + points[i + 1].X, points[i + 1].Y, + points[i + 2].X, points[i + 2].Y); + i += 2; + } + else if (path.IsMovePoint(i)) + PathCommandMoveTo(points[i].X, points[i].Y); + else if (path.IsLinePoint(i)) + PathCommandLineTo(points[i].X, points[i].Y); + else + PathCommandClose(); + } + + return S_OK; +} + //-------- Функции для вывода изображений --------------------------------------------------- HRESULT CGraphicsRenderer::DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) { diff --git a/DesktopEditor/graphics/GraphicsRenderer.h b/DesktopEditor/graphics/GraphicsRenderer.h index 4366d5298d..2b3185bd5f 100644 --- a/DesktopEditor/graphics/GraphicsRenderer.h +++ b/DesktopEditor/graphics/GraphicsRenderer.h @@ -243,6 +243,8 @@ public: virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h); virtual HRESULT PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h); + virtual HRESULT AddPath(const Aggplus::CGraphicsPath& path); + //-------- Функции для вывода изображений --------------------------------------------------- virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h); virtual HRESULT DrawImageFromFile(const std::wstring& sFile, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha = 255); diff --git a/DesktopEditor/graphics/IRenderer.h b/DesktopEditor/graphics/IRenderer.h index 6bc4bf4a93..1026c584cf 100644 --- a/DesktopEditor/graphics/IRenderer.h +++ b/DesktopEditor/graphics/IRenderer.h @@ -327,7 +327,11 @@ public: virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) = 0; virtual HRESULT PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) = 0; - HRESULT AddPath(const Aggplus::CGraphicsPath& path); + virtual HRESULT AddPath(const Aggplus::CGraphicsPath& path) + { + UNUSED_VARIABLE(path); + return S_OK; + } //-------- Функции для вывода изображений --------------------------------------------------- virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) = 0;