summaryrefslogtreecommitdiff
path: root/glcdgraphics/image.h
blob: 888d942fca67526caf03567697c5ed7abebfa1fd (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
/*
 * GraphLCD graphics library
 *
 * image.h  -  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>
 */

#ifndef _GLCDGRAPHICS_IMAGE_H_
#define _GLCDGRAPHICS_IMAGE_H_

#include <stdint.h>

#include <vector>

namespace GLCD
{

class cBitmap;

class cImage
{
private:
    unsigned int width;
    unsigned int height;
    unsigned int delay;
    unsigned int curBitmap;
    uint64_t lastChange;
    std::vector <cBitmap *> bitmaps;
public:
    cImage();
    ~cImage();

    unsigned int Width() const { return width; }
    unsigned int Height() const { return height; }
    unsigned int Count() const { return bitmaps.size(); }
    unsigned int Delay() const { return delay; }
    uint64_t LastChange() const { return lastChange; }
    void First(uint64_t t) { lastChange = t; curBitmap = 0; }
    bool Next(uint64_t t) { lastChange = t; curBitmap++; return curBitmap < bitmaps.size(); }
    void SetWidth(unsigned int Width) { width = Width; }
    void SetHeight(unsigned int Height) { height = Height; }
    void SetDelay(unsigned int d) { delay = d; }
    cBitmap * GetBitmap(unsigned int nr) const;
    cBitmap * GetBitmap() const;
    void AddBitmap(cBitmap * Bitmap) { bitmaps.push_back(Bitmap); }
    void Clear();
};

} // end of namespace

#endif