00001 #ifndef __FTVectoriser__
00002 #define __FTVectoriser__
00003
00004
00005 #include "FTContour.h"
00006 #include "FTList.h"
00007 #include "FTPoint.h"
00008 #include "FTVector.h"
00009 #include "FTGL.h"
00010
00011
00012 #ifndef CALLBACK
00013 #define CALLBACK
00014 #endif
00015
00016
00020 class FTGL_EXPORT FTTesselation
00021 {
00022 public:
00026 FTTesselation( GLenum m)
00027 : meshType(m)
00028 {
00029 pointList.reserve( 128);
00030 }
00031
00035 ~FTTesselation()
00036 {
00037 pointList.clear();
00038 }
00039
00043 void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
00044 {
00045 pointList.push_back( FTPoint( x, y, z));
00046 }
00047
00051 size_t PointCount() const { return pointList.size();}
00052
00056 const FTPoint& Point( unsigned int index) const { return pointList[index];}
00057
00061 GLenum PolygonType() const { return meshType;}
00062
00063 private:
00067 typedef FTVector<FTPoint> PointVector;
00068 PointVector pointList;
00069
00073 GLenum meshType;
00074 };
00075
00076
00080 class FTGL_EXPORT FTMesh
00081 {
00082 typedef FTVector<FTTesselation*> TesselationVector;
00083 typedef FTList<FTPoint> PointList;
00084
00085 public:
00089 FTMesh();
00090
00094 ~FTMesh();
00095
00099 void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
00100
00104 FTGL_DOUBLE* Combine( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
00105
00109 void Begin( GLenum meshType);
00110
00114 void End();
00115
00119 void Error( GLenum e) { err = e;}
00120
00124 unsigned int TesselationCount() const { return tesselationList.size();}
00125
00129 const FTTesselation* const Tesselation( unsigned int index) const;
00130
00134 const PointList& TempPointList() const { return tempPointList;}
00135
00139 GLenum Error() const { return err;}
00140
00141 private:
00145 FTTesselation* currentTesselation;
00146
00150 TesselationVector tesselationList;
00151
00155 PointList tempPointList;
00156
00160 GLenum err;
00161
00162 };
00163
00164
00165
00177 class FTGL_EXPORT FTVectoriser
00178 {
00179 public:
00185 FTVectoriser( const FT_Glyph glyph);
00186
00190 virtual ~FTVectoriser();
00191
00198 void MakeMesh( FTGL_DOUBLE zNormal = 1.0);
00199
00203 const FTMesh* const GetMesh() const { return mesh;}
00204
00210 size_t PointCount();
00211
00217 size_t ContourCount() const { return ftContourCount;}
00218
00224 const FTContour* const Contour( unsigned int index) const;
00225
00232 size_t ContourSize( int c) const { return contourList[c]->PointCount();}
00233
00239 int ContourFlag() const { return contourFlag;}
00240
00241 private:
00245 void ProcessContours();
00246
00250 FTContour** contourList;
00251
00255 FTMesh* mesh;
00256
00260 short ftContourCount;
00261
00265 int contourFlag;
00266
00270 FT_Outline ftOutline;
00271 };
00272
00273
00274 #endif // __FTVectoriser__