summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cpixelformat_bgr555.h
blob: b04e4beb637056489d5feb5f763f37739d61c275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
 * @module cpixelformat_bgr555
 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
 * @brief  Implementation of CPixelFormat handling BGR555 color (real color)
 *         Windows Bitmaps.
 * @date   26.04.2009
 */

#ifndef CPIXELFORMAT_BGR555_H
#define CPIXELFORMAT_BGR555_H

#include <fstream>
#include "cpixelformat.h"

/* TODO */
#define BGR555_RED_SHIFT    10
#define BGR555_GREEN_SHIFT  5
#define BGR555_BLUE_SHIFT   0
#define BGR555_RED_MASK     0x7C00
#define BGR555_GREEN_MASK   0x03E0
#define BGR555_BLUE_MASK    0x001F

/**
 * @class CPixelFormat_BGR555
 * @brief Implementation of CPixelFormat handling BGR555 color (real color)
 *        Windows Bitmaps.
 *
 * On error CPixelFormat::PixelFormatError is thrown.
 */
class CPixelFormat_BGR555 : public CPixelFormat
{
  public:
    /**
     * @method CPixelFormat_BGR55
     * @brief  Default ctor
     * @param  bitmap pointer to CBitmap instance
     * @return -
     * @globalvars none
     * @exception  none
     * @conditions none
     */
    CPixelFormat_BGR555(CBitmap *bitmap)
      : CPixelFormat(bitmap)
    {}

    /**
     * @method ~CPixelFormat_BGR555
     * @brief  Default dtor
     * @param  -
     * @return -
     * @globalvars none
     * @exception  none
     * @conditions none
     */
    ~CPixelFormat_BGR555()
    {}

    /* TODO */
    void getPixel(uint32_t *pixel, uint32_t x, uint32_t y);

    /**
     * @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
     */
    void setPixel(const uint32_t *pixel, uint32_t x, uint32_t y);

    /**
     * @method getBitCount
     * @brief  returns color bitcount supported by this class
     * @param  -
     * @return color bitcount supported by this class
     * @globalvars none
     * @exception  none
     * @conditions none
     */
    uint32_t getBitCount()
    {
      return 16;
    }

    /*
     * TODO
     */
    void getMaxColor(unsigned int *red, unsigned int *green, unsigned int *blue)
    {
      *red = *green = *blue = 31; /* 2^5 -1 */
    }
};

#endif

/* vim: set et sw=2 ts=2: */