-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraybitmap.h
67 lines (52 loc) · 1.86 KB
/
graybitmap.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
Irrtum
Copyright (C) 2011-2015 kahrl <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef GRAYBITMAP_HEADER
#define GRAYBITMAP_HEADER
#include "common.h"
#include "rect.h"
class GrayBitmap
{
public:
GrayBitmap(s32 width, s32 height);
GrayBitmap(FT_Bitmap* bitmap);
explicit GrayBitmap(const GrayBitmap& other);
GrayBitmap& operator=(const GrayBitmap& other);
~GrayBitmap();
s32 getWidth() const;
s32 getHeight() const;
u8* getScanline(s32 y);
const u8* getScanline(s32 y) const;
u8 getPixel(s32 x, s32 y) const;
void setPixel(s32 x, s32 y, u8 value);
void clear(u8 value);
// Set the clipping rectangle used when this bitmap is specified
// as a blitTo() destination.
void setClipRect(Rect rect);
// Clear the clipping rectangle set by setClipRect().
void clearClipRect();
// Retrieve the clipping rectangle set by setClipRect().
Rect getClipRect() const;
// Copy the contents of this bitmap to a part of another one.
// Rsspects the clipping rectangle of the destination bitmap.
void blitTo(GrayBitmap& dest, s32 destX, s32 destY) const;
void debug() const;
private:
s32 m_width;
s32 m_height;
u8* m_data;
Rect m_clip;
};
#endif