VTK-m  1.6
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/Deprecated.h>
14 #include <vtkm/Types.h>
15 
16 namespace vtkm
17 {
18 
19 enum struct ColorSpace
20 {
21  RGB,
22  HSV,
23  HSVWrap,
24  Lab,
25  Diverging
26 };
27 
28 } // namespace vtkm
29 
30 namespace vtkm
31 {
32 namespace exec
33 {
34 
36 {
37 public:
38  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpace(vtkm::Float64) const;
39 
40  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpace(const vtkm::Vec3f_32& rgb1,
41  const vtkm::Vec3f_32& rgb2,
42  vtkm::Float32 weight) const;
43 
44  inline VTKM_EXEC vtkm::Float32 MapThroughOpacitySpace(vtkm::Float64 value) const;
45 
47 
48  vtkm::Float64 const* ColorNodes = nullptr;
49  vtkm::Vec3f_32 const* RGB = nullptr;
50 
51  vtkm::Float64 const* ONodes = nullptr;
52  vtkm::Float32 const* Alpha = nullptr;
53  vtkm::Vec2f_32 const* MidSharp = nullptr;
54 
55  vtkm::Int32 ColorSize = 0;
56  vtkm::Int32 OpacitySize = 0;
57 
58  vtkm::Vec3f_32 NaNColor = { 0.5f, 0.0f, 0.0f };
59  vtkm::Vec3f_32 BelowRangeColor = { 0.0f, 0.0f, 0.0f };
60  vtkm::Vec3f_32 AboveRangeColor = { 0.0f, 0.0f, 0.0f };
61 
62  bool UseClamping = true;
63 
64 private:
65  inline VTKM_EXEC void FindColors(vtkm::Float64 value,
66  vtkm::Vec3f_32& first,
67  vtkm::Vec3f_32& second,
68  vtkm::Float32& weight) const;
69 
70  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceRGB(const vtkm::Vec3f_32& rgb1,
71  const vtkm::Vec3f_32& rgb2,
72  vtkm::Float32 weight) const;
73 
74  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceHSV(const vtkm::Vec3f_32& rgb1,
75  const vtkm::Vec3f_32& rgb2,
76  vtkm::Float32 weight) const;
77 
78  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceHSVWrap(const vtkm::Vec3f_32& rgb1,
79  const vtkm::Vec3f_32& rgb2,
80  vtkm::Float32 weight) const;
81 
82  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceLab(const vtkm::Vec3f_32& rgb1,
83  const vtkm::Vec3f_32& rgb2,
84  vtkm::Float32 weight) const;
85 
86  inline VTKM_EXEC vtkm::Vec3f_32 MapThroughColorSpaceDiverging(const vtkm::Vec3f_32& rgb1,
87  const vtkm::Vec3f_32& rgb2,
88  vtkm::Float32 weight) const;
89 };
90 
91 class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Use vtkm::exec::ColorTable.") ColorTableBase
92  : public vtkm::exec::ColorTable
93 {
94 };
95 
96 class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Use vtkm::exec::ColorTable.") ColorTableRGB final
97  : public ColorTable
98 {
99 public:
100  ColorTableRGB() { this->Space = vtkm::ColorSpace::RGB; }
101 };
102 
103 class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Use vtkm::exec::ColorTable.") ColorTableHSV final
104  : public ColorTable
105 {
106 public:
107  ColorTableHSV() { this->Space = vtkm::ColorSpace::HSV; }
108 };
109 
110 class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Use vtkm::exec::ColorTable.") ColorTableHSVWrap final
111  : public ColorTable
112 {
113 public:
114  ColorTableHSVWrap() { this->Space = vtkm::ColorSpace::HSVWrap; }
115 };
116 
117 class VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Use vtkm::exec::ColorTable.") ColorTableLab final
118  : public ColorTable
119 {
120 public:
121  ColorTableLab() { this->Space = vtkm::ColorSpace::Lab; }
122 };
123 
125 {
126 public:
128 };
129 }
130 }
131 
132 #include <vtkm/exec/ColorTable.hxx>
133 
134 #endif
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
VTKM_NO_DEPRECATED_VIRTUAL.
Definition: Algorithms.h:23
vtkm::exec::ColorTable::Space
vtkm::ColorSpace Space
Definition: exec/ColorTable.h:46
Types.h
vtkm::exec::ColorTableDiverging
Definition: exec/ColorTable.h:124
vtkm::exec::VTKM_DEPRECATED
class VTKM_DEPRECATED(1.6, "AtomicArrayExecutionObject no longer uses Device template parameter.") AtomicArrayExecutionObject< T
vtkm::exec::ColorTableDiverging::ColorTableDiverging
ColorTableDiverging()
Definition: exec/ColorTable.h:127
vtkm::ColorSpace::Diverging
@ Diverging
vtkm::ColorSpace::RGB
@ RGB
vtkm::ColorSpace::HSVWrap
@ HSVWrap
vtkm::exec::ColorTable
Definition: exec/ColorTable.h:35
vtkm::Vec< vtkm::Float32, 3 >
Deprecated.h
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:19