Hash :
295f2c0f
Author :
Date :
2001-08-24T02:06:51
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
#ifndef __FTVectoriser__
#define __FTVectoriser__
#include <vector>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include "FTGlyph.h"
using namespace std;
class ftPoint
{
public:
ftPoint()
: x(0), y(0), z(0){}
ftPoint( const float X, const float Y, const float Z)
: x(X), y(Y), z(Z){}
friend bool operator == (const ftPoint &a, const ftPoint &b)
{
return((a.x == b.x) && (a.y == b.y) && (a.z == b.z));
}
friend bool operator != (const ftPoint &a, const ftPoint &b)
{
return((a.x != b.x) || (a.y != b.y) || (a.z != b.z));
}
float x, y, z; // FIXME make private
private:
};
class FTContour
{
public:
// methods
FTContour();
~FTContour();
void AddPoint( const int x, const int y);
int size() const { return pointList.size();}
// attributes
vector< ftPoint> pointList;
float ctrlPtArray[4][2];
private:
// methods
// attributes
const unsigned int kMAXPOINTS;
};
class FTVectoriser
{
public:
// methods
FTVectoriser( FT_Glyph glyph);
virtual ~FTVectoriser();
bool Ingest();
void Output( double* d);
int points();
int contours() const { return contourList.size();}
int contourSize( int c) const { return contourList[c]->size();}
// attributes
int contourFlag;
private:
// methods
int Conic( const int index, const int first, const int last);
int Cubic( const int index, const int first, const int last);
void deCasteljau( const float t, const int n);
void evaluateCurve( const int n);
// attributes
vector< const FTContour*> contourList;
FTContour* contour;
FT_Outline ftOutline;
// Magic numbers -- #define MAX_DEG 4
float bValues[4][4][2]; //3D array storing values of de Casteljau algorithm.
float ctrlPtArray[4][2]; // Magic numbers
const float kBSTEPSIZE;
};
#endif // __FTVectoriser__