HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImathColor.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright Contributors to the OpenEXR Project.
4 //
5 
6 //
7 // 3-channel and 4-channel color representations
8 //
9 
10 #ifndef INCLUDED_IMATHCOLOR_H
11 #define INCLUDED_IMATHCOLOR_H
12 
13 #include "ImathExport.h"
14 #include "ImathNamespace.h"
15 
16 #include "ImathVec.h"
17 #include "half.h"
18 
19 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
20 
21 ///
22 /// 3-channel color class that inherits from Vec3.
23 ///
24 /// This class does not impose interpretation on the channels, which
25 /// can represent either rgb or hsv color values.
26 ///
27 /// Note: because Color3 inherits from Vec3, its member fields are
28 /// called `x`, `y`, and `z`.
29 
30 template <class T> class IMATH_EXPORT_TEMPLATE_TYPE Color3 : public Vec3<T>
31 {
32  public:
33 
34  /// @{
35  /// @name Constructors and Assignemt
36 
37  /// No initialization by default
39 
40  /// Initialize to (a a a)
41  IMATH_HOSTDEVICE constexpr explicit Color3 (T a) IMATH_NOEXCEPT;
42 
43  /// Initialize to (a b c)
44  IMATH_HOSTDEVICE constexpr Color3 (T a, T b, T c) IMATH_NOEXCEPT;
45 
46  /// Construct from Color3
47  IMATH_HOSTDEVICE constexpr Color3 (const Color3& c) IMATH_NOEXCEPT;
48 
49  /// Construct from Vec3
50  template <class S> IMATH_HOSTDEVICE constexpr Color3 (const Vec3<S>& v) IMATH_NOEXCEPT;
51 
52  /// Destructor
53  IMATH_HOSTDEVICE ~Color3() = default;
54 
55  /// Component-wise assignment
56  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator= (const Color3& c) IMATH_NOEXCEPT;
57 
58  /// @}
59 
60  /// @{
61  /// @name Arithmetic
62 
63  /// Component-wise addition
64  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator+= (const Color3& c) IMATH_NOEXCEPT;
65 
66  /// Component-wise addition
67  IMATH_HOSTDEVICE constexpr Color3 operator+ (const Color3& c) const IMATH_NOEXCEPT;
68 
69  /// Component-wise subtraction
70  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator-= (const Color3& c) IMATH_NOEXCEPT;
71 
72  /// Component-wise subtraction
73  IMATH_HOSTDEVICE constexpr Color3 operator- (const Color3& c) const IMATH_NOEXCEPT;
74 
75  /// Component-wise multiplication by -1
77 
78  /// Component-wise multiplication by -1
79  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& negate() IMATH_NOEXCEPT;
80 
81  /// Component-wise multiplication
82  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator*= (const Color3& c) IMATH_NOEXCEPT;
83 
84  /// Component-wise multiplication
85  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator*= (T a) IMATH_NOEXCEPT;
86 
87  /// Component-wise multiplication
88  IMATH_HOSTDEVICE constexpr Color3 operator* (const Color3& c) const IMATH_NOEXCEPT;
89 
90  /// Component-wise multiplication
92 
93  /// Component-wise division
94  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator/= (const Color3& c) IMATH_NOEXCEPT;
95 
96  /// Component-wise division
97  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator/= (T a) IMATH_NOEXCEPT;
98 
99  /// Component-wise division
100  IMATH_HOSTDEVICE constexpr Color3 operator/ (const Color3& c) const IMATH_NOEXCEPT;
101 
102  /// Component-wise division
103  IMATH_HOSTDEVICE constexpr Color3 operator/ (T a) const IMATH_NOEXCEPT;
104 
105  /// @}
106 };
107 
108 ///
109 /// A 4-channel color class: 3 channels plus alpha.
110 ///
111 /// For convenience, the fields are named `r`, `g`, and `b`, although
112 /// this class does not impose interpretation on the channels, which
113 /// can represent either rgb or hsv color values.
114 ///
115 
116 template <class T> class IMATH_EXPORT_TEMPLATE_TYPE Color4
117 {
118  public:
119 
120  /// @{
121  /// @name Direct access to elements
122 
123  T r, g, b, a;
124 
125  /// @}
126 
127  /// @{
128  /// @name Constructors and Assignment
129 
130  /// No initialization by default
132 
133  /// Initialize to `(a a a a)`
134  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Color4 (T a) IMATH_NOEXCEPT;
135 
136  /// Initialize to `(a b c d)`
137  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (T a, T b, T c, T d) IMATH_NOEXCEPT;
138 
139  /// Construct from Color4
140  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4& v) IMATH_NOEXCEPT;
141 
142  /// Construct from Color4
143  template <class S> IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4<S>& v) IMATH_NOEXCEPT;
144 
145  /// Destructor
146  IMATH_HOSTDEVICE ~Color4() = default;
147 
148  /// Assignment
149  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator= (const Color4& v) IMATH_NOEXCEPT;
150 
151  /// Component-wise value
152  IMATH_HOSTDEVICE T& operator[] (int i) IMATH_NOEXCEPT;
153 
154  /// Component-wise value
155  IMATH_HOSTDEVICE const T& operator[] (int i) const IMATH_NOEXCEPT;
156 
157  /// @}
158 
159  /// @{
160  /// @name Arithmetic and Comparison
161 
162  /// Equality
163  template <class S> IMATH_HOSTDEVICE constexpr bool operator== (const Color4<S>& v) const IMATH_NOEXCEPT;
164 
165  /// Inequality
166  template <class S> IMATH_HOSTDEVICE constexpr bool operator!= (const Color4<S>& v) const IMATH_NOEXCEPT;
167 
168  /// Component-wise addition
169  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator+= (const Color4& v) IMATH_NOEXCEPT;
170 
171  /// Component-wise addition
172  IMATH_HOSTDEVICE constexpr Color4 operator+ (const Color4& v) const IMATH_NOEXCEPT;
173 
174  /// Component-wise subtraction
175  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator-= (const Color4& v) IMATH_NOEXCEPT;
176 
177  /// Component-wise subtraction
178  IMATH_HOSTDEVICE constexpr Color4 operator- (const Color4& v) const IMATH_NOEXCEPT;
179 
180  /// Component-wise multiplication by -1
181  IMATH_HOSTDEVICE constexpr Color4 operator-() const IMATH_NOEXCEPT;
182 
183  /// Component-wise multiplication by -1
184  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& negate() IMATH_NOEXCEPT;
185 
186  /// Component-wise multiplication
187  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator*= (const Color4& v) IMATH_NOEXCEPT;
188 
189  /// Component-wise multiplication
190  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator*= (T a) IMATH_NOEXCEPT;
191 
192  /// Component-wise multiplication
193  IMATH_HOSTDEVICE constexpr Color4 operator* (const Color4& v) const IMATH_NOEXCEPT;
194 
195  /// Component-wise multiplication
196  IMATH_HOSTDEVICE constexpr Color4 operator* (T a) const IMATH_NOEXCEPT;
197 
198  /// Component-wise division
199  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator/= (const Color4& v) IMATH_NOEXCEPT;
200 
201  /// Component-wise division
202  IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator/= (T a) IMATH_NOEXCEPT;
203 
204  /// Component-wise division
205  IMATH_HOSTDEVICE constexpr Color4 operator/ (const Color4& v) const IMATH_NOEXCEPT;
206 
207  /// Component-wise division
208  IMATH_HOSTDEVICE constexpr Color4 operator/ (T a) const IMATH_NOEXCEPT;
209 
210  /// @}
211 
212  /// @{
213  /// @name Numeric Limits
214 
215  /// Number of dimensions (channels), i.e. 4 for a Color4
216  IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 4; }
217 
218  /// Largest possible negative value
219  IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits<T>::lowest(); }
220 
221  /// Largest possible positive value
223 
224  /// Smallest possible positive value
226 
227  /// Smallest possible e for which 1+e != 1
228  IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits<T>::epsilon(); }
229 
230  /// @}
231 
232  /// The base type: In templates that accept a parameter `V` (could
233  /// be a Color4), you can refer to `T` as `V::BaseType`
234  typedef T BaseType;
235 
236  /// @{
237  /// @name Compatibilty with Sb
238 
239  /// Set the value
240  template <class S> IMATH_HOSTDEVICE void setValue (S a, S b, S c, S d) IMATH_NOEXCEPT;
241 
242  /// Set the value
243  template <class S> IMATH_HOSTDEVICE void setValue (const Color4<S>& v) IMATH_NOEXCEPT;
244 
245  /// Return the value
246  template <class S> IMATH_HOSTDEVICE void getValue (S& a, S& b, S& c, S& d) const IMATH_NOEXCEPT;
247 
248  /// Return the value
249  template <class S> IMATH_HOSTDEVICE void getValue (Color4<S>& v) const IMATH_NOEXCEPT;
250 
251  /// Return raw pointer to the value
252  IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT;
253 
254  /// Return raw pointer to the value
256 
257  /// @}
258 };
259 
260 /// Stream output, as "(r g b a)"
261 template <class T> std::ostream& operator<< (std::ostream& s, const Color4<T>& v);
262 
263 /// Reverse multiplication: S * Color4
264 template <class S, class T>
265 IMATH_HOSTDEVICE constexpr Color4<T> operator* (S a, const Color4<T>& v) IMATH_NOEXCEPT;
266 
267 /// 3 float channels
268 typedef Color3<float> Color3f;
269 
270 /// 3 half channels
271 typedef Color3<half> Color3h;
272 
273 /// 3 8-bit integer channels
274 typedef Color3<unsigned char> Color3c;
275 
276 /// 3 half channels
277 typedef Color3<half> C3h;
278 
279 /// 3 float channels
280 typedef Color3<float> C3f;
281 
282 /// 3 8-bit integer channels
283 typedef Color3<unsigned char> C3c;
284 
285 /// 4 float channels
286 typedef Color4<float> Color4f;
287 
288 /// 4 half channels
289 typedef Color4<half> Color4h;
290 
291 /// 4 8-bit integer channels
292 typedef Color4<unsigned char> Color4c;
293 
294 /// 4 float channels
295 typedef Color4<float> C4f;
296 
297 /// 4 half channels
298 typedef Color4<half> C4h;
299 
300 /// 4 8-bit integer channels
301 typedef Color4<unsigned char> C4c;
302 
303 /// Packed 32-bit integer
304 typedef unsigned int PackedColor;
305 
306 //
307 // Implementation of Color3
308 //
309 
310 template <class T> IMATH_HOSTDEVICE inline Color3<T>::Color3() IMATH_NOEXCEPT : Vec3<T>()
311 {
312  // empty
313 }
314 
315 template <class T> IMATH_HOSTDEVICE constexpr inline Color3<T>::Color3 (T a) IMATH_NOEXCEPT : Vec3<T> (a)
316 {
317  // empty
318 }
319 
320 template <class T> IMATH_HOSTDEVICE constexpr inline Color3<T>::Color3 (T a, T b, T c) IMATH_NOEXCEPT : Vec3<T> (a, b, c)
321 {
322  // empty
323 }
324 
325 template <class T> IMATH_HOSTDEVICE constexpr inline Color3<T>::Color3 (const Color3& c) IMATH_NOEXCEPT : Vec3<T> (c)
326 {
327  // empty
328 }
329 
330 template <class T>
331 template <class S>
333 {
334  //empty
335 }
336 
337 template <class T>
338 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
340 {
341  *((Vec3<T>*) this) = c;
342  return *this;
343 }
344 
345 template <class T>
346 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
348 {
349  *((Vec3<T>*) this) += c;
350  return *this;
351 }
352 
353 template <class T>
354 IMATH_HOSTDEVICE constexpr inline Color3<T>
356 {
357  return Color3 (*(Vec3<T>*) this + (const Vec3<T>&) c);
358 }
359 
360 template <class T>
361 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
363 {
364  *((Vec3<T>*) this) -= c;
365  return *this;
366 }
367 
368 template <class T>
369 IMATH_HOSTDEVICE constexpr inline Color3<T>
371 {
372  return Color3 (*(Vec3<T>*) this - (const Vec3<T>&) c);
373 }
374 
375 template <class T>
376 IMATH_HOSTDEVICE constexpr inline Color3<T>
378 {
379  return Color3 (-(*(Vec3<T>*) this));
380 }
381 
382 template <class T>
383 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
385 {
386  ((Vec3<T>*) this)->negate();
387  return *this;
388 }
389 
390 template <class T>
391 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
393 {
394  *((Vec3<T>*) this) *= c;
395  return *this;
396 }
397 
398 template <class T>
399 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
401 {
402  *((Vec3<T>*) this) *= a;
403  return *this;
404 }
405 
406 template <class T>
407 IMATH_HOSTDEVICE constexpr inline Color3<T>
409 {
410  return Color3 (*(Vec3<T>*) this * (const Vec3<T>&) c);
411 }
412 
413 template <class T>
414 IMATH_HOSTDEVICE constexpr inline Color3<T>
416 {
417  return Color3 (*(Vec3<T>*) this * a);
418 }
419 
420 template <class T>
421 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
423 {
424  *((Vec3<T>*) this) /= c;
425  return *this;
426 }
427 
428 template <class T>
429 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3<T>&
431 {
432  *((Vec3<T>*) this) /= a;
433  return *this;
434 }
435 
436 template <class T>
437 IMATH_HOSTDEVICE constexpr inline Color3<T>
439 {
440  return Color3 (*(Vec3<T>*) this / (const Vec3<T>&) c);
441 }
442 
443 template <class T>
444 IMATH_HOSTDEVICE constexpr inline Color3<T>
446 {
447  return Color3 (*(Vec3<T>*) this / a);
448 }
449 
450 //
451 // Implementation of Color4
452 //
453 
454 template <class T>
455 IMATH_HOSTDEVICE inline T&
457 {
458  return (&r)[i];
459 }
460 
461 template <class T>
462 IMATH_HOSTDEVICE inline const T&
464 {
465  return (&r)[i];
466 }
467 
468 template <class T>
470 {
471  // empty
472 }
473 
474 template <class T>
476 {
477  r = g = b = a = x;
478 }
479 
480 template <class T>
481 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4<T>::Color4 (T x, T y, T z, T w) IMATH_NOEXCEPT
482 {
483  r = x;
484  g = y;
485  b = z;
486  a = w;
487 }
488 
489 template <class T>
490 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4<T>::Color4 (const Color4& v) IMATH_NOEXCEPT
491 {
492  r = v.r;
493  g = v.g;
494  b = v.b;
495  a = v.a;
496 }
497 
498 template <class T>
499 template <class S>
501 {
502  r = T (v.r);
503  g = T (v.g);
504  b = T (v.b);
505  a = T (v.a);
506 }
507 
508 template <class T>
509 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
511 {
512  r = v.r;
513  g = v.g;
514  b = v.b;
515  a = v.a;
516  return *this;
517 }
518 
519 template <class T>
520 template <class S>
521 IMATH_HOSTDEVICE inline void
523 {
524  r = T (x);
525  g = T (y);
526  b = T (z);
527  a = T (w);
528 }
529 
530 template <class T>
531 template <class S>
532 IMATH_HOSTDEVICE inline void
534 {
535  r = T (v.r);
536  g = T (v.g);
537  b = T (v.b);
538  a = T (v.a);
539 }
540 
541 template <class T>
542 template <class S>
543 IMATH_HOSTDEVICE inline void
545 {
546  x = S (r);
547  y = S (g);
548  z = S (b);
549  w = S (a);
550 }
551 
552 template <class T>
553 template <class S>
554 IMATH_HOSTDEVICE inline void
556 {
557  v.r = S (r);
558  v.g = S (g);
559  v.b = S (b);
560  v.a = S (a);
561 }
562 
563 template <class T>
564 IMATH_HOSTDEVICE inline T*
566 {
567  return (T*) &r;
568 }
569 
570 template <class T>
571 IMATH_HOSTDEVICE inline const T*
573 {
574  return (const T*) &r;
575 }
576 
577 template <class T>
578 template <class S>
579 IMATH_HOSTDEVICE constexpr inline bool
581 {
582  return r == v.r && g == v.g && b == v.b && a == v.a;
583 }
584 
585 template <class T>
586 template <class S>
587 IMATH_HOSTDEVICE constexpr inline bool
589 {
590  return r != v.r || g != v.g || b != v.b || a != v.a;
591 }
592 
593 template <class T>
594 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
596 {
597  r += v.r;
598  g += v.g;
599  b += v.b;
600  a += v.a;
601  return *this;
602 }
603 
604 template <class T>
605 IMATH_HOSTDEVICE constexpr inline Color4<T>
607 {
608  return Color4 (r + v.r, g + v.g, b + v.b, a + v.a);
609 }
610 
611 template <class T>
612 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
614 {
615  r -= v.r;
616  g -= v.g;
617  b -= v.b;
618  a -= v.a;
619  return *this;
620 }
621 
622 template <class T>
623 IMATH_HOSTDEVICE constexpr inline Color4<T>
625 {
626  return Color4 (r - v.r, g - v.g, b - v.b, a - v.a);
627 }
628 
629 template <class T>
630 IMATH_HOSTDEVICE constexpr inline Color4<T>
632 {
633  return Color4 (-r, -g, -b, -a);
634 }
635 
636 template <class T>
637 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
639 {
640  r = -r;
641  g = -g;
642  b = -b;
643  a = -a;
644  return *this;
645 }
646 
647 template <class T>
648 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
650 {
651  r *= v.r;
652  g *= v.g;
653  b *= v.b;
654  a *= v.a;
655  return *this;
656 }
657 
658 template <class T>
659 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
661 {
662  r *= x;
663  g *= x;
664  b *= x;
665  a *= x;
666  return *this;
667 }
668 
669 template <class T>
670 IMATH_HOSTDEVICE constexpr inline Color4<T>
672 {
673  return Color4 (r * v.r, g * v.g, b * v.b, a * v.a);
674 }
675 
676 template <class T>
677 IMATH_HOSTDEVICE constexpr inline Color4<T>
679 {
680  return Color4 (r * x, g * x, b * x, a * x);
681 }
682 
683 template <class T>
684 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
686 {
687  r /= v.r;
688  g /= v.g;
689  b /= v.b;
690  a /= v.a;
691  return *this;
692 }
693 
694 template <class T>
695 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4<T>&
697 {
698  r /= x;
699  g /= x;
700  b /= x;
701  a /= x;
702  return *this;
703 }
704 
705 template <class T>
706 IMATH_HOSTDEVICE constexpr inline Color4<T>
708 {
709  return Color4 (r / v.r, g / v.g, b / v.b, a / v.a);
710 }
711 
712 template <class T>
713 IMATH_HOSTDEVICE constexpr inline Color4<T>
715 {
716  return Color4 (r / x, g / x, b / x, a / x);
717 }
718 
719 template <class T>
720 std::ostream&
721 operator<< (std::ostream& s, const Color4<T>& v)
722 {
723  return s << '(' << v.r << ' ' << v.g << ' ' << v.b << ' ' << v.a << ')';
724 }
725 
726 //
727 // Implementation of reverse multiplication
728 //
729 
730 template <class S, class T>
731 IMATH_HOSTDEVICE constexpr inline Color4<T>
733 {
734  return Color4<T> (x * v.r, x * v.g, x * v.b, x * v.a);
735 }
736 
737 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
738 
739 #endif // INCLUDED_IMATHCOLOR_H
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4 & operator*=(const Color4 &v) IMATH_NOEXCEPT
Component-wise multiplication.
Definition: ImathColor.h:649
IMATH_HOSTDEVICE void setValue(S a, S b, S c, S d) IMATH_NOEXCEPT
Set the value.
Definition: ImathColor.h:522
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4 & operator=(const Color4 &v) IMATH_NOEXCEPT
Assignment.
Definition: ImathColor.h:510
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
Definition: ImathColor.h:225
#define IMATH_NOEXCEPT
Definition: ImathConfig.h:72
IMATH_HOSTDEVICE static constexpr T baseTypeLowest() IMATH_NOEXCEPT
Largest possible negative value.
Definition: ImathColor.h:219
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3 & operator=(const Color3 &c) IMATH_NOEXCEPT
Component-wise assignment.
Definition: ImathColor.h:339
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3 & operator+=(const Color3 &c) IMATH_NOEXCEPT
Component-wise addition.
Definition: ImathColor.h:347
Definition: ImathVec.h:32
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:623
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition: half.h:266
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return raw pointer to the value.
Definition: ImathColor.h:565
const GLdouble * v
Definition: glcorearb.h:837
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
GLboolean GLboolean g
Definition: glcorearb.h:1222
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator*=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise multiplication.
Definition: ImathVec.h:1634
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
GLdouble s
Definition: glad.h:3009
unsigned int PackedColor
Packed 32-bit integer.
Definition: ImathColor.h:304
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
Definition: ImathColor.h:384
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLint y
Definition: glcorearb.h:103
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator+=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise addition.
Definition: ImathVec.h:1583
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
Definition: ImathColor.h:222
#define IMATH_HOSTDEVICE
Definition: ImathConfig.h:102
IMATH_HOSTDEVICE constexpr bool operator==(const Color4< S > &v) const IMATH_NOEXCEPT
Equality.
Definition: ImathColor.h:580
IMATH_HOSTDEVICE constexpr Vec3 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
Definition: ImathVec.h:1617
IMATH_HOSTDEVICE constexpr Color3 operator+(const Color3 &c) const IMATH_NOEXCEPT
Component-wise addition.
Definition: ImathColor.h:355
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3 & operator*=(const Color3 &c) IMATH_NOEXCEPT
Component-wise multiplication.
Definition: ImathColor.h:392
IMATH_HOSTDEVICE Color3() IMATH_NOEXCEPT
No initialization by default.
Definition: ImathColor.h:310
IMATH_HOSTDEVICE constexpr bool operator!=(const Color4< S > &v) const IMATH_NOEXCEPT
Inequality.
Definition: ImathColor.h:588
IMATH_HOSTDEVICE constexpr Color3 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
Definition: ImathColor.h:377
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4 & operator+=(const Color4 &v) IMATH_NOEXCEPT
Component-wise addition.
Definition: ImathColor.h:595
IMATH_HOSTDEVICE constexpr Color3 operator*(const Color3 &c) const IMATH_NOEXCEPT
Component-wise multiplication.
Definition: ImathColor.h:408
IMATH_HOSTDEVICE T & operator[](int i) IMATH_NOEXCEPT
Component-wise value.
Definition: ImathColor.h:456
IMATH_HOSTDEVICE constexpr Vec3 operator+(const Vec3 &v) const IMATH_NOEXCEPT
Component-wise addition.
Definition: ImathVec.h:1593
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4 & operator-=(const Color4 &v) IMATH_NOEXCEPT
Component-wise subtraction.
Definition: ImathColor.h:613
IMATH_HOSTDEVICE constexpr Color4< T > operator*(S a, const Color4< T > &v) IMATH_NOEXCEPT
Reverse multiplication: S * Color4.
Definition: ImathColor.h:732
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
Definition: ImathVec.h:1624
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLint GLenum GLint x
Definition: glcorearb.h:409
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
Definition: ImathColor.h:228
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3 & operator/=(const Color3 &c) IMATH_NOEXCEPT
Component-wise division.
Definition: ImathColor.h:422
IMATH_HOSTDEVICE constexpr Color4 operator*(const Color4 &v) const IMATH_NOEXCEPT
Component-wise multiplication.
Definition: ImathColor.h:671
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
Definition: ImathColor.h:638
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator-=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise subtraction.
Definition: ImathVec.h:1600
T BaseType
Definition: ImathColor.h:234
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4 & operator/=(const Color4 &v) IMATH_NOEXCEPT
Component-wise division.
Definition: ImathColor.h:685
IMATH_HOSTDEVICE constexpr Color4 operator+(const Color4 &v) const IMATH_NOEXCEPT
Component-wise addition.
Definition: ImathColor.h:606
#define IMATH_EXPORT_TEMPLATE_TYPE
Definition: ImathExport.h:60
IMATH_HOSTDEVICE constexpr Color3 operator/(const Color3 &c) const IMATH_NOEXCEPT
Component-wise division.
Definition: ImathColor.h:438
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
IMATH_HOSTDEVICE Color4() IMATH_NOEXCEPT
No initialization by default.
Definition: ImathColor.h:469
GLboolean r
Definition: glcorearb.h:1222
#define const
Definition: zconf.h:214
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator=(const Vec3 &v) IMATH_NOEXCEPT
Assignment.
Definition: ImathVec.h:1410
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3 & operator-=(const Color3 &c) IMATH_NOEXCEPT
Component-wise subtraction.
Definition: ImathColor.h:362
IMATH_HOSTDEVICE constexpr Color4 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
Definition: ImathColor.h:631
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator/=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise division.
Definition: ImathVec.h:1668
IMATH_HOSTDEVICE constexpr Vec3 operator*(const Vec3 &v) const IMATH_NOEXCEPT
Component-wise multiplication.
Definition: ImathVec.h:1654
IMATH_HOSTDEVICE constexpr Vec3 operator/(const Vec3 &v) const IMATH_NOEXCEPT
Component-wise division.
Definition: ImathVec.h:1688
IMATH_HOSTDEVICE constexpr Color4 operator/(const Color4 &v) const IMATH_NOEXCEPT
Component-wise division.
Definition: ImathColor.h:707