diff options
Diffstat (limited to 'ue2/imgsynth2/cpixmap.h')
| -rw-r--r-- | ue2/imgsynth2/cpixmap.h | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/ue2/imgsynth2/cpixmap.h b/ue2/imgsynth2/cpixmap.h index eb219aa..66aa1c1 100644 --- a/ue2/imgsynth2/cpixmap.h +++ b/ue2/imgsynth2/cpixmap.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include "cbitmap.h" | 12 | #include "cbitmap.h" |
| 13 | 13 | ||
| 14 | #define PIXMAP_IDENTIFIER "/* XPM */" | ||
| 15 | |||
| 14 | /** | 16 | /** |
| 15 | * @class CPixmap | 17 | * @class CPixmap |
| 16 | * @brief Implementation of CFile handling Pixmap file format. | 18 | * @brief Implementation of CFile handling Pixmap file format. |
| @@ -70,7 +72,7 @@ class CPixmap : public CBitmap | |||
| 70 | * @exception bad_alloc | 72 | * @exception bad_alloc |
| 71 | * @conditions none | 73 | * @conditions none |
| 72 | */ | 74 | */ |
| 73 | void write(std::ofstream& out, std::string& filename); | 75 | void write(std::ofstream& out); |
| 74 | 76 | ||
| 75 | #ifdef DEBUG | 77 | #ifdef DEBUG |
| 76 | /** | 78 | /** |
| @@ -85,51 +87,24 @@ class CPixmap : public CBitmap | |||
| 85 | void dump(std::ostream& out); | 87 | void dump(std::ostream& out); |
| 86 | #endif | 88 | #endif |
| 87 | 89 | ||
| 88 | /** | ||
| 89 | * @brief Pixmap Header structure | ||
| 90 | */ | ||
| 91 | #pragma pack(push,1) | ||
| 92 | typedef struct | ||
| 93 | { | ||
| 94 | /** the xpm width in pixels (signed integer) */ | ||
| 95 | uint32_t xpmWidth; | ||
| 96 | /** the xpm height in pixels (signed integer) */ | ||
| 97 | uint32_t xpmHeight; | ||
| 98 | /** the number of colors (signed integer) */ | ||
| 99 | uint32_t nColor; | ||
| 100 | /** the number of characters per pixel (signed integer) */ | ||
| 101 | uint32_t nChar; | ||
| 102 | /** X-Position Hotspots */ | ||
| 103 | uint32_t xHotspot; | ||
| 104 | /** Y-Position Hotspots */ | ||
| 105 | uint32_t yHotspot; | ||
| 106 | /* is hotspot set */ | ||
| 107 | bool _HOTSPOT; | ||
| 108 | /* XPMEXT extension tag found*/ | ||
| 109 | bool _XPMEXT; | ||
| 110 | /* unchanged extension */ | ||
| 111 | std::string extension; | ||
| 112 | } PIXMAP_FILEHEADER; | ||
| 113 | #pragma pack(pop) | ||
| 114 | |||
| 115 | /* TODO */ | 90 | /* TODO */ |
| 116 | const uint32_t getPixelDataSize() | 91 | const uint32_t getPixelDataSize() |
| 117 | { | 92 | { |
| 118 | return m_fileheader.xpmWidth * m_fileheader.xpmHeight * m_fileheader.nChar; | 93 | return m_fileheader.width * m_fileheader.height * m_fileheader.nChar; |
| 119 | } | 94 | } |
| 120 | 95 | ||
| 121 | /* TODO */ | 96 | /* TODO */ |
| 122 | const uint32_t getHeight() | 97 | const uint32_t getHeight() |
| 123 | { | 98 | { |
| 124 | /* width and height can be negativ */ | 99 | /* width and height can be negativ */ |
| 125 | return m_fileheader.xpmHeight; | 100 | return m_fileheader.height; |
| 126 | } | 101 | } |
| 127 | 102 | ||
| 128 | /* TODO */ | 103 | /* TODO */ |
| 129 | const uint32_t getWidth() | 104 | const uint32_t getWidth() |
| 130 | { | 105 | { |
| 131 | /* width and height can be negativ */ | 106 | /* width and height can be negativ */ |
| 132 | return m_fileheader.xpmWidth; | 107 | return m_fileheader.width; |
| 133 | } | 108 | } |
| 134 | 109 | ||
| 135 | /** | 110 | /** |
| @@ -155,10 +130,42 @@ class CPixmap : public CBitmap | |||
| 155 | } | 130 | } |
| 156 | 131 | ||
| 157 | protected: | 132 | protected: |
| 133 | /** TODO */ | ||
| 134 | std::string getLine(std::ifstream& in, bool ignore_comments = true); | ||
| 135 | /** TODO */ | ||
| 136 | std::string getArrayLine(std::ifstream& in, bool ignore_comments = true); | ||
| 137 | |||
| 138 | /** | ||
| 139 | * @brief Pixmap Header structure | ||
| 140 | */ | ||
| 141 | typedef struct | ||
| 142 | { | ||
| 143 | /** the xpm width in pixels (signed integer) */ | ||
| 144 | uint32_t width; | ||
| 145 | /** the xpm height in pixels (signed integer) */ | ||
| 146 | uint32_t height; | ||
| 147 | /** the number of colors (signed integer) */ | ||
| 148 | uint32_t nColor; | ||
| 149 | /** the number of characters per pixel (signed integer) */ | ||
| 150 | uint32_t nChar; | ||
| 151 | /** X-Position Hotspots */ | ||
| 152 | uint32_t xHotspot; | ||
| 153 | /** Y-Position Hotspots */ | ||
| 154 | uint32_t yHotspot; | ||
| 155 | /* is hotspot set */ | ||
| 156 | bool _HOTSPOT; | ||
| 157 | /* XPMEXT extension tag found*/ | ||
| 158 | bool _XPMEXT; | ||
| 159 | /* unchanged extension */ | ||
| 160 | std::string extension; | ||
| 161 | } PIXMAP_FILEHEADER; | ||
| 162 | |||
| 158 | /* members */ | 163 | /* members */ |
| 159 | /** fileheader */ | 164 | /** fileheader */ |
| 160 | PIXMAP_FILEHEADER m_fileheader; | 165 | PIXMAP_FILEHEADER m_fileheader; |
| 161 | /** infoheader */ | 166 | /** TODO */ |
| 167 | std::string m_imagename; | ||
| 168 | /** TODO convert PIXMAP_FILEHEADER to member variables */ | ||
| 162 | }; | 169 | }; |
| 163 | 170 | ||
| 164 | #endif | 171 | #endif |
