1 /*
2  * gltt graphics library
3  * Copyright (C) 1998-1999 Stephane Rehel
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19 
20 #ifndef __GLTTGlyphTriangulator_h
21 #define __GLTTGlyphTriangulator_h
22 
23 #ifndef __GLTTboolean_h
24 #include "GLTTboolean.h"
25 #endif
26 
27 #ifndef __GLTTGlyphPolygonizerHandler_h
28 #include "GLTTGlyphPolygonizerHandler.h"
29 #endif
30 
31 // class FTGlyphVectorizer;
32 // struct FTGlyphVectorizer::POINT;
33 class GLTTGlyphPolygonizer;
34 
35 /////////////////////////////////////////////////////////////////////////////
36 
37 class GLTTGlyphTriangulator: public GLTTGlyphPolygonizerHandler
38 {
39 protected:
40   int type;
41   GLTTGlyphPolygonizer* polygonizer;
42 
43 public:
44   GLTTGlyphTriangulator( FTGlyphVectorizer* _vectorizer = 0,
45                          GLTTboolean _verbose = GLTT_FALSE );
46 
47   virtual ~GLTTGlyphTriangulator();
48 
49   void setPrecision( double _precision );
50 
51   GLTTboolean init( FTGlyph* _glyph );
52 
53   GLTTboolean triangulate();
54 
55   virtual void triangle( FTGlyphVectorizer::POINT* p1,
56                          FTGlyphVectorizer::POINT* p2,
57                          FTGlyphVectorizer::POINT* p3 ) = 0;
58 
59 private:
60   virtual void begin( int _type );
61   virtual void vertex( FTGlyphVectorizer::POINT* point );
62   virtual void end();
63 
64   int vertex_index;
65   FTGlyphVectorizer::POINT* vertices[2];
66 };
67 
68 /////////////////////////////////////////////////////////////////////////////
69 
70 #endif // ifndef __GLTTGlyphTriangulator_h
71