+ fix conversion from Qi image to Inventor when image uses a color table
This commit is contained in:
parent
6a9252744d
commit
b172e069a1
|
@ -542,7 +542,25 @@ void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const
|
|||
size[1] = p.height();
|
||||
|
||||
int buffersize = p.numBytes();
|
||||
int numcomponents = buffersize / ( size[0] * size[1] );
|
||||
int numcomponents = 0;
|
||||
QVector<QRgb> table = p.colorTable();
|
||||
if (!table.isEmpty()) {
|
||||
if (p.hasAlphaChannel()) {
|
||||
if (p.allGray())
|
||||
numcomponents = 2;
|
||||
else
|
||||
numcomponents = 4;
|
||||
}
|
||||
else {
|
||||
if (p.allGray())
|
||||
numcomponents = 1;
|
||||
else
|
||||
numcomponents = 3;
|
||||
}
|
||||
}
|
||||
else {
|
||||
numcomponents = buffersize / (size[0] * size[1]);
|
||||
}
|
||||
|
||||
// allocate image data
|
||||
img.setValue(size, numcomponents, NULL);
|
||||
|
|
Loading…
Reference in New Issue
Block a user