本文整理汇总了C++中ScColor::getColorModel方法的典型用法代码示例。如果您正苦于以下问题:C++ ScColor::getColorModel方法的具体用法?C++ ScColor::getColorModel怎么用?C++ ScColor::getColorModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScColor
的用法示例。
在下文中一共展示了ScColor::getColorModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selFromSwatch
void CMYKChoose::selFromSwatch(QListWidgetItem* c)
{
disconnect( ComboBox1, SIGNAL(activated(const QString&)), this, SLOT(selModel(const QString&)));
ScColor tmp = CurrSwatch[c->text()];
if (isRegistration)
{
if (tmp.getColorModel() != colorModelCMYK)
tmp = ScColorEngine::convertToModel(tmp, m_doc, colorModelCMYK);
selModel( tr("CMYK"));
}
else
{
if (tmp.getColorModel() == colorModelCMYK)
{
ComboBox1->setCurrentIndex( 0 );
selModel( tr("CMYK"));
}
else
{
ComboBox1->setCurrentIndex( 1 );
selModel( tr("RGB"));
}
}
imageN.fill( ScColorEngine::getDisplayColor(tmp, m_doc) );
if ( ScColorEngine::isOutOfGamut(tmp, m_doc) )
paintAlert(alertIcon, imageN, 2, 2, false);
NewC->setPixmap( imageN );
Farbe = tmp;
setValues();
Separations->setChecked(tmp.isSpotColor());
if ((isNew) && (!ColorName->isModified()))
ColorName->setText(c->text());
connect( ComboBox1, SIGNAL(activated(const QString&)), this, SLOT(selModel(const QString&)));
}
示例2: getDisplayColor
QColor ScColorEngine::getDisplayColor(const ScColor& color, const ScribusDoc* doc, double level)
{
QColor tmp;
if (color.getColorModel() == colorModelRGB)
{
RGBColorF rgb;
rgb.r = color.m_values[0];
rgb.g = color.m_values[1];
rgb.b = color.m_values[2];
getShadeColorRGB(color, doc, rgb, level);
tmp = getDisplayColor(rgb, doc, color.isSpotColor());
}
else if (color.getColorModel() == colorModelCMYK)
{
CMYKColorF cmyk;
cmyk.c = color.m_values[0];
cmyk.m = color.m_values[1];
cmyk.y = color.m_values[2];
cmyk.k = color.m_values[3];
getShadeColorCMYK(color, doc, cmyk, level);
tmp = getDisplayColor(cmyk, doc, color.isSpotColor());
}
else if (color.getColorModel() == colorModelLab)
{
ScColorTransform trans = doc ? doc->stdLabToScreenTrans : ScCore->defaultLabToRGBTrans;
double inC[3];
inC[0] = 100 - (100 - color.m_L_val) * (level / 100.0);
inC[1] = color.m_a_val * (level / 100.0);
inC[2] = color.m_b_val * (level / 100.0);
quint16 outC[3];
trans.apply(inC, outC, 1);
tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
}
return tmp;
}
示例3: getDisplayColor
QColor ScColorEngine::getDisplayColor(const ScColor& color, const ScribusDoc* doc)
{
QColor tmp;
if (color.getColorModel() == colorModelRGB)
{
RGBColor rgb;
rgb.r = color.CR;
rgb.g = color.MG;
rgb.b = color.YB;
tmp = getDisplayColor(rgb, doc, color.isSpotColor());
}
else if (color.getColorModel() == colorModelCMYK)
{
CMYKColor cmyk;
cmyk.c = color.CR;
cmyk.m = color.MG;
cmyk.y = color.YB;
cmyk.k = color.K;
tmp = getDisplayColor(cmyk, doc, color.isSpotColor());
}
else if (color.getColorModel() == 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);
tmp = QColor(outC[0] / 257, outC[1] / 257, outC[2] / 257);
}
return tmp;
}
示例4: getShadeColorCMYK
void ScColorEngine::getShadeColorCMYK(const ScColor& color, const ScribusDoc* doc, CMYKColorF& cmyk, double level)
{
if (color.getColorModel() == colorModelRGB)
{
RGBColorF rgb;
getShadeColorRGB(color, doc, rgb, level);
ScColor tmpR;
tmpR.setRgbColorF(rgb.r, rgb.g, rgb.b);
getCMYKValues(tmpR, doc, cmyk);
}
else if (color.getColorModel() == colorModelCMYK)
{
cmyk.c = color.m_values[0] * level / 100.0;
cmyk.m = color.m_values[1] * level / 100.0;
cmyk.y = color.m_values[2] * level / 100.0;
cmyk.k = color.m_values[3] * level / 100.0;
}
else if (color.getColorModel() == colorModelLab)
{
ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans;
double inC[3];
inC[0] = 100 - (100 - color.m_L_val) * (level / 100.0);
inC[1] = color.m_a_val * (level / 100.0);
inC[2] = color.m_b_val * (level / 100.0);
quint16 outC[4];
trans.apply(inC, outC, 1);
cmyk.c = outC[0] / 65535.0;
cmyk.m = outC[1] / 65535.0;
cmyk.y = outC[2] / 65535.0;
cmyk.k = outC[3] / 65535.0;
}
}
示例5: getShadeColorCMYK
void ScColorEngine::getShadeColorCMYK(const ScColor& color, const ScribusDoc* doc,
CMYKColor& cmyk, double level)
{
if (color.getColorModel() == colorModelRGB)
{
RGBColor rgb;
getShadeColorRGB(color, doc, rgb, level);
ScColor tmpR(rgb.r, rgb.g, rgb.b);
getCMYKValues(tmpR, doc, cmyk);
}
else if (color.getColorModel() == colorModelCMYK)
{
cmyk.c = qRound(color.CR * level / 100.0);
cmyk.m = qRound(color.MG * level / 100.0);
cmyk.y = qRound(color.YB * level / 100.0);
cmyk.k = qRound(color.K * level / 100.0);
}
else if (color.getColorModel() == colorModelLab)
{
ScColorTransform trans = doc ? doc->stdLabToCMYKTrans : ScCore->defaultLabToCMYKTrans;
double inC[3];
inC[0] = color.L_val * (level / 100.0);
inC[1] = color.a_val;
inC[2] = color.b_val;
quint16 outC[4];
trans.apply(inC, outC, 1);
cmyk.c = outC[0] / 257;
cmyk.m = outC[1] / 257;
cmyk.y = outC[2] / 257;
cmyk.k = outC[3] / 257;
}
}
示例6: isOutOfGamut
bool ScColorEngine::isOutOfGamut(const ScColor& color, const ScribusDoc* doc)
{
bool outOfGamutFlag = false;
if (color.isSpotColor())
return false;
unsigned short inC[4];
unsigned short outC[4];
bool cmsUse = doc ? doc->HasCMS : false;
if (ScCore->haveCMS() && cmsUse)
{
bool alert = true;
ScColorTransform xformProof;
if (color.getColorModel() == colorModelRGB)
{
inC[0] = qRound(color.m_values[0] * 65535.0);
inC[1] = qRound(color.m_values[1] * 65535.0);
inC[2] = qRound(color.m_values[2] * 65535.0);
xformProof = doc->stdProofGC;
if ((color.m_values[0] == 0) && (color.m_values[1] == 0) && (color.m_values[2] == 1.0))
alert = false;
if ((color.m_values[0] == color.m_values[1] && color.m_values[1] == color.m_values[2]))
alert = false;
}
else if (color.getColorModel() == colorModelCMYK)
{
inC[0] = qRound(color.m_values[0] * 65535.0);
inC[1] = qRound(color.m_values[1] * 65535.0);
inC[2] = qRound(color.m_values[2] * 65535.0);
inC[3] = qRound(color.m_values[3] * 65535.0);
xformProof = doc->stdProofCMYKGC;
if ((color.m_values[0] == 1.0) && (color.m_values[1] == 0) && (color.m_values[3] == 0) && (color.m_values[2] == 1.0))
alert = false;
if ((color.m_values[0] == 0.0) && (color.m_values[1] == 0) && (color.m_values[2] == 0))
alert = false;
if ((color.m_values[0] == color.m_values[1]) && (color.m_values[0] == color.m_values[2]) && (color.m_values[2] == color.m_values[3]))
alert = false;
}
else if (color.getColorModel() == colorModelLab)
{
double inC[3];
inC[0] = color.m_L_val;
inC[1] = color.m_a_val;
inC[2] = color.m_b_val;
xformProof = doc->stdProofLabGC;
xformProof.apply(inC, outC, 1);
if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
outOfGamutFlag = true;
alert = false;
}
if (alert)
{
xformProof.apply(inC, outC, 1);
if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
outOfGamutFlag = true;
}
}
return outOfGamutFlag;
}
示例7: isOutOfGamut
bool ScColorEngine::isOutOfGamut(const ScColor& color, const ScribusDoc* doc)
{
bool outOfGamutFlag = false;
if (color.isSpotColor())
return false;
unsigned short inC[4];
unsigned short outC[4];
bool cmsUse = doc ? doc->HasCMS : false;
if (ScCore->haveCMS() && cmsUse)
{
bool alert = true;
ScColorTransform xformProof;
if (color.getColorModel() == colorModelRGB)
{
inC[0] = color.CR * 257;
inC[1] = color.MG * 257;
inC[2] = color.YB * 257;
xformProof = doc->stdProofGC;
if ((color.CR == 0) && (color.YB == 0) && (color.MG == 255))
alert = false;
if ((color.CR == color.MG && color.MG == color.YB))
alert = false;
}
else if (color.getColorModel() == colorModelCMYK)
{
inC[0] = color.CR * 257;
inC[1] = color.MG * 257;
inC[2] = color.YB * 257;
inC[3] = color.K * 257;
xformProof = doc->stdProofCMYKGC;
if ((color.MG == 0) && (color.K == 0) && (color.CR == 255) && (color.YB == 255))
alert = false;
if ((color.MG == 0) && (color.CR == 0) && (color.YB == 0))
alert = false;
if ((color.MG == color.CR) && (color.CR == color.YB) && (color.YB == color.K))
alert = false;
}
else if (color.getColorModel() == colorModelLab)
{
double inC[3];
inC[0] = color.L_val;
inC[1] = color.a_val;
inC[2] = color.b_val;
xformProof = doc->stdProofLabGC;
xformProof.apply(inC, outC, 1);
if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
outOfGamutFlag = true;
alert = false;
}
if (alert)
{
xformProof.apply(inC, outC, 1);
if ((outC[0]/257 == 0) && (outC[1]/257 == 255) && (outC[2]/257 == 0))
outOfGamutFlag = true;
}
}
return outOfGamutFlag;
}
示例8: if
static quint64 code64(const ScColor & col)
{
int C = 0;
int M = 0;
int Y = 0;
int K = 0;
int R = 0;
int G = 0;
int B = 0;
quint64 result = 0;
if (col.getColorModel() == colorModelRGB)
{
col.getRGB( &R, &G, &B );
QColor color = QColor(R, G, B);
color.getCmyk(&C, &M, &Y, &K);
}
else if (col.getColorModel() == colorModelCMYK)
{
col.getCMYK( &C, &M, &Y, &K );
R = 255-qMin(255, C + K);
G = 255-qMin(255, M + K);
B = 255-qMin(255, Y + K);
}
else
{
double L, a, b;
col.getLab(&L, &a, &b);
R = qRound(L);
G = qRound(a);
B = qRound(b);
}
result |= col.getColorModel() == colorModelRGB ? 1 : 0;
result |= col.isSpotColor() ? 64 : 0;
result |= col.isRegistrationColor() ? 32 : 0;
result <<= 8;
result |= C;
result <<= 8;
result |= M;
result <<= 8;
result |= Y;
result <<= 8;
result |= K;
result <<= 8;
result |= R;
result <<= 8;
result |= G;
result <<= 8;
result |= B;
return result;
}
示例9: event
bool ColorListBox::event(QEvent *event)
{
if (event->type() == QEvent::ToolTip)
{
if (cList != NULL)
{
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
QListWidgetItem* it = itemAt(helpEvent->pos());
if (it != 0)
{
event->accept();
QString tipText = "";
if (cList->contains(it->text()))
{
ScColor col = (*cList)[it->text()];
if (col.getColorModel() == colorModelCMYK)
{
int c, m, y, k;
col.getCMYK(&c, &m, &y, &k);
tipText = QString("C:%1% M:%2% Y:%3% K:%4%").arg(qRound(c / 2.55)).arg(qRound(m / 2.55)).arg(qRound(y / 2.55)).arg(qRound(k / 2.55));
}
else
{
int r, g, b;
col.getRawRGBColor(&r, &g, &b);
tipText = QString("R:%1 G:%2 B:%3").arg(r).arg(g).arg(b);
}
}
QToolTip::showText(helpEvent->globalPos(), tipText, this);
return true;
}
}
}
return QListWidget::event(event);
}
示例10: getColorProof
QColor ScColorEngine::getColorProof(const ScColor& color, const ScribusDoc* doc, bool gamutCheck)
{
QColor tmp;
bool gamutChkEnabled = doc ? doc->Gamut : false;
bool spot = color.isSpotColor();
if (color.getColorModel() == colorModelRGB)
{
// Match 133x behavior (RGB greys map to cmyk greys) until we are able to make rgb profiled output
if (color.m_values[0] == color.m_values[1] && color.m_values[1] == color.m_values[2])
gamutChkEnabled = false;
RGBColor rgb;
rgb.r = qRound(color.m_values[0] * 255.0);
rgb.g = qRound(color.m_values[1] * 255.0);
rgb.b = qRound(color.m_values[2] * 255.0);
tmp = getColorProof(rgb, doc, spot, gamutCheck & gamutChkEnabled);
}
else
{
CMYKColor cmyk;
cmyk.c = qRound(color.m_values[0] * 255.0);
cmyk.m = qRound(color.m_values[1] * 255.0);
cmyk.y = qRound(color.m_values[2] * 255.0);
cmyk.k = qRound(color.m_values[3] * 255.0);
tmp = getColorProof(cmyk, doc, spot, gamutCheck & gamutChkEnabled);
}
return tmp;
}
示例11: getColorProof
QColor ScColorEngine::getColorProof(const ScColor& color, const ScribusDoc* doc, bool gamutCheck)
{
QColor tmp;
bool gamutChkEnabled = doc ? doc->Gamut : false;
bool spot = color.isSpotColor();
if (color.getColorModel() == colorModelRGB)
{
// Match 133x behavior (RGB greys map to cmyk greys) until we are able to make rgb profiled output
if ( color.CR == color.MG && color.MG == color.YB )
gamutChkEnabled = false;
RGBColor rgb;
rgb.r = color.CR;
rgb.g = color.MG;
rgb.b = color.YB;
tmp = getColorProof(rgb, doc, spot, gamutCheck & gamutChkEnabled);
}
else
{
CMYKColor cmyk;
cmyk.c = color.CR;
cmyk.m = color.MG;
cmyk.y = color.YB;
cmyk.k = color.K;
tmp = getColorProof(cmyk, doc, spot, gamutCheck & gamutChkEnabled);
}
return tmp;
}
示例12: 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)
{
RGBColorF rgb;
getRGBValues(color, doc, rgb);
newCol.setRgbColorF(rgb.r, rgb.g, rgb.b);
}
else if (model == colorModelCMYK)
{
CMYKColorF cmyk;
getCMYKValues(color, doc, cmyk);
newCol.setColorF(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] = qRound(color.m_values[0] * 65535);
inC[1] = qRound(color.m_values[1] * 65535);
inC[2] = qRound(color.m_values[2] * 65535);
trans.apply(inC, outC, 1);
newCol.setLabColor(outC[0], outC[1], outC[2]);
}
else
{
ScColorProfile profCMYK = doc ? doc->DocInputCMYKProf : ScCore->defaultCMYKProfile;
ScColorProfile profLab = ScCore->defaultLabProfile;
ScColorTransform trans = engine.createTransform(profCMYK, Format_CMYK_16, profLab, Format_Lab_Dbl, Intent_Perceptual, 0);
double outC[3];
unsigned short inC[4];
inC[0] = qRound(color.m_values[0] * 65535);
inC[1] = qRound(color.m_values[1] * 65535);
inC[2] = qRound(color.m_values[2] * 65535);
inC[3] = qRound(color.m_values[3] * 65535);
trans.apply(inC, outC, 1);
newCol.setLabColor(outC[0], outC[1], outC[2]);
}
}
return newCol;
}
示例13: getCMYKValues
void ScColorEngine::getCMYKValues(const ScColor& color, const ScribusDoc* doc, CMYKColor& cmyk)
{
unsigned short inC[4];
unsigned short outC[4];
colorModel model = color.getColorModel();
ScColorTransform transCMYK = doc ? doc->stdTransCMYK : ScCore->defaultRGBToCMYKTrans;
if (ScCore->haveCMS() && transCMYK)
{
if (model == colorModelRGB)
{
// allow RGB greys to go got to CMYK greys without transform
if (color.CR == color.MG && color.MG == color.YB)
{
cmyk.c = cmyk.m = cmyk.y = 0;
cmyk.k = 255 - color.CR;
}
else
{
inC[0] = color.CR * 257;
inC[1] = color.MG * 257;
inC[2] = color.YB * 257;
transCMYK.apply(inC, outC, 1);
cmyk.c = outC[0] / 257;
cmyk.m = outC[1] / 257;
cmyk.y = outC[2] / 257;
cmyk.k = outC[3] / 257;
}
}
else
{
cmyk.c = color.CR;
cmyk.m = color.MG;
cmyk.y = color.YB;
cmyk.k = color.K;
}
}
else if (model == colorModelRGB)
{
cmyk.k = qMin(qMin(255 - color.CR, 255 - color.MG), 255 - color.YB);
cmyk.c = 255 - color.CR - cmyk.k;
cmyk.m = 255 - color.MG - cmyk.k;
cmyk.y = 255 - color.YB - cmyk.k;
}
else
{
cmyk.c = color.CR;
cmyk.m = color.MG;
cmyk.y = color.YB;
cmyk.k = color.K;
}
}
示例14: applyGCR
void ScColorEngine::applyGCR(ScColor& color, const ScribusDoc* doc)
{
bool cmsUse = doc ? doc->HasCMS : false;
if (!(ScCore->haveCMS() && cmsUse) && (color.getColorModel() != colorModelLab))
{
CMYKColor cmyk;
getCMYKValues(color, doc, cmyk);
int k = qMin(qMin(cmyk.c, cmyk.m), cmyk.y);
color.m_values[0] = (cmyk.c - k) / 255.0;
color.m_values[1] = (cmyk.m - k) / 255.0;
color.m_values[2] = (cmyk.y - k) / 255.0;
color.m_values[3] = qMin((cmyk.k + k) / 255.0, 1.0);
}
}
示例15: applyGCR
void ScColorEngine::applyGCR(ScColor& color, const ScribusDoc* doc)
{
bool cmsUse = doc ? doc->HasCMS : false;
if (!(ScCore->haveCMS() && cmsUse) && (color.getColorModel() != colorModelLab))
{
CMYKColor cmyk;
getCMYKValues(color, doc, cmyk);
int k = qMin(qMin(cmyk.c, cmyk.m), cmyk.y);
color.CR = cmyk.c - k;
color.MG = cmyk.m - k;
color.YB = cmyk.y - k;
color.K = qMin((cmyk.k + k), 255);
}
}