本文整理汇总了C++中QColor::alphaF方法的典型用法代码示例。如果您正苦于以下问题:C++ QColor::alphaF方法的具体用法?C++ QColor::alphaF怎么用?C++ QColor::alphaF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColor
的用法示例。
在下文中一共展示了QColor::alphaF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFromQColor
void Color::setFromQColor(const QColor &color)
{
m_channels[0] = color.redF();
m_channels[1] = color.greenF();
m_channels[2] = color.blueF();
m_channels[3] = color.alphaF();
}
示例2: setColor
void ColorSelectWidget::setColor(const QColor &color, bool hasAlpha) {
d->hasAlpha = hasAlpha;
d->alpha->setVisible(d->hasAlpha);
d->alpha->setValue(d->hasAlpha ? color.alphaF()*100.0 : 100.0);
d->alphaLabel->setVisible(d->hasAlpha);
d->color->setCurrentColor(color.rgb());
}
示例3: setColor
void HeadMesh::setColor(QColor c)
{
color[0] = c.redF();
color[1] = c.greenF();
color[2] = c.blueF();
color[3] = c.alphaF();
}
示例4: setBackwardColor
void TrajectoryVisualization::setBackwardColor(QColor c)
{
{ boost::mutex::scoped_lock lockit(this->updateMutex);
backwardColor = osg::Vec4(c.redF(), c.greenF(), c.blueF(), c.alphaF() ); }
emit propertyChanged("BackwardColor");
setDirty();
}
示例5: qSetColor
static inline void qSetColor(float colorVec[], QColor c)
{
colorVec[0] = c.redF();
colorVec[1] = c.greenF();
colorVec[2] = c.blueF();
colorVec[3] = c.alphaF();
}
示例6: qSetColor
void QMesh::qSetColor(QColor c)
{
faceColor[0] = c.redF();
faceColor[1] = c.greenF();
faceColor[2] = c.blueF();
faceColor[3] = c.alphaF();
}
示例7: setColor
void ColorSpinBoxGroup::setColor(const QColor &c)
{
if(c == color_) return;
noColorUpdate = true;
ui->opacityBox->setValue(c.alphaF()*100.0);
if(isRgbColors){
ui->RedspinBox->setValue(c.red());
ui->GreenspinBox->setValue(c.green());
ui->BluespinBox->setValue(c.blue());
}else{
ui->RedspinBox->setValue(
qBound(0.0, c.hsvHueF()*359, 359.0)
);
ui->GreenspinBox->setValue(
qBound(0.0, c.hsvSaturationF()*100, 100.0)
);
ui->BluespinBox->setValue(
qBound(0.0, c.valueF()*100, 100.0)
);
}
color_ = c;
QPalette p = ui->label->palette();
p.setColor(QPalette::Background, color_);
ui->label->setPalette(p);
noColorUpdate = false;
}
示例8: values
void
KnobGuiColor::onDialogCurrentColorChanged(const QColor & color)
{
KnobColorPtr knob = _knob.lock();
if (!knob) {
return;
}
int nDims = knob->getNDimensions();
std::vector<double> values(nDims);
values[0] = color.redF();
convertFromUIToInternalColorspace(&values[0]);
if (nDims > 1) {
values[1] = color.greenF();
convertFromUIToInternalColorspace(&values[1]);
}
if (nDims > 2) {
values[2] = color.blueF();
convertFromUIToInternalColorspace(&values[2]);
}
if (nDims > 3) {
values[3] = color.alphaF();
}
KnobGuiPtr knobUI = getKnobGui();
knob->setValueAcrossDimensions(values, DimIdx(0), getView(), eValueChangedReasonUserEdited);
if ( knobUI->getGui() ) {
knobUI->getGui()->setDraftRenderEnabled(true);
}
}
示例9: getTileFromScreen
QImage DwarfClipboardPng::getTileFromScreen(DFHack::t_screen screen)
{
QColor foregroundColor = getForegroundColorFromScreen(screen);
QColor backgroundColor = getBackgroundColorFromScreen(screen);
QImage tile = tileSet->copy((screen.symbol % 16)*tileWidth,int(screen.symbol/16)*tileHeight,tileWidth,tileHeight);
QImage resultImage(tileWidth,tileHeight,QImage::Format_ARGB32);
for(int x = 0;x< tile.width();x++){
for(int y =0;y<tile.height();y++){
QColor color;
color.setRgba(tile.pixel(x,y));
if(color == QColor("#FF00FF")){ // FF00FF is magenta
resultImage.setPixel(x,y,backgroundColor.rgb());
}
else{
QColor newColor;
qreal alpha = color.alphaF();
qreal alpha_diff = 1-alpha;
newColor.setRedF((alpha * (color.redF() * foregroundColor.redF() )) + (alpha_diff * backgroundColor.redF()));
newColor.setGreenF((alpha * (color.greenF() * foregroundColor.greenF() )) + (alpha_diff * backgroundColor.greenF()));
newColor.setBlueF((alpha * (color.blueF() * foregroundColor.blueF() )) + (alpha_diff * backgroundColor.blueF()));
resultImage.setPixel(x,y,newColor.rgb());
}
}
}
return(resultImage);
}
示例10: qColorToQuadcolor
void RenderThread::qColorToQuadcolor(QColor c, float* result) const
{
result[0] = c.redF();
result[1] = c.greenF();
result[2] = c.blueF();
result[3] = c.alphaF();
}
示例11: alphaColor
QColor alphaColor(QColor color, double alpha)
{
if (alpha >= 1.0)
return color;
color.setAlphaF(qMax(0.0, alpha) * color.alphaF());
return color;
}
示例12: values
void
KnobGuiColor::onDialogCurrentColorChanged(const QColor & color)
{
KnobColorPtr knob = _knob.lock();
bool isSimple = _useSimplifiedUI;
int nDims = knob->getNDimensions();
std::vector<double> values(nDims);
values[0] = isSimple ? color.redF() : Color::from_func_srgb( color.redF() );
if (nDims >= 3) {
values[1] = isSimple ? color.greenF() : Color::from_func_srgb( color.greenF() );
values[2] = isSimple ? color.blueF() : Color::from_func_srgb( color.blueF() );
if (nDims == 4) {
values[3] = color.alphaF();
}
}
KnobGuiPtr knobUI = getKnobGui();
knob->setValueAcrossDimensions(values, DimIdx(0), getView(), eValueChangedReasonUserEdited);
if ( knobUI->getGui() ) {
knobUI->getGui()->setDraftRenderEnabled(true);
}
}
示例13: _FillArray
inline void _FillArray(const QColor& c, float* arr)
{
arr[0] = c.redF();
arr[1] = c.greenF();
arr[2] = c.blueF();
arr[3] = c.alphaF();
}
示例14: d
Color::Color(const QColor &qcolor) : d(0)
{
m_channels[0] = static_cast<float>(qcolor.redF());
m_channels[1] = static_cast<float>(qcolor.greenF());
m_channels[2] = static_cast<float>(qcolor.blueF());
m_channels[3] = static_cast<float>(qcolor.alphaF());
}
示例15: setPenColor
void DkPaintToolBar::setPenColor(const QColor& col) {
penCol = col;
penColButton->setStyleSheet("QPushButton {background-color: " + nmc::DkUtils::colorToString(penCol) + "; border: 1px solid #888;}");
penAlpha = col.alpha();
alphaBox->setValue(col.alphaF()*100);
}