Viskores  1.0
exec/ColorTable.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_exec_ColorTable_h
19 #define viskores_exec_ColorTable_h
20 
21 #include <viskores/Types.h>
22 
23 namespace viskores
24 {
25 
26 enum struct ColorSpace
27 {
28  RGB,
29  HSV,
30  HSVWrap,
31  Lab,
32  Diverging
33 };
34 
35 } // namespace viskores
36 
37 namespace viskores
38 {
39 namespace exec
40 {
41 
42 class VISKORES_ALWAYS_EXPORT ColorTable
43 {
44 public:
45  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpace(viskores::Float64) const;
46 
47  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpace(const viskores::Vec3f_32& rgb1,
48  const viskores::Vec3f_32& rgb2,
49  viskores::Float32 weight) const;
50 
51  inline VISKORES_EXEC viskores::Float32 MapThroughOpacitySpace(viskores::Float64 value) const;
52 
54 
55  viskores::Float64 const* ColorNodes = nullptr;
56  viskores::Vec3f_32 const* RGB = nullptr;
57 
58  viskores::Float64 const* ONodes = nullptr;
59  viskores::Float32 const* Alpha = nullptr;
60  viskores::Vec2f_32 const* MidSharp = nullptr;
61 
62  viskores::Int32 ColorSize = 0;
63  viskores::Int32 OpacitySize = 0;
64 
65  viskores::Vec3f_32 NaNColor = { 0.5f, 0.0f, 0.0f };
66  viskores::Vec3f_32 BelowRangeColor = { 0.0f, 0.0f, 0.0f };
67  viskores::Vec3f_32 AboveRangeColor = { 0.0f, 0.0f, 0.0f };
68 
69  bool UseClamping = true;
70 
71 private:
72  inline VISKORES_EXEC void FindColors(viskores::Float64 value,
73  viskores::Vec3f_32& first,
74  viskores::Vec3f_32& second,
75  viskores::Float32& weight) const;
76 
77  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpaceRGB(const viskores::Vec3f_32& rgb1,
78  const viskores::Vec3f_32& rgb2,
79  viskores::Float32 weight) const;
80 
81  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpaceHSV(const viskores::Vec3f_32& rgb1,
82  const viskores::Vec3f_32& rgb2,
83  viskores::Float32 weight) const;
84 
85  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpaceHSVWrap(
86  const viskores::Vec3f_32& rgb1,
87  const viskores::Vec3f_32& rgb2,
88  viskores::Float32 weight) const;
89 
90  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpaceLab(const viskores::Vec3f_32& rgb1,
91  const viskores::Vec3f_32& rgb2,
92  viskores::Float32 weight) const;
93 
94  inline VISKORES_EXEC viskores::Vec3f_32 MapThroughColorSpaceDiverging(
95  const viskores::Vec3f_32& rgb1,
96  const viskores::Vec3f_32& rgb2,
97  viskores::Float32 weight) const;
98 };
99 
100 }
101 }
102 
103 #include <viskores/exec/ColorTable.hxx>
104 
105 #endif
viskores::ColorSpace::RGB
@ RGB
Types.h
viskores::ColorSpace::HSVWrap
@ HSVWrap
viskores::ColorSpace::Diverging
@ Diverging
viskores::ColorSpace::HSV
@ HSV
viskores::ColorSpace
ColorSpace
Definition: exec/ColorTable.h:26
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:189
viskores::ColorSpace::Lab
@ Lab
viskores::exec::ColorTable
Definition: exec/ColorTable.h:42
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::Vec< viskores::Float32, 3 >
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59
viskores::exec::ColorTable::Space
viskores::ColorSpace Space
Definition: exec/ColorTable.h:53