00001 #ifndef _VECTORIZER_H_
00002 #define _VECTORIZER_H_
00003
00004 #include <ft2build.h>
00005 #include FT_FREETYPE_H
00006
00007 #include <utility>
00008 #include <list>
00009
00010 namespace glttf {
00011
00013
00017 class Vectorizer
00018 {
00019 public:
00021 typedef std::pair<float, float> Vertex;
00023 typedef std::list<Vertex> Contour;
00025 typedef std::list<Contour> ContourList;
00026
00028
00039 Vectorizer(const FT_Outline &outline, int subdiv);
00040
00042
00045 const ContourList &getContours() const;
00046
00048
00051 int getNumVertices() const;
00052 private:
00053 ContourList contours;
00054 int numVertices;
00055
00056 void addContour(const FT_Outline &outline, Contour &contour, int begin, int end, int subdiv);
00057 void quadratic(Contour &contour, float prevX, float prevY, float ctrlX, float ctrlY, float nextX, float nextY, int subdiv);
00058 void cubic(Contour &contour, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int subdiv);
00059 };
00060
00061 }
00062
00063 #endif