Download | Plain Text | No Line Numbers


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