/** * @module cbitmap * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) * @brief Abstract implementation of CFile handling Bitmaps. * @date 17.04.2009 */ #ifndef CBITMAP_H #define CBITMAP_H #include #include #include #include "cfile.h" class CPixelFormat; #include "cpixelformat.h" /** * @class CBitmap * @brief Implementation of CFile handling Bitmaps. * * In order to support operations on bitmaps with different color bitcounts * different implementations of CPixelFormat are used. These classes are * allowed to modify the bitmap headers and pixelbuffer directly. * * On error CFile::FileError is thrown. */ class CBitmap : public CFile { public: /** * @method CBitmap * @brief Default ctor * @param - * @return - * @globalvars none * @exception none * @conditions none */ CBitmap() : m_pixeldata(NULL), m_pixelformat(NULL) {} /** * @method ~CBitmap * @brief Default dtor * @param - * @return - * @globalvars none * @exception none * @conditions none */ virtual ~CBitmap(); /** * TODO */ virtual void read(std::ifstream& in) = 0; /** * TODO */ virtual void write(std::ofstream& out, std::string& filename) = 0; /** * @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) */ 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; /* color table */ std::map > xpmColors; }; #endif /* vim: set et sw=2 ts=2: */