本文整理汇总了C++中ScColor::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ ScColor::setColor方法的具体用法?C++ ScColor::setColor怎么用?C++ ScColor::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScColor
的用法示例。
在下文中一共展示了ScColor::setColor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToModel
ScColor ScColorEngine::convertToModel(const ScColor& color, const ScribusDoc* doc, colorModel model)
{
colorModel oldModel = color.getColorModel();
if( oldModel == model )
return ScColor(color);
ScColor newCol;
if (model == colorModelRGB)
{
RGBColor rgb;
getRGBValues(color, doc, rgb);
newCol.setColorRGB(rgb.r, rgb.g, rgb.b);
}
else if (model == colorModelCMYK)
{
CMYKColor cmyk;
getCMYKValues(color, doc, cmyk);
newCol.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
}
else if (model == colorModelLab)
{
ScColorMgmtEngine engine(ScCore->defaultEngine);
if (oldModel == colorModelRGB)
{
ScColorProfile profRGB = doc ? doc->DocInputRGBProf : ScCore->defaultRGBProfile;
ScColorProfile profLab = ScCore->defaultLabProfile;
ScColorTransform trans = engine.createTransform(profRGB, Format_RGB_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
double outC[3];
unsigned short inC[3];
inC[0] = color.CR * 257;
inC[1] = color.MG * 257;
inC[2] = color.YB * 257;
trans.apply(inC, outC, 1);
newCol.setColor(outC[0], outC[1], outC[2]);
}
else
{
ScColorProfile profRGB = doc ? doc->DocInputCMYKProf : ScCore->defaultCMYKProfile;
ScColorProfile profLab = ScCore->defaultLabProfile;
ScColorTransform trans = engine.createTransform(profRGB, Format_CMYK_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
double outC[3];
unsigned short inC[4];
inC[0] = color.CR * 257;
inC[1] = color.MG * 257;
inC[2] = color.YB * 257;
inC[3] = color.K * 257;
trans.apply(inC, outC, 1);
newCol.setColor(outC[0], outC[1], outC[2]);
}
}
return newCol;
}
示例2: ScColor
void CMYKChoose::setColor2(int h, int s, bool ende)
{
ScColor tmp;
if (Farbe.getColorModel() == colorModelLab)
{
if (isHLC)
tmp = ScColor(MagentaSp->value(), static_cast<double>(h), static_cast<double>(s));
else
tmp = ScColor(CyanSp->value(), static_cast<double>(h), static_cast<double>(s));
}
else
{
QColor tm = QColor::fromHsv(qMax(qMin(359,h),0), qMax(qMin(255,255-s),0), 255-BlackComp, QColor::Hsv);
int r, g, b;
tm.getRgb(&r, &g, &b);
tmp.fromQColor(tm);
if (Farbe.getColorModel() == colorModelCMYK)
{
CMYKColor cmyk;
ScColorEngine::getCMYKValues(tmp, m_doc, cmyk);
tmp.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
}
}
imageN.fill( ScColorEngine::getDisplayColor(tmp, m_doc) );
if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
paintAlert(alertIcon, imageN, 2, 2, false);
NewC->setPixmap( imageN );
Farbe = tmp;
if (ende)
setValues();
}
示例3: defColor
void XtgScanner::defColor()
{
bool isSpot = false;
ScColor tmp;
enterState(stringMode);
token = getToken();
while (lookAhead() != '>' )
{
token = getToken();
if ((token == "CMJN") || (token == "CMYK"))
{
enterState(tagMode);
token = getToken();
if (token == "S")
{
token = getToken();
isSpot = true;
}
double c = getToken().toDouble();
double m = getToken().toDouble();
double y = getToken().toDouble();
double k = getToken().toDouble();
tmp.setColor(qRound(c * 2.55), qRound(m * 255), qRound(y * 255), qRound(k * 255));
tmp.setSpotColor(isSpot);
tmp.setRegistrationColor(false);
doc->PageColors.tryAddColor(sfcName, tmp);
}
else if (token == "RGB")
{
enterState(tagMode);
token = getToken();
if (token == "S")
{
token = getToken();
isSpot = true;
}
double r = getToken().toDouble();
double g = getToken().toDouble();
double b = getToken().toDouble();
tmp.setColorRGB(qRound(r * 2.55), qRound(g * 255), qRound(b * 255));
tmp.setSpotColor(isSpot);
tmp.setRegistrationColor(false);
doc->PageColors.tryAddColor(sfcName, tmp);
}
}
top++;
enterState(textMode);
}
示例4: convertToModel
ScColor ScColorEngine::convertToModel(const ScColor& color, const ScribusDoc* doc, colorModel model)
{
colorModel oldModel = color.getColorModel();
if( oldModel == model )
return ScColor(color);
ScColor newCol;
if( model == colorModelRGB )
{
RGBColor rgb;
getRGBValues(color, doc, rgb);
newCol.setColorRGB(rgb.r, rgb.g, rgb.b);
}
else
{
CMYKColor cmyk;
getCMYKValues(color, doc, cmyk);
newCol.setColor(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
}
return newCol;
}
示例5: setColor
void CMYKChoose::setColor()
{
int c, m, y;
int h, s, v;
int k = 0;
double L, a, b;
ScColor tmp;
if (Farbe.getColorModel() == colorModelCMYK)
{
c = qRound(CyanSp->value() * 2.55);
m = qRound(MagentaSp->value() * 2.55);
y = qRound(YellowSp->value() * 2.55);
k = qRound(BlackSp->value() * 2.55);
tmp.setColor(c, m, y, k);
Farbe = tmp;
if (dynamic)
{
CyanSL->setPalette(sliderPix(180));
MagentaSL->setPalette(sliderPix(300));
YellowSL->setPalette(sliderPix(60));
BlackSL->setPalette(sliderBlack());
}
BlackComp = k;
ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
ColorMap->drawPalette(v);
ColorMap->setMark(h, s);
}
else if (Farbe.getColorModel() == colorModelRGB)
{
c = qRound(CyanSp->value());
m = qRound(MagentaSp->value());
y = qRound(YellowSp->value());
k = qRound(BlackSp->value());
if (Wsave)
{
blockSignals(true);
c = c / 51 * 51;
m = m / 51 * 51;
y = y / 51 * 51;
CyanSp->setValue(c);
MagentaSp->setValue(m);
YellowSp->setValue(y);
CyanSL->setValue(c * 1000.0);
MagentaSL->setValue(m * 1000.0);
YellowSL->setValue(y * 1000.0);
blockSignals(false);
}
tmp.setColorRGB(c, m, y);
QColor tmp2 = QColor(c, m, y);
tmp2.getHsv(&h, &s, &v);
BlackComp = 255 - v;
Farbe = tmp;
if (dynamic)
{
CyanSL->setPalette(sliderPix(0));
MagentaSL->setPalette(sliderPix(120));
YellowSL->setPalette(sliderPix(240));
}
BlackComp = k;
ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
ColorMap->drawPalette(v);
ColorMap->setMark(h, s);
}
else if (Farbe.getColorModel() == colorModelLab)
{
double Lalt;
Farbe.getLab(&Lalt, &a, &b);
if (isHLC)
{
L = MagentaSp->value();
double cv = 360 - CyanSp->value();
double yv = YellowSp->value();
QLineF lin = QLineF::fromPolar(yv, cv);
a = lin.p2().x();
b = lin.p2().y();
}
else
{
L = CyanSp->value();
a = MagentaSp->value();
b = YellowSp->value();
}
tmp.setColor(L, a, b);
Farbe = tmp;
if (dynamic)
{
CyanSL->setPalette(sliderPix(0));
MagentaSL->setPalette(sliderPix(120));
YellowSL->setPalette(sliderPix(240));
}
BlackComp = qRound(L * 2.55);
if (L != Lalt)
ColorMap->drawPalette(L * 2.55);
ColorMap->setMark(a, b);
}
imageN.fill(ScColorEngine::getDisplayColor(tmp, m_doc) );
if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
paintAlert(alertIcon, imageN, 2, 2, false);
NewC->setPixmap( imageN );
}
示例6: initialiseDefaultPrefs
void ColorSetManager::initialiseDefaultPrefs(struct ApplicationPrefs& appPrefs)
{
QString defaultSwatch = ScPaths::instance().shareDir() + "swatches/" + "Scribus_Basic.xml";
QFile fiC(defaultSwatch);
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(defaultSwatch, 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 if (pg.hasAttribute("RGB"))
lf.fromQColor(QColor(pg.attribute("RGB")));
else
{
double L = pg.attribute("L", 0).toDouble();
double a = pg.attribute("A", 0).toDouble();
double b = pg.attribute("B", 0).toDouble();
lf.setColor(L, a, b);
}
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 = ScPaths::instance().shareDir() + "swatches/" + "Scribus Basic";
}
示例7: importColorsFromFile
//.........这里部分代码省略.........
else if (pg.tagName()=="draw:color" && pg.attribute("draw:name")!=CommonStrings::None)
{
if (pg.hasAttribute("draw:color"))
lf.setNamedColor(pg.attribute("draw:color"));
lf.setSpotColor(false);
lf.setRegistrationColor(false);
QString nam = pg.attribute("draw:name");
if (!nam.isEmpty())
EditColors.tryAddColor(nam, lf);
}
else if (dTag == "VivaColors")
{
int cVal = 0;
int mVal = 0;
int yVal = 0;
int kVal = 0;
QString nam = nameMask.arg(pg.attribute("name"));
if (pg.attribute("type") == "cmyk")
{
QDomNode colNode = pg.firstChild();
while (!colNode.isNull())
{
QDomElement colVal = colNode.toElement();
if (colVal.tagName() == "cyan")
cVal = colVal.text().toInt();
if (colVal.tagName() == "magenta")
mVal = colVal.text().toInt();
if (colVal.tagName() == "yellow")
yVal = colVal.text().toInt();
if (colVal.tagName() == "key")
kVal = colVal.text().toInt();
colNode = colNode.nextSibling();
}
lf.setColorF(cVal / 100.0, mVal / 100.0, yVal / 100.0, kVal / 100.0);
lf.setSpotColor(false);
lf.setRegistrationColor(false);
if (!nam.isEmpty())
EditColors.tryAddColor(nam, lf);
}
else if (pg.attribute("type") == "rgb")
{
QDomNode colNode = pg.firstChild();
while (!colNode.isNull())
{
QDomElement colVal = colNode.toElement();
if (colVal.tagName() == "red")
cVal = colVal.text().toInt();
if (colVal.tagName() == "green")
mVal = colVal.text().toInt();
if (colVal.tagName() == "blue")
yVal = colVal.text().toInt();
colNode = colNode.nextSibling();
}
lf.setRgbColor(cVal, mVal, yVal);
lf.setSpotColor(false);
lf.setRegistrationColor(false);
if (!nam.isEmpty())
EditColors.tryAddColor(nam, lf);
}
}
PAGE=PAGE.nextSibling();
}
}
else
{
QString paletteName = "";