当前位置: 首页>>代码示例>>C++>>正文


C++ ScColorProfile::colorSpace方法代码示例

本文整理汇总了C++中ScColorProfile::colorSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ ScColorProfile::colorSpace方法的具体用法?C++ ScColorProfile::colorSpace怎么用?C++ ScColorProfile::colorSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScColorProfile的用法示例。


在下文中一共展示了ScColorProfile::colorSpace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadEmbeddedProfile

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;
					}
				}
			}
		}
	}
}
开发者ID:moceap,项目名称:scribus,代码行数:49,代码来源:scimgdataloader_ps.cpp

示例2: loadEmbeddedProfile

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);
}
开发者ID:AlterScribus,项目名称:ece15,代码行数:46,代码来源:scimgdataloader_jpeg.cpp

示例3: 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;
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:54,代码来源:sccolormgmtenginedata.cpp

示例4: pm


//.........这里部分代码省略.........

	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;
}
开发者ID:AlterScribus,项目名称:ece15,代码行数:101,代码来源:objpdffile.cpp

示例5: updateDocOptions


//.........这里部分代码省略.........
	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;
			}
		}
	}
}
开发者ID:JLuc,项目名称:scribus,代码行数:101,代码来源:pdfopts.cpp

示例6: checkItems


//.........这里部分代码省略.........
                        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)
                                itemError.insert(Transparency, 0);
开发者ID:WOF-Softwares,项目名称:ScribusCTL,代码行数:67,代码来源:documentchecker.cpp


注:本文中的ScColorProfile::colorSpace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。