| #pragma once |
| |
| |
| |
| |
| #ifndef T_STROKE_OUTLINE_H |
| #define T_STROKE_OUTLINE_H |
| |
| #include "tgeometry.h" |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TVECTORIMAGE_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| #ifdef _MSC_VER |
| #pragma warning(disable : 4251) |
| #endif |
| |
| |
| class TStroke; |
| class TRegion; |
| class TRegionOutline; |
| |
| |
| |
| |
| |
| struct TOutlinePoint { |
| |
| |
| |
| double x, y; |
| |
| double u, v; |
| |
| |
| |
| |
| |
| int stepCount; |
| |
| |
| TOutlinePoint(double x_, double y_, |
| |
| |
| int stepCount_, |
| double u_, |
| double v_) |
| : x(x_), |
| y(y_), |
| u(u_), |
| v(v_), |
| |
| |
| stepCount(stepCount_) {} |
| |
| TOutlinePoint(const TPointD &p, |
| |
| |
| int stepCount_, |
| const TPointD &t) |
| : x(p.x), |
| y(p.y), |
| u(t.x), |
| v(t.y), |
| |
| |
| stepCount(stepCount_) {} |
| |
| TOutlinePoint(const TPointD &p, int stepCount_) |
| : x(p.x) |
| , y(p.y) |
| , u(0) |
| , v(0) |
| , |
| |
| |
| stepCount(stepCount_) {} |
| |
| TOutlinePoint(const TPointD &p) : x(p.x), y(p.y), u(0), v(0), stepCount(0) {} |
| }; |
| |
| |
| |
| inline TPointD convert(const TOutlinePoint &p) { return TPointD(p.x, p.y); } |
| |
| |
| |
| |
| |
| |
| class DVAPI TStrokeOutline { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| private: |
| std::vector<TOutlinePoint> m_outline; |
| |
| public: |
| TStrokeOutline() {} |
| ~TStrokeOutline() {} |
| |
| std::vector<TOutlinePoint> &getArray() { return m_outline; } |
| |
| TStrokeOutline(const TStrokeOutline &); |
| TStrokeOutline &operator=(const TStrokeOutline &); |
| |
| void addOutlinePoint(const TOutlinePoint &); |
| }; |
| |
| |
| |
| DVAPI TStrokeOutline getOutline(const TStroke &stroke); |
| |
| |
| |
| class TQuadratic; |
| |
| DVAPI std::vector<TQuadratic> getOutlineWithQuadratic(const TStroke &stroke); |
| |
| DVAPI void computeOutlines(const TStroke *stroke, int startQuad, int endQuad, |
| std::vector<TQuadratic *> &quadArray, double error2); |
| |
| |
| |
| namespace TOutlineUtil { |
| |
| class DVAPI OutlineParameter { |
| public: |
| double m_lengthStep; |
| |
| OutlineParameter(double lengthStep = 0) : m_lengthStep(lengthStep) {} |
| }; |
| |
| |
| DVAPI void makeOutline(const TStroke &stroke, TStrokeOutline &outline, |
| const OutlineParameter ¶m); |
| DVAPI void makeOutline(const TStroke &path, const TStroke &brush, |
| const TRectD &brushBox, TStrokeOutline &outline, |
| const OutlineParameter ¶m); |
| |
| DVAPI void makeOutline(const TStroke &path, const TRegion &brush, |
| const TRectD &brushBox, TRegionOutline &outline); |
| |
| DVAPI TRectD computeBBox(const TStroke &stroke); |
| } |
| |
| |
| |
| #endif |
| |
| |
| |
| |