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