本文整理汇总了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;
}
示例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());
}
示例3: setColorForButtonBackgroundColor
void EditorTablePropertiesForm::setColorForButtonBackgroundColor(QColor iColor)
{
// Квадратик на кнопке выбора цвета кода
QPixmap pix(16, 16);
pix.fill(iColor.rgb());
buttonBackgroundColor.setIcon(pix);
backgroundColor=iColor;
}
示例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());
}
}
}
}
示例5: setValue
void ColorView::setValue(const QColor &col)
{
if (col.rgb() == value_.rgb()) {
return;
}
value_ = col;
update();
emit valueChanged(col);
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例10: trackColorChanged
void MixerDetails::trackColorChanged(QColor col)
{
if (trackColorLabel->color() != col) {
trackColorLabel->blockSignals(true);
trackColorLabel->setColor(col);
trackColorLabel->blockSignals(false);
}
_mti->setColor(col.rgb());
}
示例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;
}
示例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 );
}
示例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;
}
示例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);
}
}
示例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();
}