/** * @file XTPMarkupPathGeometryBuilder.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPMARKUPGEOMETRYBUILDER_H__) # define __XTPMARKUPGEOMETRYBUILDER_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * Defines a markup path point type. */ enum XTPMarkupPathPointType { xtpMarkupPathPointTypeStart = 0, /**< move */ xtpMarkupPathPointTypeLine = 1, /**< line */ xtpMarkupPathPointTypeBezier = 3, /**< default Bezier (= cubic Bezier) */ xtpMarkupPathPointTypeCloseSubpath = 0x80, /**< closed flag */ }; struct MARKUP_POINTF { float x; float y; }; class CXTPMarkupPathData; class CXTPMarkupBuilder; class _XTP_EXT_CLASS CXTPMarkupPathGeometryBuilder { public: CXTPMarkupPathGeometryBuilder(); public: void Parse(CXTPMarkupBuilder* pBuilder, LPCWSTR lpszValue, int nLength); CXTPMarkupPathData* CreateData() const; public: void BeginFigure(float x, float y); void BezierTo(float x1, float y1, float x2, float y2, float x3, float y3); /**< draw bicubic bezier curve */ void BezierTo(float x1, float y1, float x2, float y2); /**< draw quadratic bezier curve */ void LineTo(float x, float y); void ArcSegment(double xc, double yc, double th0, double th1, double rx, double ry, double xAxisRotation); void ArcTo(float x, float y, float rotationAngle, double xRadius, double yRadius, BOOL isLargeArcFlag, BOOL sweepDirectionFlag); void CloseFigure(); private: BOOL ReadToken(); BOOL SkipWhiteSpace(BOOL allowComma); BOOL More() const; void ThrowBadToken(); MARKUP_POINTF ReadSize(BOOL allowcomma); MARKUP_POINTF ReadPoint(WCHAR cmd, BOOL allowcomma); float ReadNumber(BOOL allowComma); BOOL IsNumber(BOOL allowComma); void EnsureFigure(); MARKUP_POINTF Reflect(); private: LPCWSTR m_lpszValue; int m_nLength; int m_nIndex; BOOL m_bFigureStarted; int m_nFillRule; CArray m_arrPoints; CArray m_arrTypes; WCHAR m_cToken; CXTPMarkupBuilder* m_pBuilder; MARKUP_POINTF m_secondLastPoint; MARKUP_POINTF m_lastPoint; MARKUP_POINTF m_lastStart; }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPMARKUPGEOMETRYBUILDER_H__) /** @endcond */