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


C++ QColor::rgb方法代码示例

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


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

示例1: renderAlpha

QuillImage LoadFilter::renderAlpha(const QuillImage &image,
                                   const QColor &backgroundColor)
{
    QuillImage target(image, QImage(image.size(), QImage::Format_RGB32));
    target.fill(backgroundColor.rgb());
    QPainter painter(&target);
    painter.drawImage(QPoint(0, 0), image);
    return target;
}
开发者ID:matthewvogt,项目名称:quillimagefilters,代码行数:9,代码来源:loadfilter.cpp

示例2: getPixel

void Exercise123::diffusePixel(QImage &image, int x, int y, const float &weight, const float &error) {
    if (!inBounds(image, x, y)) {
        return;
    }

    QColor pixel = getPixel(image, x, y);
    QColor diffusedPixel = getDiffusedColor(pixel, weight, error);
    image.setPixel(x, y, diffusedPixel.rgb());
}
开发者ID:janukobytsch,项目名称:hpi-cg1,代码行数:9,代码来源:exercise123.cpp

示例3: setColorForButtonBackgroundColor

void EditorTablePropertiesForm::setColorForButtonBackgroundColor(QColor iColor)
{
  // Квадратик на кнопке выбора цвета кода
  QPixmap pix(16, 16);
  pix.fill(iColor.rgb());
  buttonBackgroundColor.setIcon(pix);

  backgroundColor=iColor;
}
开发者ID:xintrea,项目名称:mytetra_dev,代码行数:9,代码来源:EditorTablePropertiesForm.cpp

示例4: paint

void Canvas::paint(const QPoint center, const int radius,const QColor color,QImage& efffectiveImage){
    for(int x = center.x()-radius; x < center.x()+radius; x++){
        for(int y = center.y()-radius; y < center.y()+radius; y++){
            if(Util::calcL2Distance(center, QPoint(x,y)) < radius){
                efffectiveImage.setPixel(x, y,color.rgb());
            }
        }
    }
}
开发者ID:netbeen,项目名称:UncleZhou_UI,代码行数:9,代码来源:canvas.cpp

示例5: setValue

void ColorView::setValue(const QColor &col)
{
    if (col.rgb() == value_.rgb()) {
        return;
    }
    value_ = col;
    update();
    emit valueChanged(col);
}
开发者ID:mactec0,项目名称:terravox,代码行数:9,代码来源:colorview.cpp

示例6: color

void KbLight::color(const QColor& newColor){
    QRgb newRgb = newColor.rgb();
    QMutableHashIterator<QString, QRgb> i(_colorMap);
    while(i.hasNext()){
        i.next();
        i.value() = newRgb;
    }
    _needsSave = true;
}
开发者ID:lockcda,项目名称:ckb,代码行数:9,代码来源:kblight.cpp

示例7: update

void MainWindow::update(){
    // we draw by using a QImage - turn it into a Pixmap, then put it on a label
    QImage img(200, 200, QImage::Format_RGB32);
    bool display;
    /* Our color wheel has a radius of 100.  Loop through the rectangle
      looking for pixels within that radius. For good pixels we calculate
      the H value based on the angle from the origin.  The S value is
      set according to the distance / radius, and the V is fixed (but
      settable by a slider).
     */
    for (int i = 0; i < 200; i++)
    {
        for (int j = 0; j < 200; j++)
        {
            float dist = sqrt((i - 100) * (i - 100) + (j - 100) * (j - 100));
            if (dist < 100.0)
            {
                display = true;
                float s = dist / 100.0f;
                float h = atan2(i - 100, j - 100) / (2.0f * 3.14156);
                if (h < 0)
                {
                    h = 1.0f + h;
                }
                // Since H is an angle the math is modulo.
                if (hMax > hMin)
                {
                    if (hMin > h || hMax < h)
                    {
                        display = false;
                    }
                } else if (hMin > h && hMax < h )
                {
                    display = false;
                }
                if (s < sMin || s > sMax)
                {
                    display = false;
                }
                QColor c;
                if (display)
                {
                    c.setHsvF(h, s, zValue);
                } else{
                    c.setHsvF(0.0, 0.0, 1.0f);
                }
                img.setPixel(i, j, c.rgb());
            }
        }
    }
    QPixmap pix;
    pix.convertFromImage(img);
    ui->colwheel->setPixmap(pix);
    ui->colwheel->repaint();

}
开发者ID:echown,项目名称:Sliders,代码行数:56,代码来源:mainwindow.cpp

