summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cbitmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue2/imgsynth2/cbitmap.h')
-rw-r--r--ue2/imgsynth2/cbitmap.h134
1 files changed, 117 insertions, 17 deletions
diff --git a/ue2/imgsynth2/cbitmap.h b/ue2/imgsynth2/cbitmap.h
index f521bcc..c8d4dfb 100644
--- a/ue2/imgsynth2/cbitmap.h
+++ b/ue2/imgsynth2/cbitmap.h
@@ -10,10 +10,7 @@
10 10
11#include <stdint.h> 11#include <stdint.h>
12#include <map> 12#include <map>
13#include <string>
14#include "cfile.h" 13#include "cfile.h"
15
16class CPixelFormat;
17#include "cpixelformat.h" 14#include "cpixelformat.h"
18 15
19/** 16/**
@@ -55,12 +52,28 @@ class CBitmap : public CFile
55 virtual ~CBitmap(); 52 virtual ~CBitmap();
56 53
57 /** 54 /**
58 * 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
59 */ 64 */
60 virtual void read(std::ifstream& in) = 0; 65 virtual void read(std::ifstream& in) = 0;
61 66
62 /** 67 /**
63 * 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
64 */ 77 */
65 virtual void write(std::ofstream& out, std::string& filename) = 0; 78 virtual void write(std::ofstream& out, std::string& filename) = 0;
66 79
@@ -78,15 +91,62 @@ class CBitmap : public CFile
78 return m_pixeldata; 91 return m_pixeldata;
79 } 92 }
80 93
81 /* 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 */
82 virtual const uint32_t getPixelDataSize() = 0; 103 virtual const uint32_t getPixelDataSize() = 0;
83 /* 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 */
84 virtual const uint32_t getHeight() = 0; 114 virtual const uint32_t getHeight() = 0;
85 /* 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 */
86 virtual const uint32_t getWidth() = 0; 125 virtual const uint32_t getWidth() = 0;
87 /* 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 */
88 virtual const bool isMirrored() = 0; 136 virtual const bool isMirrored() = 0;
89 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
90 protected: 150 protected:
91 /** 151 /**
92 * @method callFunc 152 * @method callFunc
@@ -101,7 +161,7 @@ class CBitmap : public CFile
101 */ 161 */
102 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);
103 163
104 /** 164 /**
105 * @method fillrect 165 * @method fillrect
106 * @brief Fills rectangle in image starting on position x, y 166 * @brief Fills rectangle in image starting on position x, y
107 * width size width, height and color red, green, blue. 167 * width size width, height and color red, green, blue.
@@ -115,28 +175,68 @@ class CBitmap : public CFile
115 */ 175 */
116 void fillrect(std::list<std::string> params); 176 void fillrect(std::list<std::string> params);
117 177
118 /* 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 */
119 void invert(std::list<std::string> params); 189 void invert(std::list<std::string> params);
120 190
121 /* 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 */
122 void brightness(std::list<std::string> params); 202 void brightness(std::list<std::string> params);
123 203
124 /* 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 */
125 void mirror_y(std::list<std::string> params); 215 void mirror_y(std::list<std::string> params);
126 216
127 /* 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 */
128 void mirror_x(std::list<std::string> params); 228 void mirror_x(std::list<std::string> params);
129 229
130 /* members */ 230 /* members */
131 /** pointer to pixelbuffer */ 231 /** pointer to pixelbuffer */
132 uint8_t *m_pixeldata; 232 uint8_t *m_pixeldata;
233 /** colortable map */
234 //TODO std::map<std::string, CPixelFormat::RGBPIXEL *> m_colortable;
235 std::map<std::string, std::map< std::string, uint32_t* > > xpmColors;
133 /** set of supported PixelFormat handlers */ 236 /** set of supported PixelFormat handlers */
134 std::set<CPixelFormat *> m_handlers; 237 std::set<CPixelFormat *> m_handlers;
135 /** pointer to CPixelFormat implementation */ 238 /** pointer to CPixelFormat implementation */
136 CPixelFormat *m_pixelformat; 239 CPixelFormat *m_pixelformat;
137 /* color table */
138 std::map<std::string, std::map< std::string, uint32_t* > > xpmColors;
139
140}; 240};
141 241
142#endif 242#endif