Files
core/ASCImageStudio3/ASCGraphics/Objects/Font/FontPath.h

128 lines
3.3 KiB
C++

#ifndef _PATH_H
#define _PATH_H
__interface IAVSGraphicsPath;
class ISimpleGraphicsPath;
//-------------------------------------------------------------------------------------------------------------------------------
// TPathPoint
//-------------------------------------------------------------------------------------------------------------------------------
struct TPathPoint
{
double dX;
double dY;
};
//-------------------------------------------------------------------------------------------------------------------------------
// CPath.nFlags
//-------------------------------------------------------------------------------------------------------------------------------
// Ôëàã äëÿ ïåðâîé òî÷êè ëþáîãî subpath
#define PathFirst 0x01
// Ôëàã äëÿ ïîñëåäíåé òî÷êè ëþáîãî subpath
#define PathLast 0x02
// Åñëè subpath çàìêíóòûé, òîãäà åãî ïîñëåäíÿÿ è ïåðâàÿ òî÷êà äîëæíû ñîâïàäàòü, èõ ôëàã â äàííîì ñëó÷àå ñëåäóþùèé
#define PathClosed 0x04
// Ôëàã, îçíà÷àþùèé, ÷òî äàííàÿ òî÷êà ÿâëÿåòñÿ êîíòðîëüíîé äëÿ êðèâîé Áåçüå
#define PathCurve 0x08
//-------------------------------------------------------------------------------------------------------------------------------
// TPathHint
//-------------------------------------------------------------------------------------------------------------------------------
struct TPathHint
{
int nFirstControl;
int nSecondControl;
int nFirstPoint;
int nLastPoint;
};
//-------------------------------------------------------------------------------------------------------------------------------
// CFontPath
//-------------------------------------------------------------------------------------------------------------------------------
class CFontPath
{
public:
CFontPath();
CFontPath *Ñopy()
{
return new CFontPath(this);
}
~CFontPath();
void Append(CFontPath *pPath);
int MoveTo(double dX, double dY);
int LineTo(double dX, double dY);
int CurveTo(double dX1, double dY1, double dX2, double dY2, double dX3, double dY3);
int Close();
void Offset(double dDx, double dDy);
void Reverse();
void ToMM(double dHorDpi, double dVerDpi);
int GetCount()
{
return m_nPointsCount;
}
void GetPoint(int nIndex, double *pdX, double *pdY, unsigned char *punFlag)
{
*pdX = m_pPoints[nIndex].dX;
*pdY = m_pPoints[nIndex].dY;
*punFlag = m_pFlags[nIndex];
}
BOOL GetCurPoint(double *pdX, double *pdY);
// Äîáàâëÿåì ôëàã StrokeAdjust.
void AddStrokeAdjustHint(int nFirstControl, int nSecondControl, int nFirstPoint, int nLastPoint);
CString ToXmlString();
BOOL ToInterface(ISimpleGraphicsPath *pPath);
private:
CFontPath(CFontPath *pPath);
void Resize(int nPointsCount);
BOOL NoCurrentPoint()
{
return m_nCurSubpath == m_nPointsCount;
}
BOOL OnePointSubpath()
{
return m_nCurSubpath == m_nPointsCount - 1;
}
BOOL OpenSubpath()
{
return m_nCurSubpath < m_nPointsCount - 1;
}
private:
TPathPoint *m_pPoints; // Ìàññèâ òî÷åê
unsigned char *m_pFlags; // Ìàññèâ ôëàãîâ, óêàçûàþùèõ çíà÷åíèå òî÷êè â SubPath
int m_nPointsCount; // Êîëè÷åñòâî òî÷åê
int m_nSize; // Íåïîñðåäñòâåííûé ðàçìåð ìàññèâà
int m_nCurSubpath; // Íîìåð ïåðâîé òî÷êè ïîñëåäíåãî SubPath
TPathHint *m_pHints; //
int m_nHintsCount;
int m_nHintsSize;
};
#endif /* _PATH_H */