Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 25096 → Rev 25095

/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
27,6 → 27,9
 
ScImgDataLoader_TIFF::ScImgDataLoader_TIFF()
{
m_photometric = PHOTOMETRIC_MINISBLACK;
m_samplesPerPixel = 72;
 
initSupportedFormatList();
}
 
39,11 → 42,11
 
void ScImgDataLoader_TIFF::loadEmbeddedProfile(const QString& fn, int /*page*/)
{
ScColorMgmtEngine engine(ScCore->defaultEngine);
m_embeddedProfile.resize(0);
m_profileComponents = 0;
if (!QFile::exists(fn))
return;
 
TIFFSetTagExtender(TagExtender);
TIFF* tif = TIFFOpen(fn.toLocal8Bit(), "r");
if (!tif)
53,26 → 56,10
void* EmbedBuffer;
if (TIFFGetField(tif, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer))
{
bool profileIsValid = false;
QByteArray profArray((const char*) EmbedBuffer, EmbedLen);
ScColorMgmtEngine engine(ScCore->defaultEngine);
ScColorProfile tiffProf = engine.openProfileFromMem(profArray);
if (tiffProf)
{
uint16_t photometric = 0;
uint16_t samplesPerPixel = 0;
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel);
eColorSpaceType colorSpace = tiffProf.colorSpace();
if (colorSpace == ColorSpace_Rgb)
profileIsValid = (photometric == PHOTOMETRIC_RGB);
if (colorSpace == ColorSpace_Cmyk)
profileIsValid = (photometric == PHOTOMETRIC_SEPARATED && samplesPerPixel >= 4);
if (colorSpace == ColorSpace_Gray)
profileIsValid = (photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE);
}
if (profileIsValid)
{
if (tiffProf.colorSpace() == ColorSpace_Rgb)
m_profileComponents = 3;
if (tiffProf.colorSpace() == ColorSpace_Cmyk)
746,37 → 733,23
m_imageInfoRecord.exifInfo.artist = QString(artist);
m_imageInfoRecord.exifInfo.thumbnail = QImage();
m_imageInfoRecord.exifDataValid = true;
 
m_imageInfoRecord.isEmbedded = false;
m_imageInfoRecord.profileName.clear();
m_imageInfoRecord.embeddedProfileName.clear();
 
uint32_t EmbedLen = 0;
void* EmbedBuffer;
if (TIFFGetField(tif, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer))
{
bool profileIsValid = false;
QByteArray profArray((const char*) EmbedBuffer, EmbedLen);
ScColorProfile tiffProf = engine.openProfileFromMem(profArray);
if (tiffProf)
{
eColorSpaceType colorSpace = tiffProf.colorSpace();
if (colorSpace == ColorSpace_Rgb)
profileIsValid = (m_photometric == PHOTOMETRIC_RGB);
if (colorSpace == ColorSpace_Cmyk)
profileIsValid = (m_photometric == PHOTOMETRIC_SEPARATED && m_samplesPerPixel >= 4);
if (colorSpace == ColorSpace_Gray)
profileIsValid = (m_photometric == PHOTOMETRIC_MINISBLACK || m_photometric == PHOTOMETRIC_MINISWHITE);
}
if (profileIsValid)
{
m_embeddedProfile = profArray;
m_imageInfoRecord.profileName = tiffProf.productDescription();
m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
m_imageInfoRecord.isEmbedded = true;
}
m_embeddedProfile = profArray;
m_imageInfoRecord.profileName = tiffProf.productDescription();
m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
m_imageInfoRecord.isEmbedded = true;
}
 
else
{
m_imageInfoRecord.isEmbedded = false;
m_imageInfoRecord.profileName.clear();
m_imageInfoRecord.embeddedProfileName.clear();
}
unsigned int PhotoshopLen = 0;
unsigned char* PhotoshopBuffer;
if (TIFFGetField(tif, TIFFTAG_PHOTOSHOP, &PhotoshopLen, &PhotoshopBuffer) )
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h
63,8 → 63,8
void unmultiplyRGBA(RawImage *image);
 
int m_random_table[4096];
uint16_t m_photometric { PHOTOMETRIC_MINISBLACK };
uint16_t m_samplesPerPixel { 1 };
uint16_t m_photometric;
uint16_t m_samplesPerPixel;
};
 
#endif