diff options
Diffstat (limited to 'ue2/imgsynth2/cpixmap.h')
| -rw-r--r-- | ue2/imgsynth2/cpixmap.h | 85 |
1 files changed, 73 insertions, 12 deletions
diff --git a/ue2/imgsynth2/cpixmap.h b/ue2/imgsynth2/cpixmap.h index 66aa1c1..10f2b33 100644 --- a/ue2/imgsynth2/cpixmap.h +++ b/ue2/imgsynth2/cpixmap.h | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | #include "cbitmap.h" | 12 | #include "cbitmap.h" |
| 13 | 13 | ||
| 14 | #define PIXMAP_IDENTIFIER "/* XPM */" | 14 | #define PIXMAP_IDENTIFIER "/* XPM */" |
| 15 | #define PIXMAP_COLORCHARS ".#abcdefghijklmnopqrstuvwxyzABCD" \ | ||
| 16 | "EFGHIJKLMNOPQRSTUVWXYZ0123456789" | ||
| 15 | 17 | ||
| 16 | /** | 18 | /** |
| 17 | * @class CPixmap | 19 | * @class CPixmap |
| @@ -87,23 +89,45 @@ class CPixmap : public CBitmap | |||
| 87 | void dump(std::ostream& out); | 89 | void dump(std::ostream& out); |
| 88 | #endif | 90 | #endif |
| 89 | 91 | ||
| 90 | /* TODO */ | 92 | /** |
| 93 | * @method getPixelDataSize | ||
| 94 | * @brief Return size of pixelbuffer | ||
| 95 | * @param - | ||
| 96 | * @return size of pixelbuffer | ||
| 97 | * @globalvars none | ||
| 98 | * @exception none | ||
| 99 | * @conditions none | ||
| 100 | */ | ||
| 91 | const uint32_t getPixelDataSize() | 101 | const uint32_t getPixelDataSize() |
| 92 | { | 102 | { |
| 93 | return m_fileheader.width * m_fileheader.height * m_fileheader.nChar; | 103 | return m_fileheader.width * m_fileheader.height * sizeof(uint32_t); |
| 94 | } | 104 | } |
| 95 | 105 | ||
| 96 | /* TODO */ | 106 | /** |
| 107 | * @method getHeight | ||
| 108 | * @brief Return height of bitmap in pixel | ||
| 109 | * @param - | ||
| 110 | * @return height of bitmap in pixel | ||
| 111 | * @globalvars none | ||
| 112 | * @exception none | ||
| 113 | * @conditions none | ||
| 114 | */ | ||
| 97 | const uint32_t getHeight() | 115 | const uint32_t getHeight() |
| 98 | { | 116 | { |
| 99 | /* width and height can be negativ */ | ||
| 100 | return m_fileheader.height; | 117 | return m_fileheader.height; |
| 101 | } | 118 | } |
| 102 | 119 | ||
| 103 | /* TODO */ | 120 | /** |
| 121 | * @method getWidth | ||
| 122 | * @brief Return width of bitmap in pixel | ||
| 123 | * @param - | ||
| 124 | * @return width of bitmap in pixel | ||
| 125 | * @globalvars none | ||
| 126 | * @exception none | ||
| 127 | * @conditions none | ||
| 128 | */ | ||
| 104 | const uint32_t getWidth() | 129 | const uint32_t getWidth() |
| 105 | { | 130 | { |
| 106 | /* width and height can be negativ */ | ||
| 107 | return m_fileheader.width; | 131 | return m_fileheader.width; |
| 108 | } | 132 | } |
| 109 | 133 | ||
| @@ -122,7 +146,15 @@ class CPixmap : public CBitmap | |||
| 122 | return true; | 146 | return true; |
| 123 | } | 147 | } |
| 124 | 148 | ||
| 125 | /* TODO */ | 149 | /** |
| 150 | * @method isMirrored | ||
| 151 | * @brief Windows Bitmaps can be stored upside down | ||
| 152 | * @param - | ||
| 153 | * @return true if bitmap is stored upside down. false otherwise | ||
| 154 | * @globalvars none | ||
| 155 | * @exception none | ||
| 156 | * @conditions none | ||
| 157 | */ | ||
| 126 | const bool isMirrored() | 158 | const bool isMirrored() |
| 127 | { | 159 | { |
| 128 | /* pixmap is never mirrored */ | 160 | /* pixmap is never mirrored */ |
| @@ -130,10 +162,40 @@ class CPixmap : public CBitmap | |||
| 130 | } | 162 | } |
| 131 | 163 | ||
| 132 | protected: | 164 | protected: |
| 133 | /** TODO */ | 165 | /** |
| 166 | * @method getLine | ||
| 167 | * @brief read trimmed line (terminated by \n) from filestream | ||
| 168 | * @param in filestream to read data from | ||
| 169 | * @param ignore_comments true: ignore c-like comments | ||
| 170 | * @return return trimmed line from filestream | ||
| 171 | * @globalvars none | ||
| 172 | * @exception none | ||
| 173 | * @conditions none | ||
| 174 | */ | ||
| 134 | std::string getLine(std::ifstream& in, bool ignore_comments = true); | 175 | std::string getLine(std::ifstream& in, bool ignore_comments = true); |
| 135 | /** TODO */ | 176 | |
| 136 | std::string getArrayLine(std::ifstream& in, bool ignore_comments = true); | 177 | /** |
| 178 | * @method getArrayLine | ||
| 179 | * @brief read trimmed c-arrayline from filestream | ||
| 180 | * @param in filestream to read data from | ||
| 181 | * @return return trimmed c-arrayline from filestream | ||
| 182 | * @globalvars none | ||
| 183 | * @exception FileError | ||
| 184 | * @conditions none | ||
| 185 | */ | ||
| 186 | std::string getCArrayLine(std::ifstream& in); | ||
| 187 | |||
| 188 | /** | ||
| 189 | * @method getXPMColorID | ||
| 190 | * @brief get xpm color identifier, generated using an index | ||
| 191 | * @param index index used to generate the xpm color identifier | ||
| 192 | * @param length length of xpm color identifier | ||
| 193 | * @return return xpm color identifier, generated using index | ||
| 194 | * @globalvars none | ||
| 195 | * @exception FileError | ||
| 196 | * @conditions none | ||
| 197 | */ | ||
| 198 | const std::string getXPMColorID(unsigned int index, unsigned int length); | ||
| 137 | 199 | ||
| 138 | /** | 200 | /** |
| 139 | * @brief Pixmap Header structure | 201 | * @brief Pixmap Header structure |
| @@ -163,9 +225,8 @@ class CPixmap : public CBitmap | |||
| 163 | /* members */ | 225 | /* members */ |
| 164 | /** fileheader */ | 226 | /** fileheader */ |
| 165 | PIXMAP_FILEHEADER m_fileheader; | 227 | PIXMAP_FILEHEADER m_fileheader; |
| 166 | /** TODO */ | 228 | /** name of image/c-array */ |
| 167 | std::string m_imagename; | 229 | std::string m_imagename; |
| 168 | /** TODO convert PIXMAP_FILEHEADER to member variables */ | ||
| 169 | }; | 230 | }; |
| 170 | 231 | ||
| 171 | #endif | 232 | #endif |
