MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / drawPicker

Method drawPicker

dependencies/ColorWheel/ColorWheel.cpp:431–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431void ColorWheel::drawPicker(const QColor &color)
432{
433 QPainter painter(&wheel);
434 painter.setRenderHint(QPainter::Antialiasing);
435 QPen pen;
436
437 // region of the widget
438 int w = qMin(width(), height());
439
440 // radius of outer circle
441 qreal r = w/2-margin;
442
443 // radius of inner circle
444 qreal ir = r-wheelWidth;
445
446 // left corner of square
447 qreal m = w/2.0-ir/qSqrt(2);
448
449 painter.translate(x_offset + m-5, y_offset + m-5);
450
451 qreal SquareWidth = 2*ir/qSqrt(2);
452 qreal S = color.saturationF()*SquareWidth;
453 qreal V = color.valueF()*SquareWidth;
454
455 if(color.saturation() > 30 ||color.value() < 50)
456 {
457 pen.setColor(Qt::white);
458 }
459
460 pen.setWidth(3);
461 painter.setPen(pen);
462 painter.drawEllipse(S,V,10,10);
463}
464
465void ColorWheel::composeWheel()
466{

Callers

nothing calls this directly

Calls 2

valueMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected