Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_color_input.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2008 Cyrille Berger <cberger@cberger.net>
3 * SPDX-FileCopyrightText: 2011 Sven Langkamp <sven.langkamp@gmail.com>
4 * SPDX-FileCopyrightText: 2015 Moritz Molch <kde@moritzmolch.de>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9#include "kis_color_input.h"
10
11#include <KoConfig.h>
12#ifdef HAVE_OPENEXR
13#include <half.h>
14#endif
15
16#include <cmath>
17
18#include <kis_debug.h>
19
20#include <QHBoxLayout>
21#include <QLabel>
22#include <QLineEdit>
23#include <QSpinBox>
24#include <QDoubleSpinBox>
25#include <QRegularExpression>
26#include <QRegularExpressionValidator>
27
28#include <klocalizedstring.h>
29
30#include <KoChannelInfo.h>
31#include <KoColor.h>
32#include <KoColorSlider.h>
33#include <KoColorSpace.h>
34#include <KisHsvColorSlider.h>
35#include <KoColorConversions.h>
37
40#include "kis_signals_blocker.h"
41
42KisColorInput::KisColorInput(QWidget* parent, const KoChannelInfo* channelInfo, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, bool usePercentage) :
43 QWidget(parent), m_channelInfo(channelInfo), m_color(color), m_displayRenderer(displayRenderer),
44 m_usePercentage(usePercentage)
45{
46}
47
49{
50 QHBoxLayout* m_layout = new QHBoxLayout(this);
51 m_layout->setContentsMargins(0,0,0,0);
52 m_layout->setSpacing(1);
53
54 QLabel* m_label = new QLabel(i18n("%1:", m_channelInfo->name()), this);
55 m_layout->addWidget(m_label);
56
57 m_colorSlider = new KoColorSlider(Qt::Horizontal, this, m_displayRenderer);
58 m_colorSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
59 m_layout->addWidget(m_colorSlider);
60
61 QWidget* m_input = createInput();
62 m_layout->addWidget(m_input);
63}
64
65KisIntegerColorInput::KisIntegerColorInput(QWidget* parent, const KoChannelInfo* channelInfo, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, bool usePercentage) :
66 KisColorInput(parent, channelInfo, color, displayRenderer, usePercentage)
67{
68 init();
69}
70
72{
73 quint8* data = m_color->data() + m_channelInfo->pos();
76 *(reinterpret_cast<quint8*>(data)) = v;
77 break;
79 *(reinterpret_cast<quint16*>(data)) = v;
80 break;
82 *(reinterpret_cast<quint32*>(data)) = v;
83 break;
84 default:
85 Q_ASSERT(false);
86 }
87 emit(updated());
88}
89
91{
92 KoColor min = *m_color;
93 KoColor max = *m_color;
94 quint8* data = m_color->data() + m_channelInfo->pos();
95 quint8* dataMin = min.data() + m_channelInfo->pos();
96 quint8* dataMax = max.data() + m_channelInfo->pos();
97 m_intNumInput->blockSignals(true);
98 m_colorSlider->blockSignals(true);
101 quint8 value = *(reinterpret_cast<quint8*>(data));
102 m_intNumInput->setValue(m_usePercentage ? round(value * 100.0 / 0xFF) : value);
103 m_colorSlider->setValue(value);
104 *(reinterpret_cast<quint8*>(dataMin)) = 0x0;
105 *(reinterpret_cast<quint8*>(dataMax)) = 0xFF;
106 break;
107 }
109 quint16 value = *(reinterpret_cast<quint16*>(data));
110 m_intNumInput->setValue(m_usePercentage ? round(value * 100.0 / 0xFFFF) : value);
111 m_colorSlider->setValue(value);
112 *(reinterpret_cast<quint16*>(dataMin)) = 0x0;
113 *(reinterpret_cast<quint16*>(dataMax)) = 0xFFFF;
114 break;
115 }
117 quint32 value = *(reinterpret_cast<quint32*>(data));
118 m_intNumInput->setValue(m_usePercentage ? round(value * 100.0 / 0xFFFF'FFFF) : value);
119 m_colorSlider->setValue(value);
120 *(reinterpret_cast<quint32*>(dataMin)) = 0x0;
121 *(reinterpret_cast<quint32*>(dataMax)) = 0xFFFF'FFFF;
122 break;
123 }
124 default:
125 Q_ASSERT(false);
126 }
127 m_colorSlider->setColors(min, max);
128 m_intNumInput->blockSignals(false);
129 m_colorSlider->blockSignals(false);
130}
131
133{
135 m_intNumInput->setMinimum(0);
136 m_colorSlider->setMinimum(0);
137
138 if (m_usePercentage) {
139 KisSpinBoxI18nHelper::setText(m_intNumInput, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
140 }
141
143
144 connect(m_colorSlider, SIGNAL(valueChanged(int)), this, SLOT(onColorSliderChanged(int)));
145 connect(m_intNumInput, SIGNAL(valueChanged(int)), this, SLOT(onNumInputChanged(int)));
146 return m_intNumInput;
147}
148
150{
151 m_intNumInput->clearFocus(); // make sure focus doesn't interfere with updating
152
156
157 m_intNumInput->blockSignals(true); // prevent clamping from triggering a value update
158 m_intNumInput->setMaximum(m_usePercentage ? 100 : (1 << 8 * m_channelInfo->size()) - 1);
159 m_colorSlider->setMaximum((1 << 8 * m_channelInfo->size()) - 1);
160 m_intNumInput->blockSignals(false);
161}
162
164{
165 m_usePercentage = val;
166
167 m_intNumInput->clearFocus(); // make sure focus doesn't interfere with updating
168
169 if (m_usePercentage) {
170 KisSpinBoxI18nHelper::setText(m_intNumInput, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
171 } else {
172 m_intNumInput->setPrefix("");
173 m_intNumInput->setSuffix("");
174 }
175
177}
178
180{
181 m_intNumInput->blockSignals(true);
182
186
187 m_intNumInput->setValue(m_usePercentage ? round(val * 100.0 / ((1 << 8 * m_channelInfo->size()) - 1))
188 : val);
189
190 m_intNumInput->blockSignals(false);
191 setValue(val);
192}
193
195{
196 m_colorSlider->blockSignals(true);
197
201
202 m_colorSlider->setValue(m_usePercentage ? val / 100.0 * ((1 << 8 * m_channelInfo->size()) - 1)
203 : val);
204
205 m_colorSlider->blockSignals(false);
206 setValue(m_usePercentage ? val / 100.0 * ((1 << 8 * m_channelInfo->size()) - 1)
207 : val);
208}
209
210KisFloatColorInput::KisFloatColorInput(QWidget* parent, const KoChannelInfo* channelInfo, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, bool usePercentage) :
211 KisColorInput(parent, channelInfo, color, displayRenderer, usePercentage)
212{
213 init();
214}
215
217{
218 quint8* data = m_color->data() + m_channelInfo->pos();
219 switch (m_channelInfo->channelValueType()) {
220#ifdef HAVE_OPENEXR
222 *(reinterpret_cast<half*>(data)) = v;
223 break;
224#endif
226 *(reinterpret_cast<float*>(data)) = v;
227 break;
228 default:
229 Q_ASSERT(false);
230 }
231 emit(updated());
232}
233
235{
237 m_dblNumInput->setMinimum(0);
238 m_dblNumInput->setMaximum(1.0);
239 m_dblNumInput->setSingleStep(0.01);
240 connect(m_colorSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged(int)));
241 connect(m_dblNumInput, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
242 m_dblNumInput->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
243 m_dblNumInput->setMinimumWidth(60);
244 m_dblNumInput->setMaximumWidth(60);
245
246 quint8* data = m_color->data() + m_channelInfo->pos();
247 qreal value = 1.0;
248
249 switch (m_channelInfo->channelValueType()) {
250#ifdef HAVE_OPENEXR
252 value = *(reinterpret_cast<half*>(data));
253 break;
254#endif
256 value = *(reinterpret_cast<float*>(data));
257 break;
258 default:
259 Q_ASSERT(false);
260 }
262
263 return m_dblNumInput;
264}
265
267{
268 const qreal floatRange = m_maxValue - m_minValue;
269 m_dblNumInput->setValue(m_minValue + (i / 255.0) * floatRange);
270}
271
273{
274 KoColor min = *m_color;
275 KoColor max = *m_color;
276 quint8* data = m_color->data() + m_channelInfo->pos();
277 quint8* dataMin = min.data() + m_channelInfo->pos();
278 quint8* dataMax = max.data() + m_channelInfo->pos();
279
280 qreal value = 1.0;
283 m_dblNumInput->blockSignals(true);
284 m_colorSlider->blockSignals(true);
285
286 switch (m_channelInfo->channelValueType()) {
287#ifdef HAVE_OPENEXR
289 value = *(reinterpret_cast<half*>(data));
290 m_minValue = qMin(value, m_minValue);
291 m_maxValue = qMax(value, m_maxValue);
292 *(reinterpret_cast<half*>(dataMin)) = m_minValue;
293 *(reinterpret_cast<half*>(dataMax)) = m_maxValue;
294 break;
295#endif
297 value = *(reinterpret_cast<float*>(data));
298 m_minValue = qMin(value, m_minValue);
299 m_maxValue = qMax(value, m_maxValue);
300 *(reinterpret_cast<float*>(dataMin)) = m_minValue;
301 *(reinterpret_cast<float*>(dataMax)) = m_maxValue;
302 break;
303 default:
304 Q_ASSERT(false);
305 }
306
307 if (m_minValue != m_dblNumInput->minimum()) {
308 m_dblNumInput->setMinimum(m_minValue);
309 }
310 if (m_maxValue != m_dblNumInput->maximum()) {
311 m_dblNumInput->setMaximum(m_maxValue);
312 }
313
314 // ensure at least 3 significant digits are always shown
315 int newPrecision = 2 + qMax(qreal(0.0), std::ceil(-std::log10(m_maxValue)));
316 if (newPrecision != m_dblNumInput->decimals()) {
317 m_dblNumInput->setDecimals(newPrecision);
318 m_dblNumInput->updateGeometry();
319 }
321
322 m_colorSlider->setColors(min, max);
323
324 const qreal floatRange = m_maxValue - m_minValue;
325 m_colorSlider->setValue((value - m_minValue) / floatRange * 255);
326 m_dblNumInput->blockSignals(false);
327 m_colorSlider->blockSignals(false);
328}
329
330KisHexColorInput::KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, bool usePercentage, bool usePreview) :
331 KisColorInput(parent, 0, color, displayRenderer, usePercentage)
332{
333 QHBoxLayout* m_layout = new QHBoxLayout(this);
334 m_layout->setContentsMargins(0,0,0,0);
335 m_layout->setSpacing(1);
336
337 QLabel* m_label = new QLabel(i18n("Color name:"), this);
338 m_label->setMinimumWidth(50);
339 m_layout->addWidget(m_label);
340
341 QWidget* m_input = createInput();
342 m_input->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
343
344 if(usePreview) {
345 m_colorPreview = new QLabel("");
346 m_colorPreview->setMinimumWidth(30);
347 m_layout->addWidget(m_colorPreview);
348 }
349
350 m_layout->addWidget(m_input);
351}
352
354{
355 QString valueString = m_hexInput->text();
356 valueString.remove(QChar('#'));
357
359 channels = KoChannelInfo::displayOrderSorted(channels);
360 Q_FOREACH (KoChannelInfo* channel, channels) {
361 if (channel->channelType() == KoChannelInfo::COLOR) {
362 Q_ASSERT(channel->channelValueType() == KoChannelInfo::UINT8);
363 quint8* data = m_color->data() + channel->pos();
364
365 int value = valueString.left(2).toInt(0, 16);
366 *(reinterpret_cast<quint8*>(data)) = value;
367 valueString.remove(0, 2);
368 }
369 }
370 emit(updated());
371}
372
374{
375 QString hexString("#");
376
378 channels = KoChannelInfo::displayOrderSorted(channels);
379 Q_FOREACH (KoChannelInfo* channel, channels) {
380 if (channel->channelType() == KoChannelInfo::COLOR) {
381 Q_ASSERT(channel->channelValueType() == KoChannelInfo::UINT8);
382 quint8* data = m_color->data() + channel->pos();
383 hexString.append(QString("%1").arg(*(reinterpret_cast<quint8*>(data)), 2, 16, QChar('0')));
384 }
385 }
386 m_hexInput->setText(hexString);
387 if( m_colorPreview) {
388 m_colorPreview->setStyleSheet(QString("background-color: %1").arg(m_displayRenderer->toQColor(*m_color).name()));
389 }
390}
391
393{
394 m_hexInput = new QLineEdit(this);
395 m_hexInput->setAlignment(Qt::AlignRight);
396
397 int digits = 2*m_color->colorSpace()->colorChannelCount();
398 QString pattern = QString("#?[a-fA-F0-9]{%1,%2}").arg(digits).arg(digits);
399 m_hexInput->setValidator(new QRegularExpressionValidator(QRegularExpression(pattern), this));
400 connect(m_hexInput, SIGNAL(editingFinished()), this, SLOT(setValue()));
401 return m_hexInput;
402}
403
404
406 : QWidget(parent)
407 , m_color(color)
408 , m_hSlider(nullptr)
409 , m_sSlider(nullptr)
410 , m_xSlider(nullptr)
411 , m_hInput(nullptr)
412 , m_sInput(nullptr)
413 , m_xInput(nullptr)
414 , m_h(0)
415 , m_s(0)
416 , m_x(0)
417 , m_mixMode(KisHsvColorSlider::MIX_MODE::HSV)
418{
419
420 const QStringList labelNames = QStringList({
421 i18nc("@label:slider Abbreviation for 'Hue'", "H:"),
422 i18nc("@label:slider Abbreviation for 'Saturation'", "S:"),
423 QString(/* x will get initialized later in setMixMode */) });
424 qreal maxValues[3] = { 360, 100, 100 };
425
426 QGridLayout *slidersLayout = new QGridLayout(this);
427 slidersLayout->setContentsMargins(0,0,0,0);
428 slidersLayout->setHorizontalSpacing(1); // less space around the sliders
429
430 for (int i = 0; i < 3; i++) {
431 // Label
432 QLabel *label = new QLabel(labelNames[i], this);
433 slidersLayout->addWidget(label, i, 0);
434
435 // Slider itself
436 KisHsvColorSlider *slider = new KisHsvColorSlider(Qt::Horizontal, this);
437 slider->setMixMode(m_mixMode);
438 slider->setMinimum(0);
439 slider->setMaximum(maxValues[i]);
440 slider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
441 slidersLayout->addWidget(slider, i, 1);
442
443 // Input box
445 input->setMinimum(0);
446 input->setMaximum(maxValues[i]);
447
448 input->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
449 input->setMinimumWidth(60);
450 input->setMaximumWidth(60);
451
452 slider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
453 slidersLayout->addWidget(input, i, 2);
454
455 switch (i) {
456 case 0:
457 m_hSlider = slider;
458 m_hInput = input;
459 case 1:
460 m_sSlider = slider;
461 m_sInput = input;
462 case 2:
463 m_xLabel = label; // Save the HSX label so we can update it
464 m_xSlider = slider;
465 m_xInput = input;
466 }
467 }
468
469 // Connect slots
470 connect(m_hSlider, SIGNAL(valueChanged(int)), this, SLOT(hueSliderChanged(int)));
471 connect(m_hInput, SIGNAL(valueChanged(double)), this, SLOT(setHue(double)));
472 connect(m_sSlider, SIGNAL(valueChanged(int)), this, SLOT(saturationSliderChanged(int)));
473 connect(m_sInput, SIGNAL(valueChanged(double)), this, SLOT(setSaturation(double)));
474 connect(m_xSlider, SIGNAL(valueChanged(int)), this, SLOT(valueSliderChanged(int)));
475 connect(m_xInput, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
476
478
479 // Set initial values
480 QColor c = m_color->toQColor();
481 getHsxF(c, &m_h, &m_s, &m_x);
482
486
487 // Update sliders
488 QColor minC, maxC;
489 minC.setHsvF(0, 1, 1);
490 maxC.setHsvF(1, 1, 1);
491 m_hSlider->setColors(minC, maxC);
493
495}
496
498
499 switch (mixMode) {
501 m_xLabel->setText(i18nc("@label:slider Abbreviation for 'Lightness' of HSL color model", "L:"));
502 break;
504 m_xLabel->setText(i18nc("@label:slider Abbreviation for 'Luma' of HSY color model", "Y:"));
505 break;
507 m_xLabel->setText(i18nc("@label:slider Abbreviation for 'Intensity' of HSI color model", "I:"));
508 break;
509 default: // fallthrough
511 m_xLabel->setText(i18nc("@label:slider Abbreviation for 'Value' of HSV color model", "V:"));
512 break;
513 }
514
515 QColor c = m_color->toQColor();
516 m_mixMode = mixMode;
517 getHsxF(c, &m_h, &m_s, &m_x);
518
521
522 sendUpdate();
523}
524
526{
527 {
528 KisSignalsBlocker blocker(
531 );
532 m_hSlider->setValue(m_h * 360);
533 m_sSlider->setValue(m_s * 100);
534 m_xSlider->setValue(m_x * 100);
535
536 m_hInput->setValue(m_h * 360);
537 m_sInput->setValue(m_s * 100);
538 m_xInput->setValue(m_x * 100);
539 }
540
542
543 QColor c;
544 fillColor(c);
545
547 emit(updated());
548}
549
551{
552 x = qBound(0.0, x, 360.0);
553
554 m_h = x / 360;
555 sendUpdate();
556}
557
559{
560 x = qBound(0.0, x, 100.0);
561
562 m_s = x / 100;
563 sendUpdate();
564}
565
567{
568 x = qBound(0.0, x, 100.0);
569
570 m_x = x / 100;
571 sendUpdate();
572}
573
578
583
588
590 // Update sliders
591 QColor minC, maxC;
592
593 minC.setHsvF(m_h, 0, m_x);
594 maxC.setHsvF(m_h, 1, m_x);
595 m_sSlider->setColors(minC, maxC);
596
597 minC.setHsvF(m_h, m_s, 0);
598 maxC.setHsvF(m_h, m_s, 1);
599 m_xSlider->setColors(minC, maxC);
600}
601
603{
604 KisSignalsBlocker blocker(
607 );
608
609 // Check if it is the same color we have
610 QColor current;
611
612 fillColor(current);
613
614 QColor theirs = m_color->toQColor();
615
616 // Truncate to integer for this check
617 if (!(current.red() == theirs.red() && current.green() == theirs.green() && current.blue() == theirs.blue())) {
618 // Apply the update
619 qreal theirH;
620 getHsxF(theirs, &theirH, &m_s, &m_x);
621
622 // Don't jump the Hue slider around to 0 if it is currently on 360
623 const qreal EPSILON = 1e-6;
624 if (!((1.0 - m_h) < EPSILON && (theirH - 0.0) < EPSILON)) {
625 m_h = theirH;
626 }
627
628 m_hInput->setValue(m_h * 360);
629 m_sInput->setValue(m_s * 100);
630 m_xInput->setValue(m_x * 100);
631
633
634 // Update slider positions
635 m_hSlider->setValue(m_h * 360);
636 m_sSlider->setValue(m_s * 100);
637 m_xSlider->setValue(m_x * 100);
638 }
639}
640
642 fillColor(c, m_h, m_s, m_x);
643}
644
645void KisHsvColorInput::fillColor(QColor& c, const qreal& h, const qreal& s, const qreal& x)
646{
647 switch (m_mixMode) {
649 c.setHslF(h, s, x);
650 break;
651
653 qreal r, g, b;
654 HSYToRGB(h, s, x, &r, &g, &b);
655
656 // Clamp
657 r = qBound(0.0, r, 1.0);
658 g = qBound(0.0, g, 1.0);
659 b = qBound(0.0, b, 1.0);
660
661 c.setRgbF(r, g, b);
662 break;
663 }
664
666 qreal r, g, b;
667 HSIToRGB(h, s, x, &r, &g, &b);
668 c.setRgbF(r, g, b);
669 break;
670 }
671
672 default: // fallthrough
674 c.setHsvF(h, s, x);
675 break;
676 }
677}
678
679void KisHsvColorInput::getHsxF(const QColor& color, qreal* h, qreal* s, qreal* x)
680{
681 qreal tempH;
682#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
683 float fS = *s;
684 float fX = *x;
685#endif
686 switch (m_mixMode) {
688 {
689#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
690 color.getHslF(&tempH, s, x);
691#else
692 float th;
693 color.getHslF(&th, &fS, &fX);
694 tempH = th;
695#endif
696 }
697 break;
698
700 RGBToHSY(color.redF(), color.greenF(), color.blueF(), &tempH, s, x);
701 break;
702 }
703
705 RGBToHSI(color.redF(), color.greenF(), color.blueF(), &tempH, s, x);
706 break;
707 }
708
709 default: // fallthrough
711 {
712#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
713 color.getHsvF(&tempH, s, x);
714#else
715 float th;
716 color.getHsvF(&th, &fS, &fX);
717 tempH = th;
718#endif
719 }
720 break;
721 }
722
723 if (tempH >= 0.0 && tempH <= 1.0) {
724 *h = tempH;
725 }
726}
float value(const T *src, size_t ch)
qreal v
QList< QString > QStringList
#define EPSILON
void HSYToRGB(const qreal h, const qreal s, const qreal y, qreal *red, qreal *green, qreal *blue, qreal R, qreal G, qreal B)
void RGBToHSI(qreal r, qreal g, qreal b, qreal *h, qreal *s, qreal *i)
void HSIToRGB(const qreal h, const qreal s, const qreal i, qreal *red, qreal *green, qreal *blue)
void RGBToHSY(const qreal r, const qreal g, const qreal b, qreal *h, qreal *s, qreal *y, qreal R, qreal G, qreal B)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
const KoChannelInfo * m_channelInfo
KoColor * m_color
KisColorInput(QWidget *parent, const KoChannelInfo *, KoColor *color, KoColorDisplayRendererInterface *displayRenderer=KoDumbColorDisplayRenderer::instance(), bool usePercentage=false)
KoColorDisplayRendererInterface * m_displayRenderer
KoColorSlider * m_colorSlider
virtual QWidget * createInput()=0
The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
void setValue(double value, bool overwriteExpression=false)
Set the value of the spinbox.
KisFloatColorInput(QWidget *parent, const KoChannelInfo *, KoColor *color, KoColorDisplayRendererInterface *displayRenderer=KoDumbColorDisplayRenderer::instance(), bool usePercentage=false)
QWidget * createInput() override
KisDoubleParseSpinBox * m_dblNumInput
KisHexColorInput(QWidget *parent, KoColor *color, KoColorDisplayRendererInterface *displayRenderer=KoDumbColorDisplayRenderer::instance(), bool usePercentage=false, bool usePreview=false)
QWidget * createInput() override
QLineEdit * m_hexInput
KisDoubleParseSpinBox * m_sInput
void getHsxF(const QColor &color, qreal *h, qreal *s, qreal *x)
KisHsvColorSlider * m_xSlider
void setSaturation(double)
KisHsvColorSlider::MIX_MODE m_mixMode
KisHsvColorSlider * m_hSlider
KisDoubleParseSpinBox * m_xInput
void saturationSliderChanged(int)
KisHsvColorInput(QWidget *parent, KoColor *color)
KisHsvColorSlider * m_sSlider
void setMixMode(KisHsvColorSlider::MIX_MODE mixMode)
void fillColor(QColor &color)
KisDoubleParseSpinBox * m_hInput
The KisIntParseSpinBox class is a cleverer SpinBox, able to parse arithmetic expressions.
void setValue(int value, bool overwriteExpression=false)
Set the value of the spinbox.
QWidget * createInput() override
KisIntegerColorInput(QWidget *parent, const KoChannelInfo *, KoColor *color, KoColorDisplayRendererInterface *displayRenderer=KoDumbColorDisplayRenderer::instance(), bool usePercentage=false)
void setPercentageWise(bool val) override
KisIntParseSpinBox * m_intNumInput
@ COLOR
The channel represents a color.
qint32 size() const
qint32 pos() const
@ UINT8
use this for an unsigned integer 8bits channel
@ UINT16
use this for an integer 16bits channel
@ FLOAT32
use this for a float 32bits channel
@ FLOAT16
use this for a float 16bits channel
@ UINT32
use this for an unsigned integer 21bits channel
enumChannelType channelType() const
enumChannelValueType channelValueType() const
QString name() const
static QList< KoChannelInfo * > displayOrderSorted(const QList< KoChannelInfo * > &channels)
virtual qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const =0
virtual QColor toQColor(const KoColor &c, bool proofToPaintColors=false) const =0
virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const =0
QList< KoChannelInfo * > channels
virtual quint32 colorChannelCount() const =0
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
Definition KoColor.cpp:213
quint8 * data()
Definition KoColor.h:144
const KoColorSpace * colorSpace() const
return the current colorSpace
Definition KoColor.h:82
void toQColor(QColor *c) const
a convenience method for the above.
Definition KoColor.cpp:198
void setText(QSpinBox *spinBox, const QStringView textTemplate)
Definition flatten.c:229
void setColors(const KoColor minColor, const KoColor maxColor)
void setMixMode(MIX_MODE mode)
void setColors(const KoColor &minColor, const KoColor &maxColor)