25 #include "ColourMap.hh"
39 imageInNorm.ScaleShiftBetween(0, 1);
42 imageOut.
Init(imageInNorm.GetWidth(), imageInNorm.GetHeight(), 3);
45 const float* imageInData = imageInNorm.GetImageData();
49 for (
size_t y = 0; y < imageInNorm.GetHeight(); ++y)
51 for (
size_t x = 0; x < imageInNorm.GetWidth(); ++x)
53 const size_t offsetIn = y * imageInNorm.GetWidth() + x;
54 const size_t offsetOut = y * imageInNorm.GetWidth() * imageOut.
GetChannelCount()
57 const float curValue = imageInData[offsetIn];
59 vector<unsigned char> curColour;
60 m_mapGradient.GetColour(curValue, curColour);
62 imageOutData[offsetOut] = curColour[0];
63 imageOutData[offsetOut + 1] = curColour[1];
64 imageOutData[offsetOut + 2] = curColour[2];
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase