From bcadfa267f976fe9f29afa50a635cbe3ea174e38 Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 2 May 2009 16:44:53 +0200 Subject: - colortable now uses uint32_t as identifier - rewrote xpm colortable parsing to convert their identifiers to our own and vica vi - implemented indexed8::setpixel/getpixel - moved rowsize to member variable in cbitmap - added second test for xpm/indexed8 --- ue2/imgsynth2/cpixmap.h | 85 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 12 deletions(-) (limited to 'ue2/imgsynth2/cpixmap.h') 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 @@ #include "cbitmap.h" #define PIXMAP_IDENTIFIER "/* XPM */" +#define PIXMAP_COLORCHARS ".#abcdefghijklmnopqrstuvwxyzABCD" \ + "EFGHIJKLMNOPQRSTUVWXYZ0123456789" /** * @class CPixmap @@ -87,23 +89,45 @@ class CPixmap : public CBitmap void dump(std::ostream& out); #endif - /* TODO */ + /** + * @method getPixelDataSize + * @brief Return size of pixelbuffer + * @param - + * @return size of pixelbuffer + * @globalvars none + * @exception none + * @conditions none + */ const uint32_t getPixelDataSize() { - return m_fileheader.width * m_fileheader.height * m_fileheader.nChar; + return m_fileheader.width * m_fileheader.height * sizeof(uint32_t); } - /* TODO */ + /** + * @method getHeight + * @brief Return height of bitmap in pixel + * @param - + * @return height of bitmap in pixel + * @globalvars none + * @exception none + * @conditions none + */ const uint32_t getHeight() { - /* width and height can be negativ */ return m_fileheader.height; } - /* TODO */ + /** + * @method getWidth + * @brief Return width of bitmap in pixel + * @param - + * @return width of bitmap in pixel + * @globalvars none + * @exception none + * @conditions none + */ const uint32_t getWidth() { - /* width and height can be negativ */ return m_fileheader.width; } @@ -122,7 +146,15 @@ class CPixmap : public CBitmap return true; } - /* TODO */ + /** + * @method isMirrored + * @brief Windows Bitmaps can be stored upside down + * @param - + * @return true if bitmap is stored upside down. false otherwise + * @globalvars none + * @exception none + * @conditions none + */ const bool isMirrored() { /* pixmap is never mirrored */ @@ -130,10 +162,40 @@ class CPixmap : public CBitmap } protected: - /** TODO */ + /** + * @method getLine + * @brief read trimmed line (terminated by \n) from filestream + * @param in filestream to read data from + * @param ignore_comments true: ignore c-like comments + * @return return trimmed line from filestream + * @globalvars none + * @exception none + * @conditions none + */ std::string getLine(std::ifstream& in, bool ignore_comments = true); - /** TODO */ - std::string getArrayLine(std::ifstream& in, bool ignore_comments = true); + + /** + * @method getArrayLine + * @brief read trimmed c-arrayline from filestream + * @param in filestream to read data from + * @return return trimmed c-arrayline from filestream + * @globalvars none + * @exception FileError + * @conditions none + */ + std::string getCArrayLine(std::ifstream& in); + + /** + * @method getXPMColorID + * @brief get xpm color identifier, generated using an index + * @param index index used to generate the xpm color identifier + * @param length length of xpm color identifier + * @return return xpm color identifier, generated using index + * @globalvars none + * @exception FileError + * @conditions none + */ + const std::string getXPMColorID(unsigned int index, unsigned int length); /** * @brief Pixmap Header structure @@ -163,9 +225,8 @@ class CPixmap : public CBitmap /* members */ /** fileheader */ PIXMAP_FILEHEADER m_fileheader; - /** TODO */ + /** name of image/c-array */ std::string m_imagename; - /** TODO convert PIXMAP_FILEHEADER to member variables */ }; #endif -- cgit v1.2.3