From: mzn Date: Thu, 26 Dec 2013 14:00:26 +0000 (+0000) Subject: Bug #295: TIFF files are shown in grayscale mode. X-Git-Tag: BR_hydro_v_0_7~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e9c88feb1e460867db2111714fa862d74c07f35;p=modules%2Fhydro.git Bug #295: TIFF files are shown in grayscale mode. --- diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index 1a0bec79..0d1d5bcb 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -242,18 +242,27 @@ void HYDROData_Image::SetImage(const QImage& theImage) } 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 ); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 462d0c50..e4af5158 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -110,7 +110,7 @@ does not exist or you have not enough permissions to open it. IMAGE_FILTER - Image files (*.bmp *.jpg *.jpeg *.png);;All files (*.* *) + Image files (*.bmp *.jpg *.jpeg *.png *.tif);;All files (*.* *) INCORRECT_OBJECT_NAME