Download | Plain Text | No Line Numbers


  1. /**
  2.  * @module cpixelformat_bgr24
  3.  * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
  4.  * @brief Implementation of CPixelFormat handling 24bit indexed bitmaps.
  5.  * @date 02.05.2009
  6.  */
  7.  
  8. #ifndef CPixelFormat_Indexed8_H
  9. #define CPixelFormat_Indexed8_H
  10.  
  11. #include <fstream>
  12. #include "cpixelformat.h"
  13.  
  14. /**
  15.  * @class CPixelFormat_Indexed8
  16.  * @brief Implementation of CPixelFormat handling 24bit indexed bitmaps.
  17.  *
  18.  * On error CPixelFormat::PixelFormatError is thrown.
  19.  */
  20. class CPixelFormat_Indexed8 : public CPixelFormat
  21. {
  22. public:
  23. /**
  24.   * @method CPixelFormat_Indexed8
  25.   * @brief Default ctor
  26.   * @param bitmap pointer to CBitmap instance
  27.   * @return -
  28.   * @globalvars none
  29.   * @exception none
  30.   * @conditions none
  31.   */
  32. CPixelFormat_Indexed8(CBitmap *bitmap)
  33. : CPixelFormat(bitmap)
  34. {}
  35.  
  36. /**
  37.   * @method ~CPixelFormat_Indexed8
  38.   * @brief Default dtor
  39.   * @param -
  40.   * @return -
  41.   * @globalvars none
  42.   * @exception none
  43.   * @conditions none
  44.   */
  45. ~CPixelFormat_Indexed8()
  46. {}
  47.  
  48. /**
  49.   * @method getPixel
  50.   * @brief Get pixel at coordinates x, y
  51.   * @param pixel reference to pixel data
  52.   * @param x x-coordinate
  53.   * @param y y-coordinate
  54.   * @return -
  55.   * @globalvars none
  56.   * @exception PixelFormatError
  57.   * @conditions none
  58.   */
  59. void getPixel(RGBPIXEL& pixel, uint32_t x, uint32_t y);
  60.  
  61. /**
  62.   * @method setPixel
  63.   * @brief Modifies pixel at coordinates x, y
  64.   * @param pixel reference to new pixel data
  65.   * @param x x-coordinate
  66.   * @param y y-coordinate
  67.   * @return -
  68.   * @globalvars none
  69.   * @exception PixelFormatError
  70.   * @conditions none
  71.   */
  72. void setPixel(const RGBPIXEL& pixel, uint32_t x, uint32_t y);
  73.  
  74. /**
  75.   * @method getBitCount
  76.   * @brief returns the bitcount needed for indexing the color tabel.
  77.   * @param -
  78.   * @return bitcount of indexes supported by this class
  79.   * @globalvars none
  80.   * @exception none
  81.   * @conditions none
  82.   */
  83. uint32_t getBitCount()
  84. {
  85. return 24;
  86. }
  87.  
  88. /**
  89.   * @method getMaxColor
  90.   * @brief Get maximum values for RGB pixel
  91.   * @param pixel reference to pixel struct
  92.   * @return -
  93.   * @globalvars none
  94.   * @exception none
  95.   * @conditions none
  96.   */
  97. void getMaxColor(RGBPIXEL& pixel)
  98. {
  99. /* value = 2^8 - 1 */
  100. pixel.red = pixel.green = pixel.blue = 255;
  101. }
  102. };
  103.  
  104. #endif
  105.  
  106. /* vim: set et sw=2 ts=2: */
  107.