GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
FreeType.hh
Go to the documentation of this file.
1
2
3
4#include "Graph.hh"
5#include <string>
6#include <vector>
7// gives out 0..255
8struct GlyphPriv;
9
10#if 0
11class FontLineCollectionWrapper : public PlanePoints2d
12{
13public:
14 FontLineCollectionWrapper(LineCollection *coll, std::vector<int> &types, float sx, float sy, float dx, float dy) : coll(coll), m_sx(sx), m_sy(sy), m_dx(dx), m_dy(dy), types(types) { }
15 virtual float SizeX() const { return m_sx; }
16 virtual float SizeY() const { return m_sy; }
17 virtual int Size() const { return coll->NumLines()+1; }
18 virtual Point2d Map(int i) const {
19 Point p = coll->LinePoint(i,0);
20 if (i==Size()-1) p=coll->LinePoint(Size()-2,1);
21 Point2d pp = { p.x, p.y };
22 //std::cout << "Point:" << i << ":" << pp.x << " " << pp.y << std::endl;
23 pp.x+=m_dx;
24 pp.y+=m_dy;
25 return pp;
26 }
27 virtual PlanePointsType Type(int i) const
28 {
29 //std::cout << "Type: " << i << ":" << types[i] << std::endl;
30 if (types[i]==0) return PlanePoints2d::EMove;
31 if (types[i]==1) return PlanePoints2d::ELineTo;
32 if (types[i]==2) return PlanePoints2d::EConic;
33 if (types[i]==3) return PlanePoints2d::ECubic;
35 //if (i==0) return EMove;
36 //return ELineTo;
37 }
38
39private:
40 LineCollection *coll;
41 float m_sx, m_sy;
42 float m_dx, m_dy;
43 std::vector<int> types;
44};
45#endif
46namespace GameApi {
47 class Env;
48}
49
50class FontGlyphBitmap : public Bitmap<int>, public LineCollection
51{
52public:
53 FontGlyphBitmap(GameApi::Env &e, void *priv_, std::string filename, int sx, int sy);
54 void Collect(CollectVisitor &vis) { }
55 void HeavyPrepare() { }
56 void Prepare() { }
57 void load_glyph(long idx);
58 void load_glyph_outline(long idx, float sx, float sy);
59 int bitmap_top(long idx) const;
60 void check_load();
61 virtual int SizeX() const;
62 virtual int SizeY() const;
63 virtual int Map(int x, int y) const;
64
65 virtual int NumLines() const;
66 virtual Point LinePoint(int line, int point) const;
67
68 std::vector<int> &Types() const {return const_cast<std::vector<int>&>(types); }
69
70 //virtual float SizeX() const { return m_sx; }
71 //virtual float SizeY() const { return m_sy; }
72
74private:
75 GlyphPriv *priv;
76public:
77 float m_sx, m_sy;
79 std::string filename;
80 long m_idx;
81 void *priv_;
82 int sx,sy;
84 std::vector<int> types;
85 std::vector<Point2d> points; // twice the amount of points
86 std::vector<Point2d> control1;
87 std::vector<Point2d> control2;
88 int state;
89 long old_idx;
90};
Type
Definition Database.hh:9
size dy
Definition GameApi_gui.cc:1727
Definition GraphI.hh:826
Definition GraphI.hh:622
std::vector< int > types
Definition FreeType.hh:84
std::vector< Point2d > points
Definition FreeType.hh:85
float m_sy
Definition FreeType.hh:77
int sx
Definition FreeType.hh:82
void load_glyph(long idx)
Definition FreeType.cc:30
virtual int NumLines() const
Definition FreeType.cc:132
void Prepare()
Definition FreeType.hh:56
virtual int SizeX() const
Definition FreeType.cc:228
int state
Definition FreeType.hh:88
float m_sx
Definition FreeType.hh:77
void * priv_
Definition FreeType.hh:81
int sy
Definition FreeType.hh:82
int bitmap_top(long idx) const
Definition FreeType.cc:217
void check_load()
Definition FreeType.cc:143
virtual int SizeY() const
Definition FreeType.cc:240
std::vector< int > & Types() const
Definition FreeType.hh:68
void Collect(CollectVisitor &vis)
Definition FreeType.hh:54
FontGlyphBitmap(GameApi::Env &e, void *priv_, std::string filename, int sx, int sy)
Definition FreeType.cc:18
~FontGlyphBitmap()
Definition FreeType.cc:26
void load_glyph_outline(long idx, float sx, float sy)
Definition FreeType.cc:193
long m_idx
Definition FreeType.hh:80
std::string filename
Definition FreeType.hh:79
GameApi::Env & e
Definition FreeType.hh:78
std::vector< Point2d > control2
Definition FreeType.hh:87
virtual int Map(int x, int y) const
Definition FreeType.cc:252
long old_idx
Definition FreeType.hh:89
virtual Point LinePoint(int line, int point) const
Definition FreeType.cc:137
std::vector< Point2d > control1
Definition FreeType.hh:86
Point2d move_point
Definition FreeType.hh:83
void HeavyPrepare()
Definition FreeType.hh:55
Definition GameApi.hh:362
Definition EffectI.hh:305
Definition Graph.hh:8313
virtual Point2d Map(int i) const =0
virtual float SizeX() const =0
virtual float SizeY() const =0
virtual int Size() const =0
@ EConic
Definition Graph.hh:8321
@ EMove
Definition Graph.hh:8321
@ ELineTo
Definition Graph.hh:8321
@ ECubic
Definition Graph.hh:8321
Definition FreeType.hh:46
Definition FreeType.cc:11
Definition VectorTools.hh:910
float x
Definition VectorTools.hh:911
float y
Definition VectorTools.hh:911
Definition Parser.cc:60
float x
Definition Parser.cc:60
float y
Definition Parser.cc:60