graphlcd-base/glcdgraphics/image.h
author root@rika
Wed, 06 Feb 2008 17:32:55 +0000
changeset 4 df6a40031aa5
permissions -rw-r--r--
added graphlcd-base
     1 /*
     2  * GraphLCD graphics library
     3  *
     4  * image.h  -  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 #ifndef _GLCDGRAPHICS_IMAGE_H_
    16 #define _GLCDGRAPHICS_IMAGE_H_
    17 
    18 #include <stdint.h>
    19 
    20 #include <vector>
    21 
    22 namespace GLCD
    23 {
    24 
    25 class cBitmap;
    26 
    27 class cImage
    28 {
    29 private:
    30     unsigned int width;
    31     unsigned int height;
    32     unsigned int delay;
    33     unsigned int curBitmap;
    34     uint64_t lastChange;
    35     std::vector <cBitmap *> bitmaps;
    36 public:
    37     cImage();
    38     ~cImage();
    39 
    40     unsigned int Width() const { return width; }
    41     unsigned int Height() const { return height; }
    42     unsigned int Count() const { return bitmaps.size(); }
    43     unsigned int Delay() const { return delay; }
    44     uint64_t LastChange() const { return lastChange; }
    45     void First(uint64_t t) { lastChange = t; curBitmap = 0; }
    46     bool Next(uint64_t t) { lastChange = t; curBitmap++; return curBitmap < bitmaps.size(); }
    47     void SetWidth(unsigned int Width) { width = Width; }
    48     void SetHeight(unsigned int Height) { height = Height; }
    49     void SetDelay(unsigned int d) { delay = d; }
    50     cBitmap * GetBitmap(unsigned int nr) const;
    51     cBitmap * GetBitmap() const;
    52     void AddBitmap(cBitmap * Bitmap) { bitmaps.push_back(Bitmap); }
    53     void Clear();
    54 };
    55 
    56 } // end of namespace
    57 
    58 #endif