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


C++ ScColor类代码示例

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


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

示例1: QColor

QString gtAction::parseColor(const QString &s)
{
	QString ret = CommonStrings::None;
	if (s == CommonStrings::None)
		return ret; // don't want None to become Black or any color
	bool found = false;
	ColorList::Iterator it;
	for (it = textFrame->doc()->PageColors.begin(); it != textFrame->doc()->PageColors.end(); ++it)
	{
		if (it.key() == s)
		{
			ret = it.key();
			found = true;
		}
	}
	if (!found)
	{
		QColor c;
		if( s.startsWith( "rgb(" ) )
		{
			QString parse = s.trimmed();
			QStringList colors = parse.split(',', QString::SkipEmptyParts);
			QString r = colors[0].right( ( colors[0].length() - 4 ) );
			QString g = colors[1];
			QString b = colors[2].left( ( colors[2].length() - 1 ) );
			if( r.contains( "%" ) )
			{
				r.chop(1);
				r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
			}
			if( g.contains( "%" ) )
			{
				g.chop(1);
				g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
			}
			if( b.contains( "%" ) )
			{
				b.chop(1);
				b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
			}
			c = QColor(r.toInt(), g.toInt(), b.toInt());
		}
		else
		{
			QString rgbColor = s.trimmed();
			if( rgbColor.startsWith( "#" ) )
				c.setNamedColor( rgbColor );
			else
				c = parseColorN( rgbColor );
		}
		found = false;
		for (it = textFrame->doc()->PageColors.begin(); it != textFrame->doc()->PageColors.end(); ++it)
		{
			if (c == ScColorEngine::getRGBColor(it.value(), textFrame->doc()))
			{
				ret = it.key();
				found = true;
			}
		}
		if (!found)
		{
			ScColor tmp;
			tmp.fromQColor(c);
			textFrame->doc()->PageColors.insert("FromGetText"+c.name(), tmp);
			m_ScMW->propertiesPalette->updateColorList();
			ret = "FromGetText"+c.name();
		}
	}
	return ret;
}
开发者ID:QuLogic,项目名称:ScribusCTL,代码行数:70,代码来源:gtaction.cpp

示例2: ScColor

void ColorList::ensureRegistration(void)
{
	ScColor cc = ScColor(255, 255, 255, 255);
	cc.setRegistrationColor(true);
	insert("Registration", cc);
}
开发者ID:gyuris,项目名称:scribus,代码行数:6,代码来源:sccolor.cpp

示例3: loadRawText

bool PaletteLoader_Autocad_acb::importFile(const QString& fileName, bool /*merge*/)
{
	QByteArray docBytes;
	loadRawText(fileName, docBytes);
	QString docText = QString::fromUtf8(docBytes);
	QDomDocument docu("scridoc");
	if (!docu.setContent(docText))
		return false;

	ScColor lf;
	int oldCount = m_colors->count();

	QDomElement elem = docu.documentElement();
	QDomNode PAGE = elem.firstChild();
	while (!PAGE.isNull())
	{
		QDomElement pg = PAGE.toElement();
		if (pg.tagName() == "colorPage")
		{
			QDomNode colNode = pg.firstChild();
			while (!colNode.isNull())
			{
				QDomElement cg = colNode.toElement();
				if (cg.tagName() == "colorEntry")
				{
					int r (0), g(0), b(0);
					QString colorName = "";
					QDomNode colEntry = cg.firstChild();
					while (!colEntry.isNull())
					{
						QDomElement cc = colEntry.toElement();
						if (cc.tagName() == "colorName")
							colorName = cc.text();
						else if (cc.tagName() == "RGB8")
						{
							QDomNode colVal = cc.firstChild();
							while (!colVal.isNull())
							{
								QDomElement cv = colVal.toElement();
								if (cv.tagName() == "red")
									r = cv.text().toInt();
								else if (cv.tagName() == "green")
									g = cv.text().toInt();
								else if (cv.tagName() == "blue")
									b = cv.text().toInt();
								colVal = colVal.nextSibling();
							}
						}
						colEntry = colEntry.nextSibling();
					}
					if (!colorName.isEmpty())
					{
						lf.setRgbColor(r, g, b);
						lf.setSpotColor(false);
						lf.setRegistrationColor(false);
						m_colors->tryAddColor(colorName, lf);
					}
				}
				colNode = colNode.nextSibling();
			}
		}
		PAGE = PAGE.nextSibling();
	}
	
	return (m_colors->count() != oldCount);
}
开发者ID:luzpaz,项目名称:scribus,代码行数:66,代码来源:paletteloader_autocad_acb.cpp

