Minor changes
This commit is contained in:
@@ -123,7 +123,7 @@ void ImageBase::clear()
|
||||
_setColorFormat(IB_CF_GREY8, 8);
|
||||
}
|
||||
|
||||
// Sets the color format and the dependant parameters
|
||||
// Sets the color format and the dependent parameters
|
||||
// Returns 0 for OK, -1 for invalid color format
|
||||
int ImageBase::_setColorFormat(int format, unsigned short numSigBitsPerSample)
|
||||
{
|
||||
@@ -235,7 +235,7 @@ int ImageBase::createCopy(void* pSrcPixelData, unsigned long width, unsigned lon
|
||||
// Clear any existing data
|
||||
clear();
|
||||
|
||||
// Set the color format and the dependant parameters
|
||||
// Set the color format and the dependent parameters
|
||||
if (_setColorFormat(format, numSigBitsPerSample) != 0)
|
||||
return -1;
|
||||
|
||||
@@ -273,7 +273,7 @@ int ImageBase::pointTo(void* pSrcPixelData, unsigned long width, unsigned long h
|
||||
// Clear any existing data
|
||||
clear();
|
||||
|
||||
// Set the color format and the dependant parameters
|
||||
// Set the color format and the dependent parameters
|
||||
if (_setColorFormat(format, numSigBitsPerSample) != 0)
|
||||
return -1;
|
||||
|
||||
@@ -324,15 +324,15 @@ int ImageBase::getSample(int x, int y, unsigned short sampleIndex, double &value
|
||||
case IB_CF_RGBA64:
|
||||
case IB_CF_BGRA64:
|
||||
{
|
||||
unsigned short* pPix16 = (unsigned short *)_pPixelData;
|
||||
unsigned short* pSample = pPix16 + _numSamples * (y * _width + x) + sampleIndex;
|
||||
uint16_t* pPix16 = (uint16_t *)_pPixelData;
|
||||
uint16_t* pSample = pPix16 + _numSamples * (y * _width + x) + sampleIndex;
|
||||
value = (double)(*pSample);
|
||||
}
|
||||
break;
|
||||
case IB_CF_GREY32:
|
||||
{
|
||||
unsigned long* pPix32 = (unsigned long *)_pPixelData;
|
||||
unsigned long* pSample = pPix32 + y * _width + x;
|
||||
uint32_t* pPix32 = (uint32_t *)_pPixelData;
|
||||
uint32_t* pSample = pPix32 + y * _width + x;
|
||||
value = (double)(*pSample);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -71,7 +71,7 @@ protected:
|
||||
int _format; // colour format of the pixel data
|
||||
unsigned short _numSigBitsPerSample;// number of significant bits per sample (always <= _numBitsPerSample)
|
||||
|
||||
// Dependant parameters
|
||||
// Dependent parameters
|
||||
unsigned short _numSamples; // number of samples per pixel (e.g. 1 for grey, 3 for rgb, 4 for rgba)
|
||||
unsigned short _numBitsPerSample; // number of bits per sample (e.g. 8 for Grey8)
|
||||
unsigned short _numBytesPerPixel; // number of bytes per pixel (e.g. 1 for Grey8)
|
||||
|
||||
@@ -45,6 +45,8 @@ using namespace ImageGui;
|
||||
#pragma warning(disable:4305) // init: truncation from const double to float
|
||||
#endif
|
||||
|
||||
bool GLImageBox::haveMesa = false;
|
||||
|
||||
/* TRANSLATOR ImageGui::GLImageBox */
|
||||
|
||||
// Constructor
|
||||
@@ -81,7 +83,13 @@ GLImageBox::~GLImageBox()
|
||||
// Set up the OpenGL rendering state
|
||||
void GLImageBox::initializeGL()
|
||||
{
|
||||
qglClearColor( Qt::black ); // Let OpenGL clear to black
|
||||
qglClearColor( Qt::black ); // Let OpenGL clear to black
|
||||
static bool init = false;
|
||||
if (!init) {
|
||||
init = true;
|
||||
std::string ver = (const char*)(glGetString(GL_VERSION));
|
||||
haveMesa = (ver.find("Mesa") != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +178,7 @@ void GLImageBox::drawImage()
|
||||
// Load the color map if present
|
||||
if (_pColorMap != 0)
|
||||
{
|
||||
glPixelTransferf(GL_MAP_COLOR, 1.0);
|
||||
if (!haveMesa) glPixelTransferf(GL_MAP_COLOR, 1.0);
|
||||
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, _numMapEntries, _pColorMap);
|
||||
glPixelMapfv(GL_PIXEL_MAP_G_TO_G, _numMapEntries, _pColorMap + _numMapEntries);
|
||||
glPixelMapfv(GL_PIXEL_MAP_B_TO_B, _numMapEntries, _pColorMap + _numMapEntries * 2);
|
||||
|
||||
@@ -105,6 +105,7 @@ private:
|
||||
|
||||
float* _pColorMap; // a RGBA color map (to alter the intensity or colors)
|
||||
int _numMapEntries; // number of entries in color map
|
||||
static bool haveMesa;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
|
||||
Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
{
|
||||
// Part tools
|
||||
Gui::ToolBarItem* root = new Gui::ToolBarItem;
|
||||
Gui::ToolBarItem* img = new Gui::ToolBarItem(root);
|
||||
img->setCommand("Image");
|
||||
|
||||
Reference in New Issue
Block a user