-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesfontbase.h
More file actions
94 lines (70 loc) · 1.37 KB
/
esfontbase.h
File metadata and controls
94 lines (70 loc) · 1.37 KB
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
#ifndef ESFONTTYPES_H
#define ESFONTTYPES_H
#include <vector>
#ifdef _MSC_VER
#define MIN __min
#define MAX __max
#else
#define MIN std::min
#define MAX std::max
#endif
// Define some fixed size types.
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
// A simple 32-bit pixel.
union Pixel32
{
Pixel32()
: integer(0) { }
Pixel32(uint8 bi, uint8 gi, uint8 ri, uint8 ai = 255)
{
b = bi;
g = gi;
r = ri;
a = ai;
}
uint32 integer;
struct
{
uint8 r, g, b, a;
};
};
struct Vec2
{
Vec2() { }
Vec2(float a, float b)
: x(a), y(b) { }
float x, y;
};
struct Rect
{
Rect() { }
Rect(float left, float top, float right, float bottom)
: xmin(left), xmax(right), ymin(top), ymax(bottom) { }
void Include(const Vec2 &r)
{
xmin = MIN(xmin, r.x);
ymin = MIN(ymin, r.y);
xmax = MAX(xmax, r.x);
ymax = MAX(ymax, r.y);
}
float Width() const { return xmax - xmin + 1; }
float Height() const { return ymax - ymin + 1; }
float xmin, xmax, ymin, ymax;
};
// A horizontal pixel span generated by the FreeType renderer.
struct Span
{
Span() { }
Span(int _x, int _y, int _width, int _coverage)
: x(_x), y(_y), width(_width), coverage(_coverage) { }
int x, y, width, coverage;
};
typedef std::vector<Span> Spans;
struct Attributes
{
glm::vec2 vertex;
glm::vec2 texel;
};
#endif