示例4: fiC

void ColorSetManager::initialiseDefaultPrefs(struct ApplicationPrefs& appPrefs)
{
	QString pfadC = ScPaths::instance().libDir()+"swatches/";
	QString pfadC2 = pfadC + "Scribus_Basic.xml";
	QFile fiC(pfadC2);
	if (!fiC.exists())
	{
		appPrefs.colorPrefs.DColors.insert("White", ScColor(0, 0, 0, 0));
		appPrefs.colorPrefs.DColors.insert("Black", ScColor(0, 0, 0, 255));
		ScColor cc = ScColor(255, 255, 255, 255);
		cc.setRegistrationColor(true);
		appPrefs.colorPrefs.DColors.insert("Registration", cc);
		appPrefs.colorPrefs.DColors.insert("Blue", ScColor(255, 255, 0, 0));
		appPrefs.colorPrefs.DColors.insert("Cyan", ScColor(255, 0, 0, 0));
		appPrefs.colorPrefs.DColors.insert("Green", ScColor(255, 0, 255, 0));
		appPrefs.colorPrefs.DColors.insert("Red", ScColor(0, 255, 255, 0));
		appPrefs.colorPrefs.DColors.insert("Yellow", ScColor(0, 0, 255, 0));
		appPrefs.colorPrefs.DColors.insert("Magenta", ScColor(0, 255, 0, 0));
		appPrefs.colorPrefs.DColorSet = "Scribus-Small";
	}
	else
	{
		if (fiC.open(QIODevice::ReadOnly))
		{
			QString ColorEn, Cname;
			int Rval, Gval, Bval;
			QTextStream tsC(&fiC);
			ColorEn = tsC.readLine();
			if (ColorEn.startsWith("<?xml version="))
			{
				QByteArray docBytes("");
				loadRawText(pfadC2, docBytes);
				QString docText("");
				docText = QString::fromUtf8(docBytes);
				QDomDocument docu("scridoc");
				docu.setContent(docText);
				ScColor lf = ScColor();
				QDomElement elem = docu.documentElement();
				QDomNode PAGE = elem.firstChild();
				while(!PAGE.isNull())
				{
					QDomElement pg = PAGE.toElement();
					if(pg.tagName()=="COLOR" && pg.attribute("NAME")!=CommonStrings::None)
					{
						if (pg.hasAttribute("CMYK"))
							lf.setNamedColor(pg.attribute("CMYK"));
						else
							lf.fromQColor(QColor(pg.attribute("RGB")));
						if (pg.hasAttribute("Spot"))
							lf.setSpotColor(static_cast<bool>(pg.attribute("Spot").toInt()));
						else
							lf.setSpotColor(false);
						if (pg.hasAttribute("Register"))
							lf.setRegistrationColor(static_cast<bool>(pg.attribute("Register").toInt()));
						else
							lf.setRegistrationColor(false);
						appPrefs.colorPrefs.DColors.insert(pg.attribute("NAME"), lf);
					}
					PAGE=PAGE.nextSibling();
				}
			}
			else
			{
				while (!tsC.atEnd())
				{
					ColorEn = tsC.readLine();
					QTextStream CoE(&ColorEn, QIODevice::ReadOnly);
					CoE >> Rval;
					CoE >> Gval;
					CoE >> Bval;
					CoE >> Cname;
					ScColor tmp;
					tmp.setColorRGB(Rval, Gval, Bval);
					appPrefs.colorPrefs.DColors.insert(Cname, tmp);
				}
			}
			fiC.close();
		}
		appPrefs.colorPrefs.DColorSet = "Scribus Basic";
	}
开发者ID:avary,项目名称:scribus,代码行数:80,代码来源:colorsetmanager.cpp

示例5: importColorsFromFile


//.........这里部分代码省略.........
			}
			return false;
		}
		else if (ext == "sbz")
		{
			PaletteLoader_Swatchbook swatchbookLoader;
			if (swatchbookLoader.isFileSupported(fileName))
			{
				swatchbookLoader.setupTargets(&EditColors, dialogGradients);
				return swatchbookLoader.importFile(fileName, merge);
			}
			return false;
		}
		else							// try for OpenOffice, Viva and our own format
		{
			QFile fiC(fileName);
			if (fiC.open(QIODevice::ReadOnly))
			{
				QString ColorEn, Cname;
				int Rval, Gval, Bval, Kval;
				ScTextStream tsC(&fiC);
				ColorEn = tsC.readLine();
				bool cus = false;
				if (ColorEn.contains("OpenOffice"))
					cus = true;
				if ((ColorEn.startsWith("<?xml version=")) || (ColorEn.contains("VivaColors")))
				{
					QByteArray docBytes("");
					loadRawText(fileName, docBytes);
					QString docText("");
					docText = QString::fromUtf8(docBytes);
					QDomDocument docu("scridoc");
					docu.setContent(docText);
					ScColor lf = ScColor();
					QDomElement elem = docu.documentElement();
					QString dTag = "";
					dTag = elem.tagName();
					QString nameMask = "%1";
					nameMask = elem.attribute("mask", "%1");
					QDomNode PAGE = elem.firstChild();
					while (!PAGE.isNull())
					{
						QDomElement pg = PAGE.toElement();
						if (pg.tagName()=="COLOR" && pg.attribute("NAME")!=CommonStrings::None)
						{
							if (pg.hasAttribute("SPACE"))
							{
								QString space = pg.attribute("SPACE");
								if (space == "CMYK")
								{
									double c = pg.attribute("C", "0").toDouble() / 100.0;
									double m = pg.attribute("M", "0").toDouble() / 100.0;
									double y = pg.attribute("Y", "0").toDouble() / 100.0;
									double k = pg.attribute("K", "0").toDouble() / 100.0;
									lf.setCmykColorF(c, m, y, k);
								}
								else if (space == "RGB")
								{
									double r = pg.attribute("R", "0").toDouble() / 255.0;
									double g = pg.attribute("G", "0").toDouble() / 255.0;
									double b = pg.attribute("B", "0").toDouble() / 255.0;
									lf.setRgbColorF(r, g, b);
								}
								else if (space == "Lab")
								{
									double L = pg.attribute("L", "0").toDouble();
开发者ID:HOST-Oman,项目名称:scribus,代码行数:67,代码来源:util_color.cpp

示例6: f

bool PaletteLoader_PS::importFile(const QString& fileName, bool /*merge*/)
{
	QString tmp, colorName;
	double c, m, y, k;
	ScColor cc;
	
	QFile f(fileName);
	if (!f.open(QIODevice::ReadOnly))
		return false;
	int oldCount = m_colors->count();

	bool isAtend = false;
	QDataStream ts(&f);
	while (!ts.atEnd())
	{
		tmp = readLineFromDataStream(ts);
		if ((tmp.startsWith("%%CMYKCustomColor")) || (tmp.startsWith("%%CMYKProcessColor")))
		{
			if (tmp.contains("(atend)"))
				isAtend = true;
			else
			{
				if (tmp.startsWith("%%CMYKCustomColor"))
					tmp = tmp.remove(0,18);
				else if (tmp.startsWith("%%CMYKProcessColor"))
					tmp = tmp.remove(0,19);
				ScTextStream ts2(&tmp, QIODevice::ReadOnly);
				ts2 >> c >> m >> y >> k;
				colorName = ts2.readAll();
				colorName = colorName.trimmed();
				colorName = colorName.remove(0,1);
				colorName = colorName.remove(colorName.length()-1,1);
				colorName = colorName.simplified();
				cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y), qRound(255 * k));
				cc.setSpotColor(true);
				if (!colorName.isEmpty())
					m_colors->tryAddColor(colorName, cc);
				while (!ts.atEnd())
				{
					quint64 oldPos = ts.device()->pos();
					tmp = readLineFromDataStream(ts);
					if (!tmp.startsWith("%%+"))
					{
						ts.device()->seek(oldPos);
						break;
					}
					tmp = tmp.remove(0,3);
					ScTextStream ts2(&tmp, QIODevice::ReadOnly);
					ts2 >> c >> m >> y >> k;
					colorName = ts2.readAll();
					colorName = colorName.trimmed();
					colorName = colorName.remove(0,1);
					colorName = colorName.remove(colorName.length()-1,1);
					colorName = colorName.simplified();
					cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y), qRound(255 * k));
					cc.setSpotColor(true);
					if (!colorName.isEmpty())
						m_colors->tryAddColor(colorName, cc);
				}
			}
		}
		if ((tmp.startsWith("%%RGBCustomColor")) || (tmp.startsWith("%%RGBProcessColor")))
		{
			if (tmp.contains("(atend)"))
				isAtend = true;
			else
			{
				if (tmp.startsWith("%%RGBCustomColor"))
					tmp = tmp.remove(0,17);
				else if (tmp.startsWith("%%RGBProcessColor"))
					tmp = tmp.remove(0,18);
				ScTextStream ts2(&tmp, QIODevice::ReadOnly);
				ts2 >> c >> m >> y;
				colorName = ts2.readAll();
				colorName = colorName.trimmed();
				colorName = colorName.remove(0,1);
				colorName = colorName.remove(colorName.length()-1,1);
				colorName = colorName.simplified();
				cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y));
				if (!colorName.isEmpty())
					m_colors->tryAddColor(colorName, cc);
				while (!ts.atEnd())
				{
					quint64 oldPos = ts.device()->pos();
					tmp = readLineFromDataStream(ts);
					if (!tmp.startsWith("%%+"))
					{
						ts.device()->seek(oldPos);
						break;
					}
					tmp = tmp.remove(0,3);
					ScTextStream ts2(&tmp, QIODevice::ReadOnly);
					ts2 >> c >> m >> y;
					colorName = ts2.readAll();
					colorName = colorName.trimmed();
					colorName = colorName.remove(0,1);
					colorName = colorName.remove(colorName.length()-1,1);
					colorName = colorName.simplified();
					cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y));
					if (!colorName.isEmpty())
//.........这里部分代码省略.........
开发者ID:HOST-Oman,项目名称:scribus,代码行数:101,代码来源:paletteloader_ps.cpp

示例7: QDialog

CWDialog::CWDialog(QWidget* parent, ScribusDoc* doc, const char* name, bool modal)
	: QDialog (parent),
	  m_Doc(doc)
{
	setupUi(this);
	setObjectName(name);
	setModal(modal);
	int h, s, v;
	ScColor color;
	QString colorName;
	connectSlots(false);
	// setup combobox
	typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Monochromatic), colorWheel->Monochromatic);
	typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Analogous), colorWheel->Analogous);
	typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Complementary), colorWheel->Complementary);
	typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Split), colorWheel->Split);
	typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Triadic), colorWheel->Triadic);
	typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Tetradic), colorWheel->Tetradic);
	// defects
	defectCombo->addItem(CommonStrings::trVisionNormal);
	defectCombo->addItem(CommonStrings::trVisionProtanopia);
	defectCombo->addItem(CommonStrings::trVisionDeuteranopia);
	defectCombo->addItem(CommonStrings::trVisionTritanopia);
	defectCombo->addItem(CommonStrings::trVisionFullColorBlind);
	// document colors
	documentColorList->updateBox(m_Doc->PageColors, ColorListBox::fancyPixmap);
	// preferences
	prefs = PrefsManager::instance()->prefsFile->getPluginContext("colorwheel");
	typeCombo->setCurrentIndex(prefs->getInt("cw_type", 0));
	angleSpin->setValue(prefs->getInt("cw_angle", 15));
	colorWheel->currentDoc = m_Doc;
	colorWheel->angle = angleSpin->value();
	colorWheel->baseAngle = prefs->getInt("cw_baseangle", 0);
	colorspaceTab->setCurrentIndex(prefs->getInt("cw_space", 0));
	color.setNamedColor(prefs->get("cw_color", "#00000000"));
	// Handle color previously selected in the document tab
	if (colorspaceTab->currentWidget() == tabDocument)
	{
		colorName = prefs->get("cw_colorname", "");
		if (!colorName.isEmpty() && m_Doc->PageColors.contains(colorName))
			color = m_Doc->PageColors[colorName];
		else
			color.setColorRGB(0, 0, 0); //Trigger use of defaults
	}
	// Handle achromatic colors
	QColor rgb = ScColorEngine::getRGBColor(color, m_Doc);
	rgb.getHsv(&h, &s, &v);
	if (h == -1)
	{   // Reset to defaults
		colorWheel->baseAngle = 0;
		colorWheel->currentColorSpace = colorModelCMYK;
		colorWheel->actualColor = colorWheel->colorByAngle(0);
		colorspaceTab->setCurrentIndex(0);
	}
	else if (colorspaceTab->currentWidget() == tabDocument)
	{
		colorWheel->actualColor = color;
		QList<QListWidgetItem*> results = documentColorList->findItems(colorName, Qt::MatchFixedString|Qt::MatchCaseSensitive);
		if (results.count() > 0)
			documentColorList->setCurrentItem(results[0]);
	}
	else
		colorWheel->actualColor = color;

	resize(QSize(prefs->getInt("cw_width", 640),
		   prefs->getInt("cw_height", 480)).expandedTo(minimumSizeHint()));
	previewLabel->resize(prefs->getInt("cw_samplex", 300), prefs->getInt("cw_sampley", 100));
		
	// setup
	currentColorTable->horizontalHeader()->hide();
	colorspaceTab_currentChanged(colorspaceTab->currentIndex());

	// signals and slots that cannot be in ui file
	connect(colorWheel, SIGNAL(clicked(int, const QPoint&)),
			this, SLOT(colorWheel_clicked(int, const QPoint&)));
	connect(documentColorList, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
			this, SLOT(documentColorList_currentChanged(QListWidgetItem *)));
	connect(colorList, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
			this, SLOT(colorList_currentChanged(QListWidgetItem *)));
	connect(angleSpin, SIGNAL(valueChanged(int)),
			this, SLOT(angleSpin_valueChanged(int)));
	connect(colorspaceTab, SIGNAL(currentChanged(int)),
			this, SLOT(colorspaceTab_currentChanged(int)));
	connect(typeCombo, SIGNAL(activated(int)), this, SLOT(typeCombo_activated(int)));
	connect(defectCombo, SIGNAL(activated(int)), this, SLOT(defectCombo_activated(int)));
	connect(addButton, SIGNAL(clicked()), this, SLOT(addButton_clicked()));
	connect(replaceButton, SIGNAL(clicked()), this, SLOT(replaceButton_clicked()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_clicked()));

	connectSlots(true);
}
开发者ID:WOF-Softwares,项目名称:ScribusCTL,代码行数:91,代码来源:cwdialog.cpp

