From aa139a7d2b3f26af7590edbf413df67195c5d900 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 27 Apr 2009 00:25:16 +0200 Subject: Adding ue2 --- ue2/imgsynth2/cpixelformat.h | 124 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 ue2/imgsynth2/cpixelformat.h (limited to 'ue2/imgsynth2/cpixelformat.h') diff --git a/ue2/imgsynth2/cpixelformat.h b/ue2/imgsynth2/cpixelformat.h new file mode 100644 index 0000000..49145df --- /dev/null +++ b/ue2/imgsynth2/cpixelformat.h @@ -0,0 +1,124 @@ +/** + * @module cpixelformat + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief Abstract class for handling different color bitcount of Bitmaps. + * Needed for generic use in CBitmap. + * @date 18.04.2009 + */ + +#ifndef CPIXELFORMAT_H +#define CPIXELFORMAT_H + +#include +#include + +class CBitmap; +#include "cbitmap.h" + +/** + * @class CPixelFormat + * @brief Abstract class for handling different color bitcount of Bitmaps. + * + * Needed for generic use in CBitmap. + * + * On error throw PixelFormatError. + */ +class CPixelFormat +{ + public: + /** + * @class PixelFormatError + * @brief Exception thrown by implemententations of CPixelFormat + */ + class PixelFormatError : public std::invalid_argument { + public: + /** + * @method PixelFormatError + * @brief Default exception ctor + * @param what message to pass along + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + PixelFormatError(const std::string& what) + : std::invalid_argument(what) + {} + }; + + /** + * @method CBitmap + * @brief Default ctor + * @param bitmap pointer to CBitmap instance + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + CPixelFormat(CBitmap *bitmap) + : m_bitmap(bitmap) + {} + + /** + * @method ~CPixelFormat + * @brief Default dtor (virtual) + * @param - + * @return - + * @globalvars none + * @exception none + * @conditions none + */ + virtual ~CPixelFormat() + {}; + + /** + * @method setPixel + * @brief Modifies pixel at coordinates x, y + * @param pixel pointer to new pixel data + * @param x x-coordinate + * @param y y-coordinate + * @return - + * @globalvars none + * @exception PixelFormatError + * @conditions none + */ + virtual void setPixel(const uint32_t *pixel, const uint32_t x, const uint32_t y) = 0; + + /** + * @method getPixel + * @brief Get pixel at coordinates x, y + * @param pixel pointer to pixel data + * @param x x-coordinate + * @param y y-coordinate + * @return - + * @globalvars none + * @exception PixelFormatError + * @conditions none + */ + //TODO virtual void getPixel(const uint32_t *pixel, const uint32_t x, const uint32_t y) = 0; + + /** + * @method getBitCount + * @brief returns color bitcount supported by this class + * @param - + * @return color bitcount supported by this class + * @globalvars none + * @exception none + * @conditions none + */ + virtual uint32_t getBitCount() = 0; + + /* + * TODO + */ + virtual void getMaxColor(unsigned int *red, unsigned int *green, unsigned int *blue) = 0; + + protected: + /* members */ + /** pointer to CBitmap instance */ + CBitmap *m_bitmap; +}; + +#endif + +/* vim: set et sw=2 ts=2: */ -- cgit v1.2.3