}
else
{
+ QImage anImage;
+
+ // convert 8-bits images
+ if ( theImage.format() == QImage::Format_Indexed8 ) {
+ anImage = theImage.convertToFormat( QImage::Format_RGB32 );
+ } else {
+ anImage = theImage;
+ }
+
// store width, height, bytes per line and format in integer array
Handle(TDataStd_IntegerArray) aParams;
if (!myLab.FindAttribute(TDataStd_IntegerArray::GetID(), aParams)) {
aParams = TDataStd_IntegerArray::Set(myLab, 1, 4);
}
- aParams->SetValue(1, theImage.width());
- aParams->SetValue(2, theImage.height());
- aParams->SetValue(3, theImage.bytesPerLine());
- aParams->SetValue(4, (int)(theImage.format()));
+ aParams->SetValue(1, anImage.width());
+ aParams->SetValue(2, anImage.height());
+ aParams->SetValue(3, anImage.bytesPerLine());
+ aParams->SetValue(4, (int)(anImage.format()));
// store data of image in byte array
- const char* aData = (const char*)(theImage.bits());
- SaveByteArray(0, aData, theImage.byteCount());
+ const char* aData = (const char*)(anImage.bits());
+ SaveByteArray(0, aData, anImage.byteCount());
}
SetToUpdate( true );