VTK-m  2.0
exec/ColorTable.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_exec_ColorTable_h
11 #define vtk_m_exec_ColorTable_h
12 
13 #include <vtkm/Types.h>
14 
15 namespace vtkm
16 {
17 
18 enum struct ColorSpace
19 {
20  RGB,
21  HSV,
22  HSVWrap,
23  Lab,
24  Diverging
25 };
26 
27 } // namespace vtkm
28 
29 namespace vtkm
30 {
31 namespace exec
32 {
33 
35 {
36 public:
37  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpace(vtkm::Float64) const;
38 
39  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpace(const vtkm::Vec3f_32& rgb1,
40  const vtkm::Vec3f_32& rgb2,
41  vtkm::Float32 weight) const;
42 
43  inline VTKM_EXEC vtkm::Float32 MapThroughOpacitySpace(vtkm::Float64 value) const;
44 
46 
47  vtkm::Float64 const* ColorNodes = nullptr;
48  vtkm::Vec3f_32 const* RGB = nullptr;
49 
50  vtkm::Float64 const* ONodes = nullptr;
51  vtkm::Float32 const* Alpha = nullptr;
52  vtkm::Vec2f_32 const* MidSharp = nullptr;
53 
54  vtkm::Int32 ColorSize = 0;
55  vtkm::Int32 OpacitySize = 0;
56 
57  vtkm::Vec3f_32 NaNColor = { 0.5f, 0.0f, 0.0f };
58  vtkm::Vec3f_32 BelowRangeColor = { 0.0f, 0.0f, 0.0f };
59  vtkm::Vec3f_32 AboveRangeColor = { 0.0f, 0.0f, 0.0f };
60 
61  bool UseClamping = true;
62 
63 private:
64  inline VTKM_EXEC void FindColors(vtkm::Float64 value,
65  vtkm::Vec3f_32& first,
66  vtkm::Vec3f_32& second,
67  vtkm::Float32& weight) const;
68 
69  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceRGB(const vtkm::Vec3f_32& rgb1,
70  const vtkm::Vec3f_32& rgb2,
71  vtkm::Float32 weight) const;
72 
73  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceHSV(const vtkm::Vec3f_32& rgb1,
74  const vtkm::Vec3f_32& rgb2,
75  vtkm::Float32 weight) const;
76 
77  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceHSVWrap(const vtkm::Vec3f_32& rgb1,
78  const vtkm::Vec3f_32& rgb2,
79  vtkm::Float32 weight) const;
80 
81  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceLab(const vtkm::Vec3f_32& rgb1,
82  const vtkm::Vec3f_32& rgb2,
83  vtkm::Float32 weight) const;
84 
85  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceDiverging(const vtkm::Vec3f_32& rgb1,
86  const vtkm::Vec3f_32& rgb2,
87  vtkm::Float32 weight) const;
88 };
89 
90 }
91 }
92 
93 #include <vtkm/exec/ColorTable.hxx>
94 
95 #endif
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::exec::ColorTable::Space
vtkm::ColorSpace Space
Definition: exec/ColorTable.h:45
Types.h
vtkm::ColorSpace::Diverging
@ Diverging
vtkm::ColorSpace::RGB
@ RGB
vtkm::ColorSpace::HSVWrap
@ HSVWrap
vtkm::exec::ColorTable
Definition: exec/ColorTable.h:34
vtkm::Vec< vtkm::Float32, 3 >
vtkm::Float32
float Float32
Definition: Types.h:154
vtkm::Int32
int32_t Int32
Definition: Types.h:160
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::ColorSpace::HSV
@ HSV
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
vtkm::ColorSpace::Lab
@ Lab
vtkm::ColorSpace
ColorSpace
Definition: exec/ColorTable.h:18