author | root@rika |
Wed, 06 Feb 2008 17:32:55 +0000 | |
changeset 4 | df6a40031aa5 |
permissions | -rw-r--r-- |
root@4 | 1 |
/* |
root@4 | 2 |
* GraphLCD graphics library |
root@4 | 3 |
* |
root@4 | 4 |
* image.c - image and animation handling |
root@4 | 5 |
* |
root@4 | 6 |
* based on graphlcd plugin 0.1.1 for the Video Disc Recorder |
root@4 | 7 |
* (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> |
root@4 | 8 |
* |
root@4 | 9 |
* This file is released under the GNU General Public License. Refer |
root@4 | 10 |
* to the COPYING file distributed with this package. |
root@4 | 11 |
* |
root@4 | 12 |
* (c) 2004 Andreas Regel <andreas.regel AT powarman.de> |
root@4 | 13 |
*/ |
root@4 | 14 |
|
root@4 | 15 |
#include "bitmap.h" |
root@4 | 16 |
#include "image.h" |
root@4 | 17 |
|
root@4 | 18 |
|
root@4 | 19 |
namespace GLCD |
root@4 | 20 |
{ |
root@4 | 21 |
|
root@4 | 22 |
using namespace std; |
root@4 | 23 |
|
root@4 | 24 |
cImage::cImage() |
root@4 | 25 |
: width(0), |
root@4 | 26 |
height(0), |
root@4 | 27 |
delay(0), |
root@4 | 28 |
curBitmap(0), |
root@4 | 29 |
lastChange(0) |
root@4 | 30 |
{ |
root@4 | 31 |
} |
root@4 | 32 |
|
root@4 | 33 |
cImage::~cImage() |
root@4 | 34 |
{ |
root@4 | 35 |
Clear(); |
root@4 | 36 |
} |
root@4 | 37 |
|
root@4 | 38 |
cBitmap * cImage::GetBitmap() const |
root@4 | 39 |
{ |
root@4 | 40 |
if (curBitmap < bitmaps.size()) |
root@4 | 41 |
return bitmaps[curBitmap]; |
root@4 | 42 |
return NULL; |
root@4 | 43 |
} |
root@4 | 44 |
|
root@4 | 45 |
cBitmap * cImage::GetBitmap(unsigned int nr) const |
root@4 | 46 |
{ |
root@4 | 47 |
if (nr < bitmaps.size()) |
root@4 | 48 |
return bitmaps[nr]; |
root@4 | 49 |
return NULL; |
root@4 | 50 |
} |
root@4 | 51 |
|
root@4 | 52 |
void cImage::Clear() |
root@4 | 53 |
{ |
root@4 | 54 |
vector <cBitmap *>::iterator it; |
root@4 | 55 |
for (it = bitmaps.begin(); it != bitmaps.end(); it++) |
root@4 | 56 |
{ |
root@4 | 57 |
delete *it; |
root@4 | 58 |
} |
root@4 | 59 |
bitmaps.clear(); |
root@4 | 60 |
width = 0; |
root@4 | 61 |
height = 0; |
root@4 | 62 |
delay = 0; |
root@4 | 63 |
curBitmap = 0; |
root@4 | 64 |
lastChange = 0; |
root@4 | 65 |
} |
root@4 | 66 |
|
root@4 | 67 |
} // end of namespace |