diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-11-09 17:40:13 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:46:45 +0300 |
commit | bcc94857d7b9f092148dea4a2a9b90c592f43a75 (patch) | |
tree | 7bf4c63e9b28fd0b00dfdcffcada9bb2c637b935 /graphics/text_path.hpp | |
parent | 771f47410fa67f271cf425a2b1a9a0ed6119b4ea (diff) |
renamed yg into graphics.
Diffstat (limited to 'graphics/text_path.hpp')
-rw-r--r-- | graphics/text_path.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/graphics/text_path.hpp b/graphics/text_path.hpp new file mode 100644 index 0000000000..e35c4f4fc9 --- /dev/null +++ b/graphics/text_path.hpp @@ -0,0 +1,56 @@ +#pragma once + +#include "../geometry/point2d.hpp" +#include "../geometry/angles.hpp" +#include "../base/matrix.hpp" +#include "glyph_cache.hpp" + +namespace graphics +{ + struct PathPoint + { + int m_i; //< segment number + ang::AngleD m_segAngle; + m2::PointD m_pt; //< point on segment + PathPoint(int i = -1, + ang::AngleD const & segAngle = ang::AngleD(), + m2::PointD const & pt = m2::PointD()); + }; + + struct PivotPoint + { + ang::AngleD m_angle; + PathPoint m_pp; + PivotPoint(ang::AngleD const & angle = ang::AngleD(), PathPoint const & pp = PathPoint()); + }; + + class TextPath + { + private: + + buffer_vector<m2::PointD, 8> m_arr; + bool m_reverse; + double m_fullLength; + double m_pathOffset; + + void checkReverse(); + + public: + + TextPath(); + TextPath(TextPath const & src, math::Matrix<double, 3, 3> const & m); + TextPath(m2::PointD const * arr, size_t sz, double fullLength, double pathOffset); + + size_t size() const; + + m2::PointD get(size_t i) const; + m2::PointD operator[](size_t i) const; + + double fullLength() const; + double pathOffset() const; + + PathPoint const offsetPoint(PathPoint const & pp, double offset); + + PivotPoint findPivotPoint(PathPoint const & pp, GlyphMetrics const & sym, double kern); + }; +} |