From 5f499a8233c7bb68b52b8fdeddac9a06061ea4d7 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 28 Apr 2009 18:32:15 +0200 Subject: Moved a lot of stuff around to get abstract cbitmap working --- ue2/imgsynth2/cbitmap.h | 77 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 5 deletions(-) (limited to 'ue2/imgsynth2/cbitmap.h') diff --git a/ue2/imgsynth2/cbitmap.h b/ue2/imgsynth2/cbitmap.h index c43e01d..c8a7f0d 100644 --- a/ue2/imgsynth2/cbitmap.h +++ b/ue2/imgsynth2/cbitmap.h @@ -1,7 +1,7 @@ /** * @module cbitmap * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) - * @brief Implementation of CFile handling Bitmaps. + * @brief Abstract implementation of CFile handling Bitmaps. * @date 17.04.2009 */ @@ -37,8 +37,10 @@ class CBitmap : public CFile * @conditions none */ CBitmap() + : m_pixeldata(NULL), m_pixelformat(NULL) {} + /** * @method ~CBitmap * @brief Default dtor @@ -48,8 +50,7 @@ class CBitmap : public CFile * @exception none * @conditions none */ - virtual ~CBitmap() - {}; + virtual ~CBitmap(); /** * TODO @@ -62,9 +63,75 @@ class CBitmap : public CFile virtual void write(std::ofstream& out) = 0; /** - * TODO + * @method getPixelData + * @brief Returns pointer to pixelbuffer + * @param - + * @return pointer to pixelbuffer + * @globalvars none + * @exception none + * @conditions none + */ + uint8_t *getPixelData() + { + return m_pixeldata; + } + + /* TODO */ + virtual const uint32_t getPixelDataSize() = 0; + /* TODO */ + virtual const uint32_t getHeight() = 0; + /* TODO */ + virtual const uint32_t getWidth() = 0; + /* TODO */ + virtual const bool isMirrored() = 0; + + protected: + /** + * @method callFunc + * @brief Delegates the function and its parameters to the correct + * internal method + * @param func function name + * @param params function parameters as list + * @return - + * @globalvars none + * @exception ParserError + * @conditions none + */ + void callFunc(const std::string& func, const std::list& params); + + /** + * @method fillrect + * @brief Fills rectangle in image starting on position x, y + * width size width, height and color red, green, blue. + * @param params function parameters as list + * @return - + * @globalvars none + * @exception FileError + * @conditions none + * + * Scriptfile syntax: fillrect(x, y, width, height, red, green, blue) */ - virtual void callFunc(const std::string& func, const std::list& params) = 0; + void fillrect(std::list params); + + /* TODO */ + void invert(std::list params); + + /* TODO */ + void brightness(std::list params); + + /* TODO */ + void mirror_y(std::list params); + + /* TODO */ + void mirror_x(std::list params); + + /* members */ + /** pointer to pixelbuffer */ + uint8_t *m_pixeldata; + /** set of supported PixelFormat handlers */ + std::set m_handlers; + /** pointer to CPixelFormat implementation */ + CPixelFormat *m_pixelformat; }; #endif -- cgit v1.2.3