示例8: selectionColor

QColor RenderReplaced::selectionColor(QPainter *p) const
{
    QColor color = RenderBox::selectionColor(p);
         
    // Force a 60% alpha so that no user-specified selection color can obscure selected images.
    if (qAlpha(color.rgb()) > 153)
        color = QColor(qRgba(color.red(), color.green(), color.blue(), 153));

    return color;
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:10,代码来源:render_replaced.cpp

示例9: qRed

RGBA Qwt3D::Qt2GL(QColor col)
{
	QRgb qrgb = col.rgb();
	RGBA rgba;
	rgba.r = qRed(qrgb) / 255.0;
	rgba.g = qGreen(qrgb) / 255.0;
	rgba.b = qBlue(qrgb) / 255.0;
	rgba.a = qAlpha(qrgb) / 255.0;
	return rgba;	
}
开发者ID:vlcvboyer,项目名称:qwtplot3d-sourceforge,代码行数:10,代码来源:qwt3d_types.cpp

示例10: trackColorChanged

void MixerDetails::trackColorChanged(QColor col)
      {
      if (trackColorLabel->color() != col) {
            trackColorLabel->blockSignals(true);
            trackColorLabel->setColor(col);
            trackColorLabel->blockSignals(false);
            }

      _mti->setColor(col.rgb());
      }
开发者ID:Rockettwo,项目名称:MuseScore,代码行数:10,代码来源:mixerdetails.cpp

示例11: macGetColor

QColor macGetColor( const QColor& initial, QWidget *parent, const char *name )
{
    bool ok;
    QRgb rgb = macGetRgba( initial.rgb(), &ok, parent, name );

    QColor ret;
    if(ok)
	ret = QColor(rgb);
    return ret;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:10,代码来源:qcolordialog_mac.cpp

示例12: setColor

void BBTCOView::setColor( QColor new_color )
{
	if( new_color.rgb() != m_bbTCO->color() )
	{
		m_bbTCO->setColor( new_color );
		m_bbTCO->m_useStyleColor = false;
		Engine::getSong()->setModified();
		update();
	}
	BBTrack::setLastTCOColor( new_color );
}
开发者ID:jasp00,项目名称:lmms,代码行数:11,代码来源:BBTrack.cpp

示例13: getKey

QString QTextFormat::getKey( const QFont &fn, const QColor &col, bool misspelled, VerticalAlignment a )
{
    QString k = fn.key();
    k += '/';
    k += QString::number( (uint)col.rgb() );
    k += '/';
    k += QString::number( (int)misspelled );
    k += '/';
    k += QString::number( (int)a );
    return k;
}
开发者ID:OS2World,项目名称:LIB-QT3_Toolkit_Vbox,代码行数:11,代码来源:qrichtext_p.cpp

示例14: FillAndFrameBlack

 static void FillAndFrameBlack(QImage* image, const QColor& color, int size)
 {
     image->fill(color.rgb());
     for (int i = 0; i < size; i++)
     {
         image->setPixel(0, i, 0);
         image->setPixel(size - 1, i, 0);
         image->setPixel(i, 0, 0);
         image->setPixel(i, size - 1, 0);
     }
 }
开发者ID:dreamsxin,项目名称:ktorrent,代码行数:11,代码来源:chunkbar.cpp

示例15: bucket

/**
 * @brief Canvas::bucket
 * @brief 颜料桶工具的绘制函数,用特定的颜色填充整个图像区域
 * @param color 表示所绘制的颜色
 * @return 没有返回值
 */
void Canvas::bucket(const QColor color){
    QImage* image = &(this->layerManager->getDisplayLayerItem()->image);

    for(int x = 0; x < image->width(); x++){
        for(int y = 0; y < image->height(); y++){
            image->setPixel(x, y,color.rgb());
        }
    }

    this->update();
}
开发者ID:netbeen,项目名称:UncleZhou_UI,代码行数:17,代码来源:canvas.cpp


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