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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/**
* @module cbitmap
* @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
* @brief Abstract implementation of CFile handling Bitmaps.
* @date 17.04.2009
*/
#ifndef CBITMAP_H
#define CBITMAP_H
#include <stdint.h>
#include "cfile.h"
class CPixelFormat;
#include "cpixelformat.h"
/**
* @class CBitmap
* @brief Implementation of CFile handling Bitmaps.
*
* In order to support operations on bitmaps with different color bitcounts
* different implementations of CPixelFormat are used. These classes are
* allowed to modify the bitmap headers and pixelbuffer directly.
*
* On error CFile::FileError is thrown.
*/
class CBitmap : public CFile
{
public:
/**
* @method CBitmap
* @brief Default ctor
* @param -
* @return -
* @globalvars none
* @exception none
* @conditions none
*/
CBitmap()
: m_pixeldata(NULL), m_pixelformat(NULL)
{}
/**
* @method ~CBitmap
* @brief Default dtor
* @param -
* @return -
* @globalvars none
* @exception none
* @conditions none
*/
virtual ~CBitmap();
/**
* TODO
*/
virtual void read(std::ifstream& in) = 0;
/**
* TODO
*/
virtual void write(std::ofstream& out) = 0;
/**
* @method getPixelData
* @brief Returns pointer to pixelbuffer
* @param -
* @return pointer to pixelbuffer
* @globalvars none
* @exception none
* @conditions none
*/
uint8_t *getPixelData()
{
return m_pixeldata;
}
/* TODO */
virtual const uint32_t getPixelDataSize() = 0;
/* TODO */
virtual const uint32_t getHeight() = 0;
/* TODO */
virtual const uint32_t getWidth() = 0;
/* TODO */
virtual const bool isMirrored() = 0;
protected:
/**
* @method callFunc
* @brief Delegates the function and its parameters to the correct
* internal method
* @param func function name
* @param params function parameters as list
* @return -
* @globalvars none
* @exception ParserError
* @conditions none
*/
void callFunc(const std::string& func, const std::list<std::string>& params);
/**
* @method fillrect
* @brief Fills rectangle in image starting on position x, y
* width size width, height and color red, green, blue.
* @param params function parameters as list
* @return -
* @globalvars none
* @exception FileError
* @conditions none
*
* Scriptfile syntax: fillrect(x, y, width, height, red, green, blue)
*/
void fillrect(std::list<std::string> params);
/* TODO */
void invert(std::list<std::string> params);
/* TODO */
void brightness(std::list<std::string> params);
/* TODO */
void mirror_y(std::list<std::string> params);
/* TODO */
void mirror_x(std::list<std::string> params);
/* members */
/** pointer to pixelbuffer */
uint8_t *m_pixeldata;
/** set of supported PixelFormat handlers */
std::set<CPixelFormat *> m_handlers;
/** pointer to CPixelFormat implementation */
CPixelFormat *m_pixelformat;
};
#endif
/* vim: set et sw=2 ts=2: */
|