MCPcopy Create free account
hub / github.com/Kitware/VTK / PrepareColormap

Method PrepareColormap

Rendering/OpenGL2/vtkArrayRenderer.cxx:113–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void vtkArrayRenderer::PrepareColormap(vtkScalarsToColors* cmap)
114{
115 if (!cmap && this->ColorTextureMap)
116 {
117 // We have a previous colormap. Use it.
118 return;
119 }
120 vtkNew<vtkColorTransferFunction> ctf;
121 if (!cmap)
122 {
123 // Create a cool-to-warm (blue to red) diverging colormap by default:
124 ctf->SetVectorModeToMagnitude();
125 ctf->SetColorSpaceToDiverging();
126 ctf->AddRGBPoint(0.0, 59. / 255., 76. / 255., 192. / 255.);
127 ctf->AddRGBPoint(0.5, 221. / 255., 221. / 255., 221. / 255.);
128 ctf->AddRGBPoint(1.0, 180. / 255., 4. / 255., 38. / 255.);
129 ctf->Build();
130 cmap = ctf;
131 }
132 // Now, if there is no colormap texture, make one from the colormap
133 if (!this->LookupTable || this->LookupTable->GetMTime() < cmap->GetMTime())
134 {
135 this->SetLookupTable(cmap);
136 }
137 if (!this->ColorTextureMap || this->ColorTextureMap->GetMTime() < this->LookupTable->GetMTime())
138 {
139 this->CreateColormapTexture(); // populate this->ColorTexture from this->LookupTable
140 }
141}
142
143double* vtkArrayRenderer::GetBounds()
144{

Callers 1

Calls 6

CreateColormapTextureMethod · 0.95
AddRGBPointMethod · 0.80
BuildMethod · 0.45
GetMTimeMethod · 0.45
SetLookupTableMethod · 0.45

Tested by

no test coverage detected