forked from Chlumsky/msdfgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bitmap.h
48 lines (38 loc) · 904 Bytes
/
Bitmap.h
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
#pragma once
namespace msdfgen {
/// A floating-point RGB pixel.
struct FloatRGB {
float r, g, b;
};
/// A floating point RGBA pixel.
struct FloatRGBA {
float r, g, b, a;
};
/// A 2D image bitmap.
template <typename T>
class Bitmap {
public:
Bitmap();
Bitmap(int width, int height);
Bitmap(const Bitmap<T> &orig);
#ifdef MSDFGEN_USE_CPP11
Bitmap(Bitmap<T> &&orig);
#endif
~Bitmap();
Bitmap<T> & operator=(const Bitmap<T> &orig);
#ifdef MSDFGEN_USE_CPP11
Bitmap<T> & operator=(Bitmap<T> &&orig);
#endif
/// Bitmap width in pixels.
int width() const;
/// Bitmap height in pixels.
int height() const;
T & operator()(int x, int y);
const T & operator()(int x, int y) const;
// Clone into a bitmap starting at x, y as the upper left of the blit
void CopyInto(int x, int y, Bitmap<T>& source);
private:
T *content;
int w, h;
};
}