-//----------------------------------------------------------------------------
-namespace
-{
- inline
- void
- MarkValueByColor(VISU_LookupTable* theTable,
- vtkFloatingPointType theValue,
- unsigned char* theColor)
- {
- vtkIdType anIndex = theTable->GetIndex(theValue);
- unsigned char *aTablePtr = theTable->GetPointer(anIndex);
- aTablePtr[0] = theColor[0];
- aTablePtr[1] = theColor[1];
- aTablePtr[2] = theColor[2];
- }
-
- inline
- void
- CopyColor(unsigned char* theTaget, const unsigned char* theSource)
- {
- theTaget[0] = theSource[0];
- theTaget[1] = theSource[1];
- theTaget[2] = theSource[2];
- }
-
- void
- FillByColor(VISU_LookupTable* theTable,
- unsigned char* theColor)
- {
- vtkIdType aNbColors = theTable->GetNumberOfColors();
- for(int i = 0; i < aNbColors; i++){
- unsigned char *aTablePtr = theTable->GetPointer(i);
- CopyColor(aTablePtr,theColor);
- }
- }
-
- void
- MakeBiColor(VISU_LookupTable* theTable)
- {
- unsigned char aRedPtr[3] = {255, 0, 0};
- unsigned char aBluePtr[3] = {0, 0, 255};
-
- vtkFloatingPointType aRange[2];
- theTable->GetTableRange(aRange);
- vtkIdType aNbColors = theTable->GetNumberOfColors();
-
- vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors;
- vtkFloatingPointType aValue = aRange[0]+0.5*aDelta;
- for(int i = 0; i < aNbColors; i++){
- vtkIdType anIndex = theTable->GetIndex(aValue);
- unsigned char* aTablePtr = theTable->GetPointer(anIndex);
- if(aValue > 0.0){
- CopyColor(aTablePtr,aRedPtr);
- }else{
- CopyColor(aTablePtr,aBluePtr);
- }
- aValue += aDelta;
- }
- }
-}
-
-