summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cpixelformat.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue2/imgsynth2/cpixelformat.h')
-rw-r--r--ue2/imgsynth2/cpixelformat.h124
1 files changed, 124 insertions, 0 deletions
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 @@
1/**
2 * @module cpixelformat
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief Abstract class for handling different color bitcount of Bitmaps.
5 * Needed for generic use in CBitmap.
6 * @date 18.04.2009
7 */
8
9#ifndef CPIXELFORMAT_H
10#define CPIXELFORMAT_H
11
12#include <fstream>
13#include <stdexcept>
14
15class CBitmap;
16#include "cbitmap.h"
17
18/**
19 * @class CPixelFormat
20 * @brief Abstract class for handling different color bitcount of Bitmaps.
21 *
22 * Needed for generic use in CBitmap.
23 *
24 * On error throw PixelFormatError.
25 */
26class CPixelFormat
27{
28 public:
29 /**
30 * @class PixelFormatError
31 * @brief Exception thrown by implemententations of CPixelFormat
32 */
33 class PixelFormatError : public std::invalid_argument {
34 public:
35 /**
36 * @method PixelFormatError
37 * @brief Default exception ctor
38 * @param what message to pass along
39 * @return -
40 * @globalvars none
41 * @exception none
42 * @conditions none
43 */
44 PixelFormatError(const std::string& what)
45 : std::invalid_argument(what)
46 {}
47 };
48
49 /**
50 * @method CBitmap
51 * @brief Default ctor
52 * @param bitmap pointer to CBitmap instance
53 * @return -
54 * @globalvars none
55 * @exception none
56 * @conditions none
57 */
58 CPixelFormat(CBitmap *bitmap)
59 : m_bitmap(bitmap)
60 {}
61
62 /**
63 * @method ~CPixelFormat
64 * @brief Default dtor (virtual)
65 * @param -
66 * @return -
67 * @globalvars none
68 * @exception none
69 * @conditions none
70 */
71 virtual ~CPixelFormat()
72 {};
73
74 /**
75 * @method setPixel
76 * @brief Modifies pixel at coordinates x, y
77 * @param pixel pointer to new pixel data
78 * @param x x-coordinate
79 * @param y y-coordinate
80 * @return -
81 * @globalvars none
82 * @exception PixelFormatError
83 * @conditions none
84 */
85 virtual void setPixel(const uint32_t *pixel, const uint32_t x, const uint32_t y) = 0;
86
87 /**
88 * @method getPixel
89 * @brief Get pixel at coordinates x, y
90 * @param pixel pointer to pixel data
91 * @param x x-coordinate
92 * @param y y-coordinate
93 * @return -
94 * @globalvars none
95 * @exception PixelFormatError
96 * @conditions none
97 */
98 //TODO virtual void getPixel(const uint32_t *pixel, const uint32_t x, const uint32_t y) = 0;
99
100 /**
101 * @method getBitCount
102 * @brief returns color bitcount supported by this class
103 * @param -
104 * @return color bitcount supported by this class
105 * @globalvars none
106 * @exception none
107 * @conditions none
108 */
109 virtual uint32_t getBitCount() = 0;
110
111 /*
112 * TODO
113 */
114 virtual void getMaxColor(unsigned int *red, unsigned int *green, unsigned int *blue) = 0;
115
116 protected:
117 /* members */
118 /** pointer to CBitmap instance */
119 CBitmap *m_bitmap;
120};
121
122#endif
123
124/* vim: set et sw=2 ts=2: */