diff options
author | andreas 'randy' weinberger <vdr@smue.org> | 2010-02-21 19:58:27 +0100 |
---|---|---|
committer | andreas 'randy' weinberger <vdr@smue.org> | 2010-02-21 19:58:27 +0100 |
commit | 10ab31fa86dbf9875b5f6baa6ac59fefaaf86be3 (patch) | |
tree | 60ad7c856565f03e145b2996d1bb5f9cd64c0532 /glcdgraphics/image.c | |
download | graphlcd-base-10ab31fa86dbf9875b5f6baa6ac59fefaaf86be3.tar.gz graphlcd-base-10ab31fa86dbf9875b5f6baa6ac59fefaaf86be3.tar.bz2 |
initial git upload, based on graphlcd-base-0.1.5
Diffstat (limited to 'glcdgraphics/image.c')
-rw-r--r-- | glcdgraphics/image.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/glcdgraphics/image.c b/glcdgraphics/image.c new file mode 100644 index 0000000..72003b1 --- /dev/null +++ b/glcdgraphics/image.c @@ -0,0 +1,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 |