本文整理汇总了C++中ScColorProfile类的典型用法代码示例。如果您正苦于以下问题:C++ ScColorProfile类的具体用法?C++ ScColorProfile怎么用?C++ ScColorProfile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScColorProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmsSetErrorHandler
ScColorProfile ScLcmsColorMgmtEngineImpl::openProfileFromMem(ScColorMgmtEngine& engine, const QByteArray& data)
{
ScColorProfile profile;
cmsHPROFILE lcmsProf = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
lcmsProf = cmsOpenProfileFromMem((LPVOID) data.data(), data.size());
if (lcmsProf)
{
ScLcmsColorProfileImpl* profData = new ScLcmsColorProfileImpl(engine, lcmsProf);
QString desc = profData->productDescription();
if (!desc.isEmpty())
profData->m_profilePath = QString("memprofile://%1").arg(desc);
profData->m_profileData = data;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (profile.isNull() && lcmsProf)
cmsCloseProfile(lcmsProf);
profile = ScColorProfile();
}
cmsSetErrorHandler(NULL);
return profile;
}
示例2: internalProfilePath
ScColorProfile ScLcmsColorMgmtEngineImpl::createProfile_Lab(ScColorMgmtEngine& engine)
{
QString internalProfilePath("memprofile://Internal Lab profile");
ScColorProfile profile = m_profileCache->profile(internalProfilePath);
if (!profile.isNull())
return profile;
cmsHPROFILE lcmsProf = NULL;
cmsSetErrorHandler(&cmsErrorHandler);
try
{
lcmsProf = cmsCreateLabProfile(NULL);
if (lcmsProf)
{
ScLcmsColorProfileImpl* profData = new ScLcmsColorProfileImpl(engine, lcmsProf);
profData->m_profilePath = internalProfilePath;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
m_profileCache->addProfile(profile);
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
if (profile.isNull() && lcmsProf)
cmsCloseProfile(lcmsProf);
profile = ScColorProfile();
}
cmsSetErrorHandler(NULL);
return profile;
}
示例3: file
ScColorProfile ScLcms2ColorMgmtEngineImpl::openProfileFromFile(ScColorMgmtEngine& engine, const QString& filePath)
{
// Search profile in profile cache first
ScColorProfile profile = m_profileCache->profile(filePath);
if (!profile.isNull())
return profile;
cmsHPROFILE lcmsProf = NULL;
QFile file(filePath);
if (file.open(QFile::ReadOnly))
{
// We do not use lcms cmsOpenProfileFromFile() to avoid limitations
// of I/O on 8bit filenames on Windows
QByteArray data = file.readAll();
if (!data.isEmpty())
{
lcmsProf = cmsOpenProfileFromMem(data.data(), data.size());
if (lcmsProf)
{
ScLcms2ColorProfileImpl* profData = new ScLcms2ColorProfileImpl(engine, lcmsProf);
profData->m_profileData = data;
profData->m_profilePath = filePath;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
m_profileCache->addProfile(profile);
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
}
file.close();
}
return profile;
}
示例4: f
void ScImgDataLoader_PS::loadEmbeddedProfile(const QString& fn, int /* page */)
{
QChar tc;
QString tmp;
m_embeddedProfile.resize(0);
m_profileComponents = 0;
if ( !QFile::exists(fn) )
return;
QFile f(fn);
if (f.open(QIODevice::ReadOnly))
{
QDataStream ts(&f);
while (!ts.atEnd())
{
tmp = readLinefromDataStream(ts);
if (tmp.startsWith("%%BeginICCProfile:"))
{
QByteArray psdata;
while (!ts.atEnd())
{
tmp = readLinefromDataStream(ts);
for (int a = 2; a < tmp.length(); a += 2)
{
bool ok;
ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
psdata.resize(psdata.size()+1);
psdata[psdata.size()-1] = data;
}
if (tmp.startsWith("%%EndICCProfile"))
{
ScColorMgmtEngine engine(ScCore->defaultEngine);
ScColorProfile prof = engine.openProfileFromMem(psdata);
if (prof)
{
if (prof.colorSpace() == ColorSpace_Rgb)
m_profileComponents = 3;
if (prof.colorSpace() == ColorSpace_Cmyk)
m_profileComponents = 4;
m_imageInfoRecord.profileName = prof.productDescription();
m_imageInfoRecord.isEmbedded = true;
m_embeddedProfile = psdata;
}
break;
}
}
}
}
}
}
示例5: addProfile
void ScColorProfileCache::addProfile(const ScColorProfile& profile)
{
QString path = profile.profilePath();
if (path.isEmpty())
return;
QMap<QString, QWeakPointer<ScColorProfileData> >::iterator iter = m_profileMap.find(path);
if (iter != m_profileMap.end())
{
QSharedPointer<ScColorProfileData> strongRef = iter.value().toStrongRef();
if (strongRef) return;
}
m_profileMap.insert(path, profile.weakRef());
}
示例6: jpeg_std_error
void ScImgDataLoader_JPEG::loadEmbeddedProfile(const QString& fn, int /*page*/)
{
m_embeddedProfile.resize(0);
m_profileComponents = 0;
if (!QFile::exists(fn))
return;
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
FILE *infile;
cinfo.err = jpeg_std_error (&jerr.pub);
jerr.pub.error_exit = my_error_exit;
infile = NULL;
if (setjmp (jerr.setjmp_buffer))
{
jpeg_destroy_decompress (&cinfo);
if (infile)
fclose (infile);
return;
}
jpeg_create_decompress (&cinfo);
if ((infile = fopen (fn.toLocal8Bit(), "rb")) == NULL)
return;
jpeg_stdio_src(&cinfo, infile);
jpeg_save_markers(&cinfo, ICC_MARKER, 0xFFFF);
jpeg_read_header(&cinfo, true);
unsigned int EmbedLen = 0;
unsigned char* EmbedBuffer;
if (read_jpeg_marker(ICC_MARKER,&cinfo, &EmbedBuffer, &EmbedLen))
{
QByteArray profArray = QByteArray((const char*) EmbedBuffer, EmbedLen);
ScColorProfile prof = ScColorMgmtEngine::openProfileFromMem(profArray);
if (prof)
{
if (prof.colorSpace() == ColorSpace_Rgb)
m_profileComponents = 3;
if (prof.colorSpace() == ColorSpace_Cmyk)
m_profileComponents = 4;
if (prof.colorSpace() == ColorSpace_Gray)
m_profileComponents = 1;
m_embeddedProfile = profArray;
}
free(EmbedBuffer);
}
fclose (infile);
jpeg_destroy_decompress (&cinfo);
}
示例7: createColorSpace
ScColorSpace ScColorMgmtEngineData::createColorSpace(ScColorProfile& profile, eColorFormat colorFormat)
{
ScColorSpace colorSpace;
eColorSpaceType profileCSpace = profile.colorSpace();
if (profileCSpace == ColorSpace_Rgb)
{
if (colorFormat == Format_RGB_8)
colorSpace = ScColorSpace(new ScColorSpaceData_RGB8(profile));
else if (colorFormat == Format_RGB_16)
colorSpace = ScColorSpace(new ScColorSpaceData_RGB16(profile));
else if (colorFormat == Format_RGBA_8)
colorSpace = ScColorSpace(new ScColorSpaceData_RGBA8(profile));
else if (colorFormat == Format_RGBA_16)
colorSpace = ScColorSpace(new ScColorSpaceData_RGBA16(profile));
else if (colorFormat == Format_ARGB_8)
colorSpace = ScColorSpace(new ScColorSpaceData_ARGB8(profile));
else if (colorFormat == Format_ARGB_16)
colorSpace = ScColorSpace(new ScColorSpaceData_ARGB16(profile));
else if (colorFormat == Format_BGRA_8)
colorSpace = ScColorSpace(new ScColorSpaceData_BGRA8(profile));
else if (colorFormat == Format_BGRA_16)
colorSpace = ScColorSpace(new ScColorSpaceData_BGRA16(profile));
}
else if (profileCSpace == ColorSpace_Cmyk)
{
if (colorFormat == Format_CMYK_8)
colorSpace = ScColorSpace(new ScColorSpaceData_CMYK8(profile));
else if (colorFormat == Format_CMYK_16)
colorSpace = ScColorSpace(new ScColorSpaceData_CMYK16(profile));
else if (colorFormat == Format_CMYKA_8)
colorSpace = ScColorSpace(new ScColorSpaceData_CMYKA8(profile));
else if (colorFormat == Format_CMYKA_16)
colorSpace = ScColorSpace(new ScColorSpaceData_CMYKA16(profile));
else if (colorFormat == Format_YMCK_8)
colorSpace = ScColorSpace(new ScColorSpaceData_YMCK8(profile));
else if (colorFormat == Format_YMCK_16)
colorSpace = ScColorSpace(new ScColorSpaceData_YMCK16(profile));
}
else if (profileCSpace == ColorSpace_Gray)
{
if (colorFormat == Format_GRAY_8)
colorSpace = ScColorSpace(new ScColorSpaceData_GRAY8(profile));
else if (colorFormat == Format_GRAY_16)
colorSpace = ScColorSpace(new ScColorSpaceData_GRAY16(profile));
}
else if (profileCSpace == ColorSpace_Lab)
{
if (colorFormat == Format_LabA_8)
colorSpace = ScColorSpace(new ScColorSpaceData_LabA8(profile));
if (colorFormat == Format_Lab_Dbl)
colorSpace = ScColorSpace(new ScColorSpaceData_LabD(profile));
}
return colorSpace;
}
示例8: cmsOpenProfileFromMem
ScColorProfile ScLcms2ColorMgmtEngineImpl::openProfileFromMem(ScColorMgmtEngine& engine, const QByteArray& data)
{
ScColorProfile profile;
cmsHPROFILE lcmsProf = cmsOpenProfileFromMem((const void *) data.data(), data.size());
if (lcmsProf)
{
ScLcms2ColorProfileImpl* profData = new ScLcms2ColorProfileImpl(engine, lcmsProf);
QString desc = profData->productDescription();
if (!desc.isEmpty())
profData->m_profilePath = QString("memprofile://%1").arg(desc);
profData->m_profileData = data;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
return profile;
}
示例9: internalProfilePath
ScColorProfile ScLcms2ColorMgmtEngineImpl::createProfile_Lab(ScColorMgmtEngine& engine)
{
QString internalProfilePath("memprofile://Internal Lab profile");
ScColorProfile profile = m_profileCache->profile(internalProfilePath);
if (!profile.isNull())
return profile;
cmsHPROFILE lcmsProf = cmsCreateLab2Profile(NULL);
if (lcmsProf)
{
ScLcms2ColorProfileImpl* profData = new ScLcms2ColorProfileImpl(engine, lcmsProf);
profData->m_profilePath = internalProfilePath;
profile = ScColorProfile(dynamic_cast<ScColorProfileData*>(profData));
m_profileCache->addProfile(profile);
}
if (profile.isNull() && lcmsProf)
{
cmsCloseProfile(lcmsProf);
lcmsProf = NULL;
}
return profile;
}
示例10: PyErr_SetString
//.........这里部分代码省略.........
ScCore->primaryMainWindow()->doc->PDF_Options.Articles = self->article;
ScCore->primaryMainWindow()->doc->PDF_Options.Encrypt = self->encrypt;
ScCore->primaryMainWindow()->doc->PDF_Options.UseLPI = self->uselpi;
ScCore->primaryMainWindow()->doc->PDF_Options.UseSpotColors = self->usespot;
ScCore->primaryMainWindow()->doc->PDF_Options.doMultiFile = self->domulti;
self->version = minmaxi(self->version, 12, 14);
// FIXME: Sanity check version
ScCore->primaryMainWindow()->doc->PDF_Options.Version = (PDFOptions::PDFVersion)self->version;
if (self->encrypt)
{
int Perm = -64;
if (ScCore->primaryMainWindow()->doc->PDF_Options.Version == PDFOptions::PDFVersion_14)
Perm &= ~0x00240000;
if (self->aprint)
Perm += 4;
if (self->achange)
Perm += 8;
if (self->acopy)
Perm += 16;
if (self->aanot)
Perm += 32;
ScCore->primaryMainWindow()->doc->PDF_Options.Permissions = Perm;
ScCore->primaryMainWindow()->doc->PDF_Options.PassOwner = QString(PyString_AsString(self->owner));
ScCore->primaryMainWindow()->doc->PDF_Options.PassUser = QString(PyString_AsString(self->user));
}
if (self->outdst == 0)
{
ScCore->primaryMainWindow()->doc->PDF_Options.UseRGB = true;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = false;
}
else
{
ScCore->primaryMainWindow()->doc->PDF_Options.UseRGB = false;
if (ScCore->primaryMainWindow()->doc->HasCMS)
{
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = self->profiles;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = self->profilei;
self->intents = minmaxi(self->intents, 0, 3);
ScCore->primaryMainWindow()->doc->PDF_Options.Intent = self->intents;
self->intenti = minmaxi(self->intenti, 0, 3);
ScCore->primaryMainWindow()->doc->PDF_Options.Intent2 = self->intenti;
ScCore->primaryMainWindow()->doc->PDF_Options.EmbeddedI = self->noembicc;
ScCore->primaryMainWindow()->doc->PDF_Options.SolidProf = PyString_AsString(self->solidpr);
ScCore->primaryMainWindow()->doc->PDF_Options.ImageProf = PyString_AsString(self->imagepr);
ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf = PyString_AsString(self->printprofc);
if (ScCore->primaryMainWindow()->doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
{
// Where does compiler find cms function when I have not included header for it
ScColorProfile hIn;
hIn = ScColorMgmtEngine::openProfileFromFile(ScCore->PrinterProfiles[ScCore->primaryMainWindow()->doc->PDF_Options.PrintProf]);
nam = hIn.productDescription();
if (hIn.colorSpace() == ColorSpace_Rgb)
Components = 3;
if (hIn.colorSpace() == ColorSpace_Cmyk)
Components = 4;
if (hIn.colorSpace() == ColorSpace_Gray)
Components = 3;
ScCore->primaryMainWindow()->doc->PDF_Options.Info = PyString_AsString(self->info);
self->bleedt = minmaxd(self->bleedt, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.bleeds.Top = self->bleedt/ScCore->primaryMainWindow()->view->Doc->unitRatio();
self->bleedl = minmaxd(self->bleedl, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.bleeds.Left = self->bleedl/ScCore->primaryMainWindow()->view->Doc->unitRatio();
self->bleedr = minmaxd(self->bleedr, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.bleeds.Right = self->bleedr/ScCore->primaryMainWindow()->view->Doc->unitRatio();
self->bleedb = minmaxd(self->bleedb, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight*ScCore->primaryMainWindow()->view->Doc->unitRatio());
ScCore->primaryMainWindow()->doc->PDF_Options.bleeds.Bottom = self->bleedb/ScCore->primaryMainWindow()->view->Doc->unitRatio();
ScCore->primaryMainWindow()->doc->PDF_Options.Encrypt = false;
ScCore->primaryMainWindow()->doc->PDF_Options.PresentMode = false;
}
}
else
{
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles = false;
ScCore->primaryMainWindow()->doc->PDF_Options.UseProfiles2 = false;
}
}
QMap<int,QPixmap> thumbs;
for (uint ap = 0; ap < pageNs.size(); ++ap)
{
QPixmap pm(10,10);
if (ScCore->primaryMainWindow()->doc->PDF_Options.Thumbnails)
pm = QPixmap::fromImage(ScCore->primaryMainWindow()->view->PageToPixmap(pageNs[ap]-1, 100));
thumbs.insert(pageNs[ap], pm);
}
ReOrderText(ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow()->view);
QString errorMessage;
if (!ScCore->primaryMainWindow()->getPDFDriver(fn, nam, Components, pageNs, thumbs, errorMessage)) {
fn = "Cannot write the File: " + fn;
if (!errorMessage.isEmpty())
fn += QString("\n%1").arg(errorMessage);
PyErr_SetString(PyExc_SystemError, fn.toAscii());
return NULL;
}
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
示例11: if
//.........这里部分代码省略.........
else if (Options->continuousPages->isChecked())
pgl = PDFOptions::OneColumn;
else if (Options->doublePageLeft->isChecked())
pgl = PDFOptions::TwoColumnLeft;
else if (Options->doublePageRight->isChecked())
pgl = PDFOptions::TwoColumnRight;
m_opts.PageLayout = pgl;
if (Options->actionCombo->currentIndex() != 0)
m_opts.openAction = Options->actionCombo->currentText();
else
m_opts.openAction = "";
if (Options->Encry->isChecked())
{
int Perm = -64;
if (Options->PDFVersionCombo->currentIndex() == 1)
Perm &= ~0x00240000;
if (Options->PrintSec->isChecked())
Perm += 4;
if (Options->ModifySec->isChecked())
Perm += 8;
if (Options->CopySec->isChecked())
Perm += 16;
if (Options->AddSec->isChecked())
Perm += 32;
m_opts.Permissions = Perm;
m_opts.PassOwner = Options->PassOwner->text();
m_opts.PassUser = Options->PassUser->text();
}
if (Options->PDFVersionCombo->currentIndex() == 0)
m_opts.Version = PDFOptions::PDFVersion_13;
if (Options->PDFVersionCombo->currentIndex() == 1)
m_opts.Version = PDFOptions::PDFVersion_14;
if (Options->PDFVersionCombo->currentIndex() == 2)
m_opts.Version = PDFOptions::PDFVersion_15;
if (Options->PDFVersionCombo->currentIndex() == 3)
m_opts.Version = PDFOptions::PDFVersion_X1a;
if (Options->PDFVersionCombo->currentIndex() == 4)
m_opts.Version = PDFOptions::PDFVersion_X3;
if (Options->PDFVersionCombo->currentIndex() == 5)
m_opts.Version = PDFOptions::PDFVersion_X4;
if (Options->OutCombo->currentIndex() == 0)
{
m_opts.UseRGB = true;
m_opts.isGrayscale = false;
m_opts.UseProfiles = false;
m_opts.UseProfiles2 = false;
}
else
{
if (Options->OutCombo->currentIndex() == 2)
{
m_opts.isGrayscale = true;
m_opts.UseRGB = false;
m_opts.UseProfiles = false;
m_opts.UseProfiles2 = false;
}
else
{
m_opts.isGrayscale = false;
m_opts.UseRGB = false;
if (m_doc->HasCMS)
{
m_opts.UseProfiles = Options->EmbedProfs->isChecked();
m_opts.UseProfiles2 = Options->EmbedProfs2->isChecked();
if (m_opts.Version != PDFOptions::PDFVersion_X1a)
{
m_opts.Intent = Options->IntendS->currentIndex();
m_opts.Intent2 = Options->IntendI->currentIndex();
m_opts.EmbeddedI = Options->NoEmbedded->isChecked();
m_opts.SolidProf = Options->SolidPr->currentText();
m_opts.ImageProf = Options->ImageP->currentText();
}
m_opts.PrintProf = Options->PrintProfC->currentText();
if ((m_opts.Version == PDFOptions::PDFVersion_X3) || (m_opts.Version == PDFOptions::PDFVersion_X1a) || (m_opts.Version == PDFOptions::PDFVersion_X4))
{
ScColorProfile hIn = m_doc->colorEngine.openProfileFromFile( m_printerProfiles[m_opts.PrintProf] );
m_cmsDescriptor = hIn.productDescription();
if (hIn.colorSpace() == ColorSpace_Rgb)
m_components = 3;
if (hIn.colorSpace() == ColorSpace_Cmyk)
m_components = 4;
if (hIn.colorSpace() == ColorSpace_Cmy)
m_components = 3;
m_opts.Info = Options->InfoString->text();
m_opts.Encrypt = false;
m_opts.MirrorH = false;
m_opts.MirrorV = false;
//#8306 : PDF/X-3 export ignores rotation setting
//m_opts.RotateDeg = 0;
m_opts.PresentMode = false;
}
}
else
{
m_opts.UseProfiles = false;
m_opts.UseProfiles2 = false;
}
}
}
}
示例12: createProofingTransform
ScColorTransform ScLcmsColorMgmtEngineImpl::createProofingTransform(ScColorMgmtEngine& engine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
const ScColorProfile& proofProfile , eRenderIntent renderIntent,
eRenderIntent proofingIntent, long transformFlags)
{
ScColorTransform transform(NULL);
if (inputProfile.isNull() || outputProfile.isNull())
return transform;
int inputProfEngineID = inputProfile.engine().engineID();
int outputProfEngineID = outputProfile.engine().engineID();
int proofProfEngineID = proofProfile.engine().engineID();
if ((engine.engineID() != m_engineID) || (inputProfEngineID != m_engineID) ||
(outputProfEngineID != m_engineID) || (proofProfEngineID != m_engineID))
return transform;
const ScLcmsColorProfileImpl* lcmsInputProf = dynamic_cast<const ScLcmsColorProfileImpl*>(inputProfile.data());
const ScLcmsColorProfileImpl* lcmsOutputProf = dynamic_cast<const ScLcmsColorProfileImpl*>(outputProfile.data());
const ScLcmsColorProfileImpl* lcmsProofingProf = dynamic_cast<const ScLcmsColorProfileImpl*>(proofProfile.data());
if (!lcmsInputProf || !lcmsOutputProf || !lcmsProofingProf)
return transform;
long strategyFlags = 0;
if (m_strategy.useBlackPointCompensation)
strategyFlags |= Ctf_BlackPointCompensation;
if (m_strategy.useBlackPreservation)
strategyFlags |= Ctf_BlackPreservation;
ScColorTransformInfo transInfo;
transInfo.inputProfile = inputProfile.productDescription();
transInfo.outputProfile = outputProfile.productDescription();
transInfo.proofingProfile = proofProfile.productDescription();
transInfo.inputFormat = inputFormat;
transInfo.outputFormat = outputFormat;
transInfo.renderIntent = renderIntent;
transInfo.proofingIntent = proofingIntent;
transInfo.flags = transformFlags | strategyFlags;
DWORD lcmsFlags = translateFlagsToLcmsFlags(transformFlags | strategyFlags);
DWORD lcmsInputFmt = translateFormatToLcmsFormat(inputFormat);
DWORD lcmsOutputFmt = translateFormatToLcmsFormat(outputFormat);
int lcmsIntent = translateIntentToLcmsIntent(renderIntent);
int lcmsPrfIntent = translateIntentToLcmsIntent(proofingIntent);
if (transInfo.inputProfile != transInfo.proofingProfile)
{
if (transInfo.proofingProfile == transInfo.outputProfile)
{
transInfo.proofingIntent = Intent_Relative_Colorimetric;
lcmsPrfIntent = translateIntentToLcmsIntent(Intent_Relative_Colorimetric);
}
transform = m_transformPool->findTransform(transInfo);
if (transform.isNull())
{
cmsSetErrorHandler(&cmsErrorHandler);
cmsHTRANSFORM hTransform = NULL;
try
{
hTransform = cmsCreateProofingTransform(lcmsInputProf->m_profileHandle , lcmsInputFmt,
lcmsOutputProf->m_profileHandle, lcmsOutputFmt,
lcmsProofingProf->m_profileHandle, lcmsIntent,
lcmsPrfIntent, lcmsFlags | cmsFLAGS_SOFTPROOFING);
if (hTransform)
{
ScLcmsColorTransformImpl* newTrans = new ScLcmsColorTransformImpl(engine, hTransform);
newTrans->setTransformInfo(transInfo);
transform = ScColorTransform(dynamic_cast<ScColorTransformData*>(newTrans));
m_transformPool->addTransform(transform, true);
}
}
catch (lcmsException& e)
{
std::cerr << e.what() << std::endl;
// #9922 : no idea why that crash in release mode
/*if (transform.isNull() && hTransform)
cmsDeleteTransform(hTransform);*/
transform = ScColorTransform();
}
cmsSetErrorHandler(NULL);
}
}
else
{
transformFlags &= (~Ctf_Softproofing);
transformFlags &= (~Ctf_GamutCheck);
lcmsFlags = translateFlagsToLcmsFlags(transformFlags | strategyFlags);
transInfo.flags = transformFlags | strategyFlags;
transInfo.renderIntent = proofingIntent;
transInfo.proofingIntent = (eRenderIntent) 0;
if (transInfo.inputProfile == transInfo.outputProfile)
{
lcmsFlags |= cmsFLAGS_NULLTRANSFORM;
transInfo.inputProfile = QString();
transInfo.outputProfile = QString();
transInfo.proofingProfile = QString();
transInfo.renderIntent = (eRenderIntent) 0;
transInfo.proofingIntent = (eRenderIntent) 0;
transInfo.flags = 0;
}
transform = m_transformPool->findTransform(transInfo);
if (transform.isNull())
//.........这里部分代码省略.........
示例13: if
//.........这里部分代码省略.........
{
if (checkerSettings.checkTransparency && currItem->pixm.hasSmoothAlpha())
itemError.insert(Transparency, 0);
}
if (((qRound(72.0 / currItem->imageXScale()) < checkerSettings.minResolution) || (qRound(72.0 / currItem->imageYScale()) < checkerSettings.minResolution))
&& (currItem->isRaster) && (checkerSettings.checkResolution))
itemError.insert(ImageDPITooLow, 0);
if (((qRound(72.0 / currItem->imageXScale()) > checkerSettings.maxResolution) || (qRound(72.0 / currItem->imageYScale()) > checkerSettings.maxResolution))
&& (currItem->isRaster) && (checkerSettings.checkResolution))
itemError.insert(ImageDPITooHigh, 0);
QFileInfo fi = QFileInfo(currItem->Pfile);
QString ext = fi.suffix().toLower();
if (extensionIndicatesPDF(ext) && (checkerSettings.checkRasterPDF))
itemError.insert(PlacedPDF, 0);
if ((ext == "gif") && (checkerSettings.checkForGIF))
itemError.insert(ImageIsGIF, 0);
if (extensionIndicatesPDF(ext))
{
PDFAnalyzer analyst(currItem->Pfile);
QList<PDFColorSpace> usedColorSpaces;
bool hasTransparency = false;
QList<PDFFont> usedFonts;
int pageNum = qMin(qMax(1, currItem->pixm.imgInfo.actualPageNumber), currItem->pixm.imgInfo.numberOfPages) - 1;
QList<PDFImage> imgs;
bool succeeded = analyst.inspectPDF(pageNum, usedColorSpaces, hasTransparency, usedFonts, imgs);
if (succeeded)
{
if (checkerSettings.checkNotCMYKOrSpot || checkerSettings.checkDeviceColorsAndOutputIntent)
{
eColorSpaceType currPrintProfCS = ColorSpace_Unknown;
if (currDoc->HasCMS)
{
ScColorProfile printerProf = currDoc->DocPrinterProf;
currPrintProfCS = printerProf.colorSpace();
}
if (checkerSettings.checkNotCMYKOrSpot)
{
for (int i=0; i<usedColorSpaces.size(); ++i)
{
if (usedColorSpaces[i] == CS_DeviceRGB || usedColorSpaces[i] == CS_ICCBased || usedColorSpaces[i] == CS_CalGray
|| usedColorSpaces[i] == CS_CalRGB || usedColorSpaces[i] == CS_Lab)
{
itemError.insert(NotCMYKOrSpot, 0);
break;
}
}
}
if (checkerSettings.checkDeviceColorsAndOutputIntent && currDoc->HasCMS)
{
for (int i=0; i<usedColorSpaces.size(); ++i)
{
if (currPrintProfCS == ColorSpace_Cmyk && (usedColorSpaces[i] == CS_DeviceRGB || usedColorSpaces[i] == CS_DeviceGray))
{
itemError.insert(DeviceColorsAndOutputIntent, 0);
break;
}
else if (currPrintProfCS == ColorSpace_Rgb && (usedColorSpaces[i] == CS_DeviceCMYK || usedColorSpaces[i] == CS_DeviceGray))
{
itemError.insert(DeviceColorsAndOutputIntent, 0);
break;
}
}
}
}
if (checkerSettings.checkTransparency && hasTransparency)
示例14: removeProfile
void ScColorProfileCache::removeProfile(const ScColorProfile& profile)
{
m_profileMap.remove(profile.profilePath());
}
示例15: transform
ScColorTransform ScLcms2ColorMgmtEngineImpl::createTransform(ScColorMgmtEngine& engine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
const ScColorProfile& outputProfile, eColorFormat outputFormat,
eRenderIntent renderIntent, long transformFlags)
{
ScColorTransform transform(NULL);
if (inputProfile.isNull() || outputProfile.isNull())
return transform;
int inputProfEngineID = inputProfile.engine().engineID();
int outputProfEngineID = outputProfile.engine().engineID();
if ((engine.engineID() != m_engineID) || (inputProfEngineID != m_engineID) || (outputProfEngineID != m_engineID))
return transform;
const ScLcms2ColorProfileImpl* lcmsInputProf = dynamic_cast<const ScLcms2ColorProfileImpl*>(inputProfile.data());
const ScLcms2ColorProfileImpl* lcmsOutputProf = dynamic_cast<const ScLcms2ColorProfileImpl*>(outputProfile.data());
if (!lcmsInputProf || !lcmsOutputProf)
return transform;
transformFlags &= (~Ctf_Softproofing);
transformFlags &= (~Ctf_GamutCheck);
long strategyFlags = 0;
if (m_strategy.useBlackPointCompensation)
strategyFlags |= Ctf_BlackPointCompensation;
if (m_strategy.useBlackPreservation)
strategyFlags |= Ctf_BlackPreservation;
ScColorTransformInfo transInfo;
transInfo.inputProfile = inputProfile.productDescription();
transInfo.outputProfile = outputProfile.productDescription();
transInfo.proofingProfile = QString();
transInfo.inputFormat = inputFormat;
transInfo.outputFormat = outputFormat;
transInfo.renderIntent = renderIntent;
transInfo.proofingIntent = (eRenderIntent) 0;
transInfo.flags = transformFlags | strategyFlags;
bool nullTransform = false;
if (transInfo.inputProfile == transInfo.outputProfile)
{
// This is a null transform
transInfo.inputProfile = QString();
transInfo.outputProfile = QString();
transInfo.proofingProfile = QString();
transInfo.renderIntent = (eRenderIntent) 0;
transInfo.proofingIntent = (eRenderIntent) 0;
transInfo.flags = 0;
nullTransform = true;
}
transform = m_transformPool->findTransform(transInfo);
if (transform.isNull())
{
cmsUInt32Number lcmsFlags = translateFlagsToLcmsFlags(transformFlags | strategyFlags);
cmsUInt32Number lcmsInputFmt = translateFormatToLcmsFormat(inputFormat);
cmsUInt32Number lcmsOutputFmt = translateFormatToLcmsFormat(outputFormat);
int lcmsIntent = translateIntentToLcmsIntent(renderIntent);
if (nullTransform)
lcmsFlags |= cmsFLAGS_NULLTRANSFORM;
cmsHTRANSFORM hTransform = NULL;
hTransform = cmsCreateTransform(lcmsInputProf->m_profileHandle , lcmsInputFmt,
lcmsOutputProf->m_profileHandle, lcmsOutputFmt,
lcmsIntent, lcmsFlags | cmsFLAGS_LOWRESPRECALC);
if (hTransform)
{
ScLcms2ColorTransformImpl* newTrans = new ScLcms2ColorTransformImpl(engine, hTransform);
newTrans->setTransformInfo(transInfo);
transform = ScColorTransform(dynamic_cast<ScColorTransformData*>(newTrans));
m_transformPool->addTransform(transform, true);
}
}
return transform;
}