GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
FontEditor.hh
Go to the documentation of this file.
1
2#ifndef FONTEDITOR_HH
3#define FONTEDITOR_HH
4
5#include "Effect.hh"
6#include "Graph.hh"
7
8class Font;
9void ExecuteFontEditor(int argc, char **argv, Font *font);
10
11
14
16
17class Zoom : public Bitmap<Color>
18{
19public:
20 Zoom(Bitmap<Color> &bm, int level) : bm(bm), level(level) { }
21 void Collect(CollectVisitor &vis) { bm.Collect(vis); }
22 void HeavyPrepare() { }
23 void Prepare() { bm.Prepare(); }
24
25 int SizeX() const { return level*bm.SizeX(); }
26 int SizeY() const { return level*bm.SizeY(); }
27 Color Map(int x, int y) const
28 {
29 int xx = x/level;
30 int yy = y/level;
31 if (xx==oldx && yy==oldy)
32 {
33 return oldColor;
34 }
35 oldColor = bm.Map(xx,yy);
36 oldx = xx; oldy=yy;
37 return oldColor;
38 }
39
40 static Point2d ZoomToSmall(Point2d p, int level) { p.x /= level; p.y/=level; return p; }
41 static Point2d SmallToZoom(Point2d p, int level) { p.x *= level; p.y*=level; return p; }
42
43
44private:
45 Bitmap<Color> &bm;
46 int level;
47
48 mutable int oldx, oldy;
49 mutable Color oldColor;
50};
51
53{
54public:
55 ZoomPoints(PointCollection2d &coll, int level) : coll(coll), level(level) { }
56 int Size() const { return coll.Size(); }
57 Point2d Index(int i) const { return Point2d::FromVector(Vector2d::FromPoint(coll.Index(i))*float(level)); }
58private:
60 int level;
61};
62
63#endif
int FindNearestPoint(Point2d p, PointCollection2d &points)
void DrawDot(BufferRef ref, Point2d p)
void DrawDots(BufferRef ref, PointCollection2d &p)
void ExecuteFontEditor(int argc, char **argv, Font *font)
Definition GraphI.hh:826
Definition GraphI.hh:622
Definition VectorTools.hh:380
Definition Font.hh:101
Definition Effect.hh:2663
ZoomPoints(PointCollection2d &coll, int level)
Definition FontEditor.hh:55
Point2d Index(int i) const
Definition FontEditor.hh:57
int Size() const
Definition FontEditor.hh:56
void Prepare()
Definition FontEditor.hh:23
void Collect(CollectVisitor &vis)
Definition FontEditor.hh:21
Zoom(Bitmap< Color > &bm, int level)
Definition FontEditor.hh:20
int SizeY() const
Definition FontEditor.hh:26
Color Map(int x, int y) const
Definition FontEditor.hh:27
int SizeX() const
Definition FontEditor.hh:25
static Point2d ZoomToSmall(Point2d p, int level)
Definition FontEditor.hh:40
static Point2d SmallToZoom(Point2d p, int level)
Definition FontEditor.hh:41
void HeavyPrepare()
Definition FontEditor.hh:22
Definition Buffer.hh:32
Definition VectorTools.hh:910
float x
Definition VectorTools.hh:911
float y
Definition VectorTools.hh:911
static Point2d FromVector(const Vector2d &v)
Definition VectorTools.hh:1035
static Vector2d FromPoint(const Point2d &p)
Definition VectorTools.hh:991