blob: 72003b1e85b2f33b34b661e139865df0482075e2 (
plain)
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
|
/*
* GraphLCD graphics library
*
* image.c - image and animation handling
*
* based on graphlcd plugin 0.1.1 for the Video Disc Recorder
* (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de>
*
* This file is released under the GNU General Public License. Refer
* to the COPYING file distributed with this package.
*
* (c) 2004 Andreas Regel <andreas.regel AT powarman.de>
*/
#include "bitmap.h"
#include "image.h"
namespace GLCD
{
using namespace std;
cImage::cImage()
: width(0),
height(0),
delay(0),
curBitmap(0),
lastChange(0)
{
}
cImage::~cImage()
{
Clear();
}
cBitmap * cImage::GetBitmap() const
{
if (curBitmap < bitmaps.size())
return bitmaps[curBitmap];
return NULL;
}
cBitmap * cImage::GetBitmap(unsigned int nr) const
{
if (nr < bitmaps.size())
return bitmaps[nr];
return NULL;
}
void cImage::Clear()
{
vector <cBitmap *>::iterator it;
for (it = bitmaps.begin(); it != bitmaps.end(); it++)
{
delete *it;
}
bitmaps.clear();
width = 0;
height = 0;
delay = 0;
curBitmap = 0;
lastChange = 0;
}
} // end of namespace
|