summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cbitmap.h
diff options
context:
space:
mode:
authormanuel <manuel@nc8430.lan>2009-05-01 14:54:45 +0200
committermanuel <manuel@nc8430.lan>2009-05-01 14:54:45 +0200
commitb22395ec4de60326eb629df882b4b8781dbca15c (patch)
treeb04e7a01d3e50c7d366059517fae249381c7540c /ue2/imgsynth2/cbitmap.h
parentcfd4f77988cf12106e22e52fba6c1b5672a06162 (diff)
downloadooprog-b22395ec4de60326eb629df882b4b8781dbca15c.tar.gz
ooprog-b22395ec4de60326eb629df882b4b8781dbca15c.tar.bz2
ooprog-b22395ec4de60326eb629df882b4b8781dbca15c.zip
- removed runtime generated output files
- implemented brightness() - implemented invert() - implemented getPixel in CPixelFormat_BGR24 and CPixelFormat_BGR555
Diffstat (limited to 'ue2/imgsynth2/cbitmap.h')
-rw-r--r--ue2/imgsynth2/cbitmap.h130
1 files changed, 117 insertions, 13 deletions
diff --git a/ue2/imgsynth2/cbitmap.h b/ue2/imgsynth2/cbitmap.h
index f8f8850..df7dc84 100644
--- a/ue2/imgsynth2/cbitmap.h
+++ b/ue2/imgsynth2/cbitmap.h
@@ -9,9 +9,8 @@
9#define CBITMAP_H 9#define CBITMAP_H
10 10
11#include <stdint.h> 11#include <stdint.h>
12#include <map>
12#include "cfile.h" 13#include "cfile.h"
13
14class CPixelFormat;
15#include "cpixelformat.h" 14#include "cpixelformat.h"
16 15
17/** 16/**
@@ -53,12 +52,28 @@ class CBitmap : public CFile
53 virtual ~CBitmap(); 52 virtual ~CBitmap();
54 53
55 /** 54 /**
56 * TODO 55 * @method read
56 * @brief Reads Windows Bitmap from filestream.
57 * On error an exception is thrown.
58 * @param in filestream to read data from
59 * @return -
60 * @globalvars none
61 * @exception CFile::FileError
62 * @exception bad_alloc
63 * @conditions none
57 */ 64 */
58 virtual void read(std::ifstream& in) = 0; 65 virtual void read(std::ifstream& in) = 0;
59 66
60 /** 67 /**
61 * TODO 68 * @method write
69 * @brief Writes Windows Bitmap to filestream.
70 * @param out filestream to read data from
71 * @param filename filename (maybe useful for some handlers)
72 * @return -
73 * @globalvars none
74 * @exception FileError
75 * @exception bad_alloc
76 * @conditions none
62 */ 77 */
63 virtual void write(std::ofstream& out, std::string& filename) = 0; 78 virtual void write(std::ofstream& out, std::string& filename) = 0;
64 79
@@ -76,15 +91,62 @@ class CBitmap : public CFile
76 return m_pixeldata; 91 return m_pixeldata;
77 } 92 }
78 93
79 /* TODO */ 94 /**
95 * @method getPixelDataSize
96 * @brief Return size of pixelbuffer
97 * @param -
98 * @return size of pixelbuffer
99 * @globalvars none
100 * @exception none
101 * @conditions none
102 */
80 virtual const uint32_t getPixelDataSize() = 0; 103 virtual const uint32_t getPixelDataSize() = 0;
81 /* TODO */ 104
105 /**
106 * @method getHeight
107 * @brief Return height of bitmap in pixel
108 * @param -
109 * @return height of bitmap in pixel
110 * @globalvars none
111 * @exception none
112 * @conditions none
113 */
82 virtual const uint32_t getHeight() = 0; 114 virtual const uint32_t getHeight() = 0;
83 /* TODO */ 115
116 /**
117 * @method getWidth
118 * @brief Return width of bitmap in pixel
119 * @param -
120 * @return width of bitmap in pixel
121 * @globalvars none
122 * @exception none
123 * @conditions none
124 */
84 virtual const uint32_t getWidth() = 0; 125 virtual const uint32_t getWidth() = 0;
85 /* TODO */ 126
127 /**
128 * @method isMirrored
129 * @brief Windows Bitmaps can be stored upside down
130 * @param -
131 * @return true if bitmap is stored upside down. false otherwise
132 * @globalvars none
133 * @exception none
134 * @conditions none
135 */
86 virtual const bool isMirrored() = 0; 136 virtual const bool isMirrored() = 0;
87 137
138 /**
139 * @method hasColorTable
140 * @brief Check if bitmap has a colortable
141 * (we don't support this yet for windows bitmaps)
142 * @param -
143 * @return true if bitmap has a colortable. false otherwise
144 * @globalvars none
145 * @exception none
146 * @conditions none
147 */
148 virtual const bool hasColorTable() = 0;
149
88 protected: 150 protected:
89 /** 151 /**
90 * @method callFunc 152 * @method callFunc
@@ -99,7 +161,7 @@ class CBitmap : public CFile
99 */ 161 */
100 void callFunc(const std::string& func, const std::list<std::string>& params); 162 void callFunc(const std::string& func, const std::list<std::string>& params);
101 163
102 /** 164 /**
103 * @method fillrect 165 * @method fillrect
104 * @brief Fills rectangle in image starting on position x, y 166 * @brief Fills rectangle in image starting on position x, y
105 * width size width, height and color red, green, blue. 167 * width size width, height and color red, green, blue.
@@ -113,21 +175,63 @@ class CBitmap : public CFile
113 */ 175 */
114 void fillrect(std::list<std::string> params); 176 void fillrect(std::list<std::string> params);
115 177
116 /* TODO */ 178 /**
179 * @method invert
180 * @brief Invert image
181 * @param params function parameters as list
182 * @return -
183 * @globalvars none
184 * @exception FileError
185 * @conditions none
186 *
187 * Scriptfile syntax: invert()
188 */
117 void invert(std::list<std::string> params); 189 void invert(std::list<std::string> params);
118 190
119 /* TODO */ 191 /**
192 * @method brightness
193 * @brief Increase/decrease brightness of image
194 * @param params function parameters as list
195 * @return -
196 * @globalvars none
197 * @exception FileError
198 * @conditions none
199 *
200 * Scriptfile syntax: brightness(factor)
201 */
120 void brightness(std::list<std::string> params); 202 void brightness(std::list<std::string> params);
121 203
122 /* TODO */ 204 /**
205 * @method mirror_y
206 * @brief Mirror image around the y-axis
207 * @param params function parameters as list
208 * @return -
209 * @globalvars none
210 * @exception FileError
211 * @conditions none
212 *
213 * Scriptfile syntax: mirror_y()
214 */
123 void mirror_y(std::list<std::string> params); 215 void mirror_y(std::list<std::string> params);
124 216
125 /* TODO */ 217 /**
218 * @method mirror_x
219 * @brief Mirror image around the x-axis
220 * @param params function parameters as list
221 * @return -
222 * @globalvars none
223 * @exception FileError
224 * @conditions none
225 *
226 * Scriptfile syntax: mirror_y()
227 */
126 void mirror_x(std::list<std::string> params); 228 void mirror_x(std::list<std::string> params);
127 229
128 /* members */ 230 /* members */
129 /** pointer to pixelbuffer */ 231 /** pointer to pixelbuffer */
130 uint8_t *m_pixeldata; 232 uint8_t *m_pixeldata;
233 /** colortable map */
234 std::map<std::string, CPixelFormat::RGBPIXEL *> m_colortable;
131 /** set of supported PixelFormat handlers */ 235 /** set of supported PixelFormat handlers */
132 std::set<CPixelFormat *> m_handlers; 236 std::set<CPixelFormat *> m_handlers;
133 /** pointer to CPixelFormat implementation */ 237 /** pointer to CPixelFormat implementation */