示例8: if

void ScColorEngine::getRGBValues(const ScColor& color, const ScribusDoc* doc, RGBColor& rgb)
{
	colorModel    model = color.getColorModel();
	ScColorTransform transRGB = doc ? doc->stdTransRGB : ScCore->defaultCMYKToRGBTrans;
	if (ScCore->haveCMS() && transRGB)
	{
		if (model == colorModelRGB)
		{
			rgb.r = color.CR;
			rgb.g = color.MG;
			rgb.b = color.YB;
		}
		else if (model == colorModelCMYK)
		{
			unsigned short inC[4];
			unsigned short outC[4];
			inC[0] = color.CR * 257;
			inC[1] = color.MG * 257;
			inC[2] = color.YB * 257;
			inC[3] = color.K * 257;
			transRGB.apply(inC, outC, 1);
			rgb.r = outC[0] / 257;
			rgb.g = outC[1] / 257;
			rgb.b = outC[2] / 257;
		}
		else if (model == colorModelLab)
		{
			ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
			double inC[3];
			inC[0] = color.L_val;
			inC[1] = color.a_val;
			inC[2] = color.b_val;
			quint16 outC[3];
			trans.apply(inC, outC, 1);
			rgb.r = outC[0] / 257;
			rgb.g = outC[1] / 257;
			rgb.b = outC[2] / 257;
		}
	}
	else if (model == colorModelCMYK)
	{
		rgb.r = 255 - qMin(255, color.CR + color.K);
		rgb.g = 255 - qMin(255, color.MG + color.K);
		rgb.b = 255 - qMin(255, color.YB + color.K);
	}
	else if (model == colorModelRGB)
	{
		rgb.r = color.CR;
		rgb.g = color.MG;
		rgb.b = color.YB;
	}
	else if (model == colorModelLab)
	{
		ScColorTransform trans = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
		double inC[3];
		inC[0] = color.L_val;
		inC[1] = color.a_val;
		inC[2] = color.b_val;
		quint16 outC[3];
		trans.apply(inC, outC, 1);
		rgb.r = outC[0] / 257;
		rgb.g = outC[1] / 257;
		rgb.b = outC[2] / 257;
	}
}
开发者ID:WOF-Softwares,项目名称:ScribusCTL,代码行数:65,代码来源:sccolorengine.cpp

示例9: getShadeColorRGB

QColor ScColorEngine::getShadeColorProof(const ScColor& color, const ScribusDoc* doc, double level)
{
	QColor tmp;
	bool doGC = doc ? doc->Gamut : false;
	bool cmsUse = doc ? doc->HasCMS : false;
	bool softProof = doc ? doc->SoftProofing : false;

	if (color.getColorModel() == colorModelRGB)
	{
		RGBColor rgb;
		rgb.r = color.CR;
		rgb.g = color.MG;
		rgb.b = color.YB;
		getShadeColorRGB(color, doc, rgb, level);
		// Match 133x behavior for rgb grey until we are able to make rgb profiled output
		// (RGB greys map to cmyk greys)
		if ((cmsUse && softProof) && (rgb.r == rgb.g && rgb.g == rgb.b))
		{
			doGC = false;
			CMYKColor cmyk;
			cmyk.c = cmyk.m = cmyk.y = 0;
			cmyk.k = 255 - rgb.g;
			tmp = getColorProof(cmyk, doc, color.isSpotColor(), doGC);
		}
		else
			tmp = getColorProof(rgb, doc, color.isSpotColor(), doGC);
	}
	else if (color.getColorModel() == colorModelCMYK)
	{
		CMYKColor cmyk;
		cmyk.c = color.CR;
		cmyk.m = color.MG;
		cmyk.y = color.YB;
		cmyk.k = color.K;
		getShadeColorCMYK(color, doc, cmyk, level);
		tmp = getColorProof(cmyk, doc, color.isSpotColor(), doGC);
	}
	else if (color.getColorModel() == colorModelLab)
	{
		double inC[3];
		inC[0] = color.L_val * (level / 100.0);
		inC[1] = color.a_val;
		inC[2] = color.b_val;
		quint16 outC[3];
		ScColorTransform trans  = doc ? doc->stdLabToRGBTrans : ScCore->defaultLabToRGBTrans;
		ScColorTransform transProof   = doc ? doc->stdProofLab   : ScCore->defaultLabToRGBTrans;
		ScColorTransform transProofGC = doc ? doc->stdProofLabGC : ScCore->defaultLabToRGBTrans;
		if (cmsUse & doc->SoftProofing)
		{
			ScColorTransform xform = doGC ? transProofGC : transProof;
			xform.apply(inC, outC, 1);
			tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
		}
		else
		{
			trans.apply(inC, outC, 1);
			tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
		}
	}
	
	return tmp;
}
开发者ID:WOF-Softwares,项目名称:ScribusCTL,代码行数:62,代码来源:sccolorengine.cpp

示例10: importColorsFromFile

bool importColorsFromFile(QString fileName, ColorList &EditColors)
{
    int oldCount = EditColors.count();
    if (!fileName.isEmpty())
    {
        QFileInfo fi = QFileInfo(fileName);
        QString ext = fi.suffix().toLower();
        if (extensionIndicatesEPSorPS(ext) || (ext == "ai"))
        {
            QString tmp, tmp2, FarNam;
            double c, m, y, k;
            ScColor cc;
            QFile f(fileName);
            if (f.open(QIODevice::ReadOnly))
            {
                bool isAtend = false;
                QDataStream ts(&f);
                while (!ts.atEnd())
                {
                    tmp = readLinefromDataStream(ts);
                    if ((tmp.startsWith("%%CMYKCustomColor")) || (tmp.startsWith("%%CMYKProcessColor")))
                    {
                        if (tmp.contains("(atend)"))
                            isAtend = true;
                        else
                        {
                            if (tmp.startsWith("%%CMYKCustomColor"))
                                tmp = tmp.remove(0,18);
                            else if (tmp.startsWith("%%CMYKProcessColor"))
                                tmp = tmp.remove(0,19);
                            ScTextStream ts2(&tmp, QIODevice::ReadOnly);
                            ts2 >> c >> m >> y >> k;
                            FarNam = ts2.readAll();
                            FarNam = FarNam.trimmed();
                            FarNam = FarNam.remove(0,1);
                            FarNam = FarNam.remove(FarNam.length()-1,1);
                            FarNam = FarNam.simplified();
                            cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y), qRound(255 * k));
                            cc.setSpotColor(true);
                            if ((!EditColors.contains(FarNam)) && (!FarNam.isEmpty()))
                                EditColors.insert(FarNam, cc);
                            while (!ts.atEnd())
                            {
                                quint64 oldPos = ts.device()->pos();
                                tmp = readLinefromDataStream(ts);
                                if (!tmp.startsWith("%%+"))
                                {
                                    ts.device()->seek(oldPos);
                                    break;
                                }
                                tmp = tmp.remove(0,3);
                                ScTextStream ts2(&tmp, QIODevice::ReadOnly);
                                ts2 >> c >> m >> y >> k;
                                FarNam = ts2.readAll();
                                FarNam = FarNam.trimmed();
                                FarNam = FarNam.remove(0,1);
                                FarNam = FarNam.remove(FarNam.length()-1,1);
                                FarNam = FarNam.simplified();
                                cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y), qRound(255 * k));
                                cc.setSpotColor(true);
                                if ((!EditColors.contains(FarNam)) && (!FarNam.isEmpty()))
                                    EditColors.insert(FarNam, cc);
                            }
                        }
                    }
                    if (tmp.startsWith("%%RGBCustomColor"))
                    {
                        if (tmp.contains("(atend)"))
                            isAtend = true;
                        else
                        {
                            tmp = tmp.remove(0,17);
                            ScTextStream ts2(&tmp, QIODevice::ReadOnly);
                            ts2 >> c >> m >> y;
                            FarNam = ts2.readAll();
                            FarNam = FarNam.trimmed();
                            FarNam = FarNam.remove(0,1);
                            FarNam = FarNam.remove(FarNam.length()-1,1);
                            FarNam = FarNam.simplified();
                            cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y));
                            if ((!EditColors.contains(FarNam)) && (!FarNam.isEmpty()))
                                EditColors.insert(FarNam, cc);
                            while (!ts.atEnd())
                            {
                                quint64 oldPos = ts.device()->pos();
                                tmp = readLinefromDataStream(ts);
                                if (!tmp.startsWith("%%+"))
                                {
                                    ts.device()->seek(oldPos);
                                    break;
                                }
                                tmp = tmp.remove(0,3);
                                ScTextStream ts2(&tmp, QIODevice::ReadOnly);
                                ts2 >> c >> m >> y;
                                FarNam = ts2.readAll();
                                FarNam = FarNam.trimmed();
                                FarNam = FarNam.remove(0,1);
                                FarNam = FarNam.remove(FarNam.length()-1,1);
                                FarNam = FarNam.simplified();
                                cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * y));
//.........这里部分代码省略.........
开发者ID:pvanek,项目名称:scribus-cuba-1.5.0,代码行数:101,代码来源:util_color.cpp

示例11: while

void ShapePlug::parseGroup(QDomNode &DOC)
{
	QString tmp = "";
	QString FillCol = "White";
	QString StrokeCol = "Black";
	QString defFillCol = "White";
	QString defStrokeCol = "Black";
	QColor stroke = Qt::black;
	QColor fill = Qt::white;
//	Qt::PenStyle Dash = Qt::SolidLine;
	Qt::PenCapStyle LineEnd = Qt::FlatCap;
	Qt::PenJoinStyle LineJoin = Qt::MiterJoin;
//	int fillStyle = 1;
	double strokewidth = 0.1;
//	bool poly = false;
	while(!DOC.isNull())
	{
		double x1, y1, x2, y2;
		StrokeCol = defStrokeCol;
		FillCol = defFillCol;
		stroke = Qt::black;
		fill = Qt::white;
	//	fillStyle = 1;
		strokewidth = 1.0;
	//	Dash = Qt::SolidLine;
		LineEnd = Qt::FlatCap;
		LineJoin = Qt::MiterJoin;
		FPointArray PoLine;
		PoLine.resize(0);
		QDomElement pg = DOC.toElement();
		QString STag = pg.tagName();
		QString style = pg.attribute( "style", "" ).simplified();
		if (style.isEmpty())
			style = pg.attribute( "svg:style", "" ).simplified();
		QStringList substyles = style.split(';', QString::SkipEmptyParts);
		for( QStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it )
		{
			QStringList substyle = (*it).split(':', QString::SkipEmptyParts);
			QString command(substyle[0].trimmed());
			QString params(substyle[1].trimmed());
			if (command == "fill")
			{
				if (!((params == "foreground") || (params == "background") || (params == "fg") || (params == "bg") || (params == "none") || (params == "default") || (params == "inverse")))
				{
					if (params == "nofill")
						FillCol = CommonStrings::None;
					else
					{
						fill.setNamedColor( params );
						FillCol = "FromDia"+fill.name();
						ScColor tmp;
						tmp.fromQColor(fill);
						tmp.setSpotColor(false);
						tmp.setRegistrationColor(false);
						QString fNam = m_Doc->PageColors.tryAddColor(FillCol, tmp);
						if (fNam == FillCol)
							importedColors.append(FillCol);
						FillCol = fNam;
					}
				}
			}
			else if (command == "stroke")
			{
				if (!((params == "foreground") || (params == "background") || (params == "fg") || (params == "bg") || (params == "none") || (params == "default")) || (params == "inverse"))
				{
					stroke.setNamedColor( params );
					StrokeCol = "FromDia"+stroke.name();
					ScColor tmp;
					tmp.fromQColor(stroke);
					tmp.setSpotColor(false);
					tmp.setRegistrationColor(false);
					QString fNam = m_Doc->PageColors.tryAddColor(StrokeCol, tmp);
					if (fNam == StrokeCol)
						importedColors.append(StrokeCol);
					StrokeCol = fNam;
				}
			}
			else if (command == "stroke-width")
				strokewidth = ScCLocale::toDoubleC(params);
			else if( command == "stroke-linejoin" )
			{
				if( params == "miter" )
					LineJoin = Qt::MiterJoin;
				else if( params == "round" )
					LineJoin = Qt::RoundJoin;
				else if( params == "bevel" )
					LineJoin = Qt::BevelJoin;
			}
			else if( command == "stroke-linecap" )
			{
				if( params == "butt" )
					LineEnd = Qt::FlatCap;
				else if( params == "round" )
					LineEnd = Qt::RoundCap;
				else if( params == "square" )
					LineEnd = Qt::SquareCap;
			}
		}
		if (STag == "svg:line")
		{
//.........这里部分代码省略.........
开发者ID:QuLogic,项目名称:ScribusCTL,代码行数:101,代码来源:importshape.cpp


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