0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
[occt.git] / src / Image / Image_Color.hxx
CommitLineData
6aca4d39 1// Created on: 2012-07-18
692613e5 2// Created by: Kirill GAVRILOV
6aca4d39 3// Copyright (c) 2012-2014 OPEN CASCADE SAS
692613e5 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
692613e5 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
692613e5 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
692613e5 15
16#ifndef _Image_Color_H__
17#define _Image_Color_H__
18
19#include <Standard.hxx>
20
21//! POD structure for packed RGB color value (3 bytes)
22struct Image_ColorRGB
23{
24
9786a9af 25 //! Component type.
26 typedef Standard_Byte ComponentType_t;
27
692613e5 28 //! Returns the number of components.
29 static Standard_Integer Length()
30 {
31 return 3;
32 }
33
34public: // access methods
35
36 //! Alias to 1st component (red intensity).
37 Standard_Byte r() const { return v[0]; }
38
39 //! Alias to 2nd component (green intensity).
40 Standard_Byte g() const { return v[1]; }
41
42 //! Alias to 3rd component (blue intensity).
43 Standard_Byte b() const { return v[2]; }
44
45 //! Alias to 1st component (red intensity).
46 Standard_Byte& r() { return v[0]; }
47
48 //! Alias to 2nd component (green intensity).
49 Standard_Byte& g() { return v[1]; }
50
51 //! Alias to 3rd component (blue intensity).
52 Standard_Byte& b() { return v[2]; }
53
54public:
55
56 Standard_Byte v[3];
57
58};
59
60//! POD structure for packed RGB color value (4 bytes with extra byte for alignment)
61struct Image_ColorRGB32
62{
63
9786a9af 64 //! Component type.
65 typedef Standard_Byte ComponentType_t;
66
692613e5 67 //! Returns the number of components.
68 static Standard_Integer Length()
69 {
70 return 3;
71 }
72
73 //! Alias to 1st component (red intensity).
74 Standard_Byte r() const { return v[0]; }
75
76 //! Alias to 2nd component (green intensity).
77 Standard_Byte g() const { return v[1]; }
78
79 //! Alias to 3rd component (blue intensity).
80 Standard_Byte b() const { return v[2]; }
81
82 //! Alias to 4th component (dummy).
83 Standard_Byte a_() const { return v[3]; }
84
85 //! Alias to 1st component (red intensity).
86 Standard_Byte& r() { return v[0]; }
87
88 //! Alias to 2nd component (green intensity).
89 Standard_Byte& g() { return v[1]; }
90
91 //! Alias to 3rd component (blue intensity).
92 Standard_Byte& b() { return v[2]; }
93
94 //! Alias to 4th component (dummy).
95 Standard_Byte& a_() { return v[3]; }
96
97public:
98
99 Standard_Byte v[4];
100
101};
102
103//! POD structure for packed RGBA color value (4 bytes)
104struct Image_ColorRGBA
105{
106
9786a9af 107 //! Component type.
108 typedef Standard_Byte ComponentType_t;
109
692613e5 110 //! Returns the number of components.
111 static Standard_Integer Length()
112 {
113 return 4;
114 }
115
116 //! Alias to 1st component (red intensity).
117 Standard_Byte r() const { return v[0]; }
118
119 //! Alias to 2nd component (green intensity).
120 Standard_Byte g() const { return v[1]; }
121
122 //! Alias to 3rd component (blue intensity).
123 Standard_Byte b() const { return v[2]; }
124
125 //! Alias to 4th component (alpha value).
126 Standard_Byte a() const { return v[3]; }
127
128 //! Alias to 1st component (red intensity).
129 Standard_Byte& r() { return v[0]; }
130
131 //! Alias to 2nd component (green intensity).
132 Standard_Byte& g() { return v[1]; }
133
134 //! Alias to 3rd component (blue intensity).
135 Standard_Byte& b() { return v[2]; }
136
137 //! Alias to 4th component (alpha value).
138 Standard_Byte& a() { return v[3]; }
139
140public:
141
142 Standard_Byte v[4];
143
144};
145
146//! POD structure for packed BGR color value (3 bytes)
147struct Image_ColorBGR
148{
149
9786a9af 150 //! Component type.
151 typedef Standard_Byte ComponentType_t;
152
692613e5 153 //! Returns the number of components.
154 static Standard_Integer Length()
155 {
156 return 3;
157 }
158
159 //! Alias to 3rd component (red intensity).
160 Standard_Byte r() const { return v[2]; }
161
162 //! Alias to 2nd component (green intensity).
163 Standard_Byte g() const { return v[1]; }
164
165 //! Alias to 1st component (blue intensity).
166 Standard_Byte b() const { return v[0]; }
167
168 //! Alias to 3rd component (red intensity).
169 Standard_Byte& r() { return v[2]; }
170
171 //! Alias to 2nd component (green intensity).
172 Standard_Byte& g() { return v[1]; }
173
174 //! Alias to 1st component (blue intensity).
175 Standard_Byte& b() { return v[0]; }
176
177public:
178
179 Standard_Byte v[3];
180
181};
182
183//! POD structure for packed BGR color value (4 bytes with extra byte for alignment)
184struct Image_ColorBGR32
185{
186
9786a9af 187 //! Component type.
188 typedef Standard_Byte ComponentType_t;
189
692613e5 190 //! Returns the number of components.
191 static Standard_Integer Length()
192 {
193 return 3;
194 }
195
196 //! Alias to 3rd component (red intensity).
197 Standard_Byte r() const { return v[2]; }
198
199 //! Alias to 2nd component (green intensity).
200 Standard_Byte g() const { return v[1]; }
201
202 //! Alias to 1st component (blue intensity).
203 Standard_Byte b() const { return v[0]; }
204
205 //! Alias to 4th component (dummy).
206 Standard_Byte a_() const { return v[3]; }
207
208 //! Alias to 3rd component (red intensity).
209 Standard_Byte& r() { return v[2]; }
210
211 //! Alias to 2nd component (green intensity).
212 Standard_Byte& g() { return v[1]; }
213
214 //! Alias to 1st component (blue intensity).
215 Standard_Byte& b() { return v[0]; }
216
217 //! Alias to 4th component (dummy).
218 Standard_Byte& a_() { return v[3]; }
219
220public:
221
222 Standard_Byte v[4];
223
224};
225
226//! POD structure for packed BGRA color value (4 bytes)
227struct Image_ColorBGRA
228{
229
9786a9af 230 //! Component type.
231 typedef Standard_Byte ComponentType_t;
232
692613e5 233 //! Returns the number of components.
234 static Standard_Integer Length()
235 {
236 return 4;
237 }
238
239 //! Alias to 3rd component (red intensity).
240 Standard_Byte r() const { return v[2]; }
241
242 //! Alias to 2nd component (green intensity).
243 Standard_Byte g() const { return v[1]; }
244
245 //! Alias to 1st component (blue intensity).
246 Standard_Byte b() const { return v[0]; }
247
248 //! Alias to 4th component (alpha value).
249 Standard_Byte a() const { return v[3]; }
250
251 //! Alias to 3rd component (red intensity).
252 Standard_Byte& r() { return v[2]; }
253
254 //! Alias to 2nd component (green intensity).
255 Standard_Byte& g() { return v[1]; }
256
257 //! Alias to 1st component (blue intensity).
258 Standard_Byte& b() { return v[0]; }
259
260 //! Alias to 4th component (alpha value).
261 Standard_Byte& a() { return v[3]; }
262
263public:
264
265 Standard_Byte v[4];
266
267};
268
67312b79 269//! POD structure for packed float RG color value (2 floats)
270struct Image_ColorRGF
271{
272 //! Component type.
273 typedef Standard_ShortReal ComponentType_t;
274
275 //! Returns the number of components.
276 static Standard_Integer Length() { return 2; }
277
278 //! Alias to 1st component (red intensity).
279 Standard_ShortReal r() const { return v[0]; }
280
281 //! Alias to 2nd component (green intensity).
282 Standard_ShortReal g() const { return v[1]; }
283
284 //! Alias to 1st component (red intensity).
285 Standard_ShortReal& r() { return v[0]; }
286
287 //! Alias to 2nd component (green intensity).
288 Standard_ShortReal& g() { return v[1]; }
289
290public:
291 Standard_ShortReal v[2];
292};
293
692613e5 294//! POD structure for packed float RGB color value (3 floats)
295struct Image_ColorRGBF
296{
297
9786a9af 298 //! Component type.
299 typedef Standard_ShortReal ComponentType_t;
300
692613e5 301 //! Returns the number of components.
302 static Standard_Integer Length()
303 {
304 return 3;
305 }
306
307 //! Alias to 1st component (red intensity).
308 Standard_ShortReal r() const { return v[0]; }
309
310 //! Alias to 2nd component (green intensity).
311 Standard_ShortReal g() const { return v[1]; }
312
313 //! Alias to 3rd component (blue intensity).
314 Standard_ShortReal b() const { return v[2]; }
315
316 //! Alias to 1st component (red intensity).
317 Standard_ShortReal& r() { return v[0]; }
318
319 //! Alias to 2nd component (green intensity).
320 Standard_ShortReal& g() { return v[1]; }
321
322 //! Alias to 3rd component (blue intensity).
323 Standard_ShortReal& b() { return v[2]; }
324
325public:
326
327 Standard_ShortReal v[3];
328
329};
330
331//! POD structure for packed BGR float color value (3 floats)
332struct Image_ColorBGRF
333{
334
9786a9af 335 //! Component type.
336 typedef Standard_ShortReal ComponentType_t;
337
692613e5 338 //! Returns the number of components.
339 static Standard_Integer Length()
340 {
341 return 3;
342 }
343
344 //! Alias to 3rd component (red intensity).
345 Standard_ShortReal r() const { return v[2]; }
346
347 //! Alias to 2nd component (green intensity).
348 Standard_ShortReal g() const { return v[1]; }
349
350 //! Alias to 1st component (blue intensity).
351 Standard_ShortReal b() const { return v[0]; }
352
353 //! Alias to 3rd component (red intensity).
354 Standard_ShortReal& r() { return v[2]; }
355
356 //! Alias to 2nd component (green intensity).
357 Standard_ShortReal& g() { return v[1]; }
358
359 //! Alias to 1st component (blue intensity).
360 Standard_ShortReal& b() { return v[0]; }
361
362public:
363
364 Standard_ShortReal v[3];
365
366};
367
368//! POD structure for packed RGBA color value (4 floats)
369struct Image_ColorRGBAF
370{
371
9786a9af 372 //! Component type.
373 typedef Standard_ShortReal ComponentType_t;
374
692613e5 375 //! Returns the number of components.
376 static Standard_Integer Length()
377 {
378 return 4;
379 }
380
381 //! Alias to 1st component (red intensity).
382 Standard_ShortReal r() const { return v[0]; }
383
384 //! Alias to 2nd component (green intensity).
385 Standard_ShortReal g() const { return v[1]; }
386
387 //! Alias to 3rd component (blue intensity).
388 Standard_ShortReal b() const { return v[2]; }
389
390 //! Alias to 4th component (alpha value).
391 Standard_ShortReal a() const { return v[3]; }
392
393 //! Alias to 1st component (red intensity).
394 Standard_ShortReal& r() { return v[0]; }
395
396 //! Alias to 2nd component (green intensity).
397 Standard_ShortReal& g() { return v[1]; }
398
399 //! Alias to 3rd component (blue intensity).
400 Standard_ShortReal& b() { return v[2]; }
401
402 //! Alias to 4th component (alpha value).
403 Standard_ShortReal& a() { return v[3]; }
404
405public:
406
407 Standard_ShortReal v[4];
408
409};
410
411//! POD structure for packed float BGRA color value (4 floats)
412struct Image_ColorBGRAF
413{
414
9786a9af 415 //! Component type.
416 typedef Standard_ShortReal ComponentType_t;
417
692613e5 418 //! Returns the number of components.
419 static Standard_Integer Length()
420 {
421 return 4;
422 }
423
424 //! Alias to 3rd component (red intensity).
425 Standard_ShortReal r() const { return v[2]; }
426
427 //! Alias to 2nd component (green intensity).
428 Standard_ShortReal g() const { return v[1]; }
429
430 //! Alias to 1st component (blue intensity).
431 Standard_ShortReal b() const { return v[0]; }
432
433 //! Alias to 4th component (alpha value).
434 Standard_ShortReal a() const { return v[3]; }
435
436 //! Alias to 3rd component (red intensity).
437 Standard_ShortReal& r() { return v[2]; }
438
439 //! Alias to 2nd component (green intensity).
440 Standard_ShortReal& g() { return v[1]; }
441
442 //! Alias to 1st component (blue intensity).
443 Standard_ShortReal& b() { return v[0]; }
444
445 //! Alias to 4th component (alpha value).
446 Standard_ShortReal& a() { return v[3]; }
447
448public:
449
450 Standard_ShortReal v[4];
451
452};
453
692613e5 454#endif // _Image_Color_H__