The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cEvalueSimpleRGBA255.h
Go to the documentation of this file.
1 /**
2  * @class cEvalueSimpleRGBA255
3  * file name: cEvalueSimpleRGBA255.h
4  * @author Betti Oesterholz
5  * @date 18.03.2012
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This file contains the class for evaluing Fib objects as a matrix of
11  * a RGBA image.
12  * Copyright (C) @c LGPL3 2012 Betti Oesterholz
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License (LGPL) as
16  * published by the Free Software Foundation, either version 3 of the
17  * License, or any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  *
28  * This file contains the class for evaluing Fib objects as a matrix of
29  * a RGBA image. @see pImageData
30  * Just colors and transparency is evalued. The data is stored into an
31  * array. The array is two dimensional and goes in the first dimension
32  * from 0 to uiMaxX and in the second from 0 to uiMaxY. Every entry of the
33  * array consists of tree values with 8 bit each (values from 0 to 255).
34  * This class should keep the evaluing of a normal image (e.g. Bitmap image)
35  * as simple as possible.
36  */
37 /*
38 History:
39 18.03.2012 Oesterholz created
40 10.04.2012 Oesterholz methods of interface iImageData added
41 */
42 
43 #ifndef ___C_EVALUE_SIMPLE_RGBA_255__
44 #define ___C_EVALUE_SIMPLE_RGBA_255__
45 
46 #include "version.h"
47 
48 #include "iEvaluePosition.h"
49 #include "iImageData.h"
50 
51 #include "cVectorPosition.h"
52 #include "cVectorProperty.h"
53 
54 
55 #include <list>
56 
57 
58 
59 using std::list;
60 
61 namespace fib{
62 
64 public:
65 
66  /**
67  * The maximum value for the first (x) dimension.
68  * (The number of point rows.)
69  */
70  const unsigned int uiMaxX;
71 
72  /**
73  * The maximum value for the second (y) dimension.
74  * (The number of point lines.)
75  */
76  const unsigned int uiMaxY;
77 
78  /**
79  * The matrix with the ARGB image data.
80  * The dimension entries are:
81  * - first dimension (x)
82  * - second dimension (y)
83  * - value: alpha (transparency), red, green, blue
84  * wher 0 is the minimum (e.g. no green) and 255 the maximum (e.g.
85  * full red), the color values are non-premultiplied;
86  * for the alpha value @see http://en.wikipedia.org/wiki/Alpha_compositing
87  * (0 = total transparent, 255 = total opaque)
88  *
89  * The pointer will point to an one dimensional array. You have to evalue
90  * the single entries by hand (with: *(pImageData + (x * uiMaxY + y) * 4) )
91  */
92  unsigned char * pImageData;
93 
94  /**
95  * The ARGB value for the background color.
96  * value: alpha (transparency), red, green, blue
97  * wher 0 is the minimum (e.g. no green) and 255 the maximum (e.g.
98  * full red), the color values are non-premultiplied;
99  * for the alpha value @see http://en.wikipedia.org/wiki/Alpha_compositing
100  * (0 = total transparent, 255 = total opaque)
101  */
102  unsigned char pBackgroundColor[ 4 ];
103 
104  /**
105  * If true a background color was set.
106  */
108 
109  /**
110  * standard constructor
111  *
112  * @param uiInMaxX the maximum value for the first (x) dimension @see uiMaxX
113  * @param uiInMaxY the maximum value for the second (y) dimension @see uiMaxY
114  */
115  cEvalueSimpleRGBA255( const unsigned int uiInMaxX, const unsigned int uiInMaxY );
116 
117  /**
118  * desstructor
119  */
121 
122  /**
123  * The method with wich the evalued points with ther properties are
124  * inserted. Everytime a point (to evalue) is reached in the
125  * evaluation, this method is called with the position and the
126  * properties of the point and stores the data into @see pImageData
127  * This method will just evalue two dimensional points and properties
128  * for RGB and transparency.
129  * Points first dimension can have values from 0 ( including ) to the
130  * maximum value for the first (x) dimension.
131  * ( 0 =< vPosition.getValue( 1 ) < uiMaxX ) @see uiMaxX
132  * Points second dimension ( vPosition.getValue( 2 ) ) can have values
133  * from 0 ( including ) to the maximum value for the second (y) dimension.
134  * ( 0 =< vPosition.getValue( 2 ) < uiMaxY ) @see uiMaxY
135  * Background points (with 0 elements) are also possible.
136  * All other points will be discarded.
137  * Property (color RGB or transparency) element values should have a
138  * values from 0 to 255 (both including), else they will be rounded
139  * into the area.
140  *
141  * @see pImageData
142  * @param vPosition the position of the point, which is evalued
143  * @param vProperties a list of the properties of the point
144  */
145  virtual bool evaluePosition( const cVectorPosition & vPosition,
146  const list<cVectorProperty> & vProperties );
147 
148  /**
149  * This method clears the data from the list with the evalued position data
150  * liEvaluedPositionData.
151  * After the function call the liEvaluedPositionData list will be empty.
152  *
153  * @see liEvaluedPositionData
154  */
155  virtual void clear();
156 
157  /**
158  * Adds the background color pBackgroundColor to the image data matrix
159  * pImageData, if existing.
160  *
161  * @see pBackgroundColor
162  * @see pImageData
163  * @return true if the background color was added the image data matrix,
164  * else false
165  */
167 
168 
169 //methods of interface iImageData:
170 
171  /**
172  * This method returns the domains for the color and transparency properties.
173  *
174  * @return the domains for the color and transparency properties
175  */
176  virtual cDomains getPropertyDomains() const;
177 
178  /**
179  * This method returns the domains for the positions (dimension domain).
180  *
181  * @return the domains for the positions (dimension domain)
182  */
183  virtual cDomains getPositionDomain() const;
184 
185  /**
186  * With this method the properties for a points are set.
187  *
188  * @param vPosition the position of the point to set
189  * @param vProperties a list of the properties of the point
190  * @return true if the properties for the point cold be set, else false
191  */
192  virtual bool setPoint( const cVectorPosition & vPosition,
193  const list<cVectorProperty> & vProperties );
194 
195  /**
196  * With this method the properties for given points are returned.
197  *
198  * @param vPosition the position of the point, for which the properties
199  * should be returned
200  * @return a list of the properties of the point
201  */
202  virtual list<cVectorProperty> getPointProperties(
203  const cVectorPosition & vPosition ) const;
204 
205 
206 };//class cEvalueSimpleRGBA255
207 
208 };
209 
210 #endif
211 
212