Krita Source Code Documentation
Loading...
Searching...
No Matches
KisCIETongueWidget Class Reference

#include <kis_cie_tongue_widget.h>

+ Inheritance diagram for KisCIETongueWidget:

Public Types

enum  model {
  RGBA , CMYKA , XYZA , LABA ,
  GRAYA , YCbCrA
}
 

Public Member Functions

 KisCIETongueWidget (QWidget *parent=nullptr)
 
void loadingFailed ()
 
void loadingStarted ()
 
void setCMYKData (KoColorimetryUtils::xyY whitepoint)
 
void setGamut (QPolygonF gamut)
 
void setGrayData (KoColorimetryUtils::xyY whitepoint)
 
void setLABData (KoColorimetryUtils::xyY whitepoint)
 
void setProfileData (QVector< KoColorimetryUtils::xyY > p, KoColorimetryUtils::xyY w, bool profileData=false)
 
void setProfileDataAvailable (bool dataAvailable)
 
void setRGBData (KoColorimetryUtils::xyY whitepoint, QVector< KoColorimetryUtils::xyY > colorants)
 
void setXYZData (KoColorimetryUtils::xyY whitepoint)
 
void setYCbCrData (KoColorimetryUtils::xyY whitepoint)
 
void uncalibratedColor ()
 
 ~KisCIETongueWidget () override
 

Public Attributes

QPixmap cietongue
 
bool cieTongueNeedsUpdate {true}
 
model colorModel {model::RGBA}
 
QPolygonF gamut
 
QPixmap gamutMap
 
double gridside {0.0}
 
bool needUpdatePixmap {false}
 
QPainter painter
 
QPixmap pixmap
 
QVector< KoColorimetryUtils::xyYPrimaries
 
bool profileDataAvailable {false}
 
int pxcols {0}
 
int pxrows {0}
 
bool uncalibratedColor {false}
 
KoColorimetryUtils::xyY whitePoint
 
int xBias {0}
 
int yBias {0}
 

Protected Member Functions

QRgb colorByCoord (double x, double y)
 
void drawLabels ()
 
void drawSmallEllipse (QPointF xy, int r, int g, int b, int sz)
 
void drawTongueAxis ()
 
void drawTongueGrid ()
 
void fillTongue ()
 
int grids (double val) const
 
void outlineTongue ()
 
void paintEvent (QPaintEvent *) override
 
void resizeEvent (QResizeEvent *event) override
 

Private Member Functions

void biasedLine (int x1, int y1, int x2, int y2)
 
void biasedText (int x, int y, const QString &txt)
 
void drawColorantTriangle ()
 
void drawGamut ()
 
void drawPatches ()
 
void drawWhitePoint ()
 
void mapPoint (int &icx, int &icy, QPointF xy)
 
void updatePixmap ()
 
- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Private Attributes

Private *const d {nullptr}
 
- Private Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Detailed Description

Definition at line 128 of file kis_cie_tongue_widget.cpp.

Member Enumeration Documentation

◆ model

Constructor & Destructor Documentation

◆ KisCIETongueWidget()

KisCIETongueWidget::KisCIETongueWidget ( QWidget * parent = nullptr)

Definition at line 156 of file kis_cie_tongue_widget.cpp.

156 :
157 QWidget(parent), d(new Private)
158{
159 d->whitePoint = {0.34773, 0.35952, 1.0};
160 d->gamut = QPolygonF();
161}

References d.

◆ ~KisCIETongueWidget()

KisCIETongueWidget::~KisCIETongueWidget ( )
override

Definition at line 163 of file kis_cie_tongue_widget.cpp.

164{
165 delete d;
166}

References d.

Member Function Documentation

◆ biasedLine()

void KisCIETongueWidget::biasedLine ( int x1,
int y1,
int x2,
int y2 )
private

Definition at line 250 of file kis_cie_tongue_widget.cpp.

251{
252 d->painter.drawLine(x1 + d->xBias, y1, x2 + d->xBias, y2);
253}

References d.

◆ biasedText()

void KisCIETongueWidget::biasedText ( int x,
int y,
const QString & txt )
private

Definition at line 255 of file kis_cie_tongue_widget.cpp.

256{
257 d->painter.drawText(QPoint(d->xBias + x, y), txt);
258}

References d.

◆ colorByCoord()

QRgb KisCIETongueWidget::colorByCoord ( double x,
double y )
protected

Definition at line 260 of file kis_cie_tongue_widget.cpp.

261{
262 // Get xyz components scaled from coordinates
263
264 double cx = ((double)x) / (d->pxcols * devicePixelRatioF() - 1);
265 double cy = 1.0 - ((double)y) / (d->pxrows * devicePixelRatioF() - 1);
266 double cz = 1.0 - cx - cy;
267
268 // Project xyz to XYZ space. Note that in this
269 // particular case we are substituting XYZ with xyz
270
271 //Need to use KoColor here.
272 const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "U8");
273 quint8 data[4];
274 data[0]= cx*255;
275 data[1]= cy*255;
276 data[2]= cz*255;
277 data[3]= 1.0*255;
278 KoColor colXYZ(data, xyzColorSpace);
279 QColor colRGB = colXYZ.toQColor();
280 return qRgb(colRGB.red(), colRGB.green(), colRGB.blue());
281}
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()

References KoColorSpaceRegistry::colorSpace(), d, KoColorSpaceRegistry::instance(), and KoColor::toQColor().

◆ drawColorantTriangle()

void KisCIETongueWidget::drawColorantTriangle ( )
private

Definition at line 460 of file kis_cie_tongue_widget.cpp.

461{
462 d->painter.save();
463 d->painter.setPen(qRgb(80, 80, 80));
464 d->painter.setRenderHint(QPainter::Antialiasing);
465 if (d->colorModel ==KisCIETongueWidget::RGBA && d->Primaries.size() == 3) {
466 drawSmallEllipse(xyYToQPointF(d->Primaries[0]), 255, 128, 128, 6);
467 drawSmallEllipse(xyYToQPointF(d->Primaries[1]), 128, 255, 128, 6);
468 drawSmallEllipse(xyYToQPointF(d->Primaries[2]), 128, 128, 255, 6);
469
470 int x1, y1, x2, y2, x3, y3;
471
472 mapPoint(x1, y1, xyYToQPointF(d->Primaries[0]));
473 mapPoint(x2, y2, xyYToQPointF(d->Primaries[1]));
474 mapPoint(x3, y3, xyYToQPointF(d->Primaries[2]));
475
476 biasedLine(x1, y1, x2, y2);
477 biasedLine(x2, y2, x3, y3);
478 biasedLine(x3, y3, x1, y1);
479 } /*else if (d->colorModel ==CMYK){
480 for (i=0; i<d->Primaries.size();i+++){
481 drawSmallEllipse((QPointF(d->Primaries[0],d->Primaries[1])), 160, 160, 160, 6);//greyscale for now
482 //int x1, y1, x2, y2;
483 //mapPoint(x1, y1, (QPointF(d->Primaries[i],d->Primaries[i+1])) );
484 //mapPoint(x2, y2, (QPointF(d->Primaries[i+3],d->Primaries[i+4])) );
485 //biasedLine(x1, y1, x2, y2);
486 }
487 }
488 */
489
490 d->painter.restore();
491}
void biasedLine(int x1, int y1, int x2, int y2)
void drawSmallEllipse(QPointF xy, int r, int g, int b, int sz)
void mapPoint(int &icx, int &icy, QPointF xy)
QPointF xyYToQPointF(KoColorimetryUtils::xyY xy)

References biasedLine(), d, drawSmallEllipse(), mapPoint(), RGBA, and xyYToQPointF().

◆ drawGamut()

void KisCIETongueWidget::drawGamut ( )
private

Definition at line 498 of file kis_cie_tongue_widget.cpp.

499{
500 d->gamutMap = QPixmap(size() * devicePixelRatioF());
501 d->gamutMap.setDevicePixelRatio(devicePixelRatioF());
502 d->gamutMap.fill(Qt::black);
503 QPainter gamutPaint;
504 gamutPaint.begin(&d->gamutMap);
505 QPainterPath path;
506 //gamutPaint.setCompositionMode(QPainter::CompositionMode_Clear);
507 gamutPaint.setRenderHint(QPainter::Antialiasing);
508 path.setFillRule(Qt::WindingFill);
509 gamutPaint.setBrush(Qt::white);
510 gamutPaint.setPen(Qt::white);
511 int x, y = 0;
512 if (d->colorModel == KisCIETongueWidget::RGBA) {
513 gamutPaint.save();
514 gamutPaint.setOpacity(0.5);
515 mapPoint(x, y, xyYToQPointF(d->Primaries[0]) );
516 path.moveTo(QPointF(x + d->xBias,y));
517 mapPoint(x, y, xyYToQPointF(d->Primaries[1]) );
518 path.lineTo(QPointF(x + d->xBias,y));
519 mapPoint(x, y, xyYToQPointF(d->Primaries[2]) );
520 path.lineTo(QPointF(x + d->xBias,y));
521 mapPoint(x, y, xyYToQPointF(d->Primaries[0]) );
522 path.lineTo(QPointF(x + d->xBias,y));
523 gamutPaint.drawPath(path);
524 gamutPaint.restore();
525 }
526 if (!d->gamut.empty()) {
527
528 gamutPaint.setOpacity(1.0);
529 foreach (QPointF Point, d->gamut) {
530 mapPoint(x, y, Point);
531 gamutPaint.drawEllipse(x + d->xBias- 2, y-2, 4, 4);
532 //Point.setX(x);
533 //Point.setY(y);
534 //path.lineTo(Point);
535 }
536 }
537
538 gamutPaint.end();
539 d->painter.save();
540 d->painter.setOpacity(0.5);
541 d->painter.setCompositionMode(QPainter::CompositionMode_Multiply);
542 d->painter.drawPixmap(0, 0, d->gamutMap);
543 d->painter.setOpacity(1.0);
544 d->painter.restore();
545}
int size(const Forest< T > &forest)
Definition KisForest.h:1232

References d, mapPoint(), RGBA, and xyYToQPointF().

◆ drawLabels()

void KisCIETongueWidget::drawLabels ( )
protected

Definition at line 394 of file kis_cie_tongue_widget.cpp.

395{
396 QFont font;
397 font.setPointSize(5);
398 d->painter.setFont(font);
399
400 for (int x = 450; x <= 650; x += (x > 470 && x < 600) ? 5 : 10)
401 {
402 QString wl;
403 int bx = 0, by = 0, tx, ty;
404
405 if (x < 520)
406 {
407 bx = grids(-22);
408 by = grids(2);
409 }
410 else if (x < 535)
411 {
412 bx = grids(-8);
413 by = grids(-6);
414 }
415 else
416 {
417 bx = grids(4);
418 }
419
420 int ix = (x - 380) / 5;
421
422 QPointF p(spectral_chromaticity[ix][0], spectral_chromaticity[ix][1]);
423
424 int icx, icy;
425 mapPoint(icx, icy, p);
426
427 tx = icx + ((x < 520) ? grids(-2) : ((x >= 535) ? grids(2) : 0));
428 ty = icy + ((x < 520) ? 0 : ((x >= 535) ? grids(-1) : grids(-2)));
429
430 d->painter.setPen(qRgb(255, 255, 255));
431 biasedLine(icx, icy, tx, ty);
432
433 QRgb Color = colorByCoord(icx, icy);
434 d->painter.setPen(Color);
435
436 QTextStream(&wl) << x;
437 biasedText(icx+bx, icy+by, wl);
438 }
439}
const Params2D p
void biasedText(int x, int y, const QString &txt)
QRgb colorByCoord(double x, double y)
int grids(double val) const
static const double spectral_chromaticity[81][3]
unsigned int QRgb

References biasedLine(), biasedText(), colorByCoord(), d, grids(), mapPoint(), p, and spectral_chromaticity.

◆ drawPatches()

void KisCIETongueWidget::drawPatches ( )
private

◆ drawSmallEllipse()

void KisCIETongueWidget::drawSmallEllipse ( QPointF xy,
int r,
int g,
int b,
int sz )
protected

Definition at line 441 of file kis_cie_tongue_widget.cpp.

442{
443 int icx, icy;
444
445 mapPoint(icx, icy, xy);
446 d->painter.save();
447 d->painter.setRenderHint(QPainter::Antialiasing);
448 d->painter.setPen(qRgb(r, g, b));
449 d->painter.drawEllipse(icx + d->xBias- sz/2, icy-sz/2, sz, sz);
450 d->painter.setPen(qRgb(r/2, g/2, b/2));
451 int sz2 = sz-2;
452 d->painter.drawEllipse(icx + d->xBias- sz2/2, icy-sz2/2, sz2, sz2);
453 d->painter.restore();
454}

References d, and mapPoint().

◆ drawTongueAxis()

void KisCIETongueWidget::drawTongueAxis ( )
protected

Definition at line 351 of file kis_cie_tongue_widget.cpp.

352{
353 QFont font;
354 font.setPointSize(6);
355 d->painter.setFont(font);
356
357 d->painter.setPen(qRgb(255, 255, 255));
358
359 biasedLine(0, 0, 0, d->pxrows - 1);
360 biasedLine(0, d->pxrows-1, d->pxcols-1, d->pxrows - 1);
361
362 for (int y = 1; y <= 9; y += 1)
363 {
364 QString s;
365 int xstart = (y * (d->pxcols - 1)) / 10;
366 int ystart = (y * (d->pxrows - 1)) / 10;
367
368 QTextStream(&s) << y;
369 biasedLine(xstart, d->pxrows - grids(1), xstart, d->pxrows - grids(4));
370 biasedText(xstart - grids(11), d->pxrows + grids(15), s);
371
372 QTextStream(&s) << 10 - y;
373 biasedLine(0, ystart, grids(3), ystart);
374 biasedText(grids(-25), ystart + grids(5), s);
375 }
376}

References biasedLine(), biasedText(), d, and grids().

◆ drawTongueGrid()

void KisCIETongueWidget::drawTongueGrid ( )
protected

Definition at line 378 of file kis_cie_tongue_widget.cpp.

379{
380 d->painter.setPen(qRgb(128, 128, 128));
381 d->painter.setOpacity(0.5);
382
383 for (int y = 1; y <= 9; y += 1)
384 {
385 int xstart = (y * (d->pxcols - 1)) / 10;
386 int ystart = (y * (d->pxrows - 1)) / 10;
387
388 biasedLine(xstart, grids(4), xstart, d->pxrows - grids(4) - 1);
389 biasedLine(grids(7), ystart, d->pxcols-1-grids(7), ystart);
390 }
391 d->painter.setOpacity(1.0);
392}

References biasedLine(), d, and grids().

◆ drawWhitePoint()

void KisCIETongueWidget::drawWhitePoint ( )
private

Definition at line 493 of file kis_cie_tongue_widget.cpp.

494{
495 drawSmallEllipse(xyYToQPointF(d->whitePoint), 255, 255, 255, 8);
496}

References d, drawSmallEllipse(), and xyYToQPointF().

◆ fillTongue()

void KisCIETongueWidget::fillTongue ( )
protected

Definition at line 311 of file kis_cie_tongue_widget.cpp.

312{
313 QImage Img = d->cietongue.toImage();
314 Img.setDevicePixelRatio(devicePixelRatioF());
315
316 int x;
317
318 for (int y = 0; y < d->pxrows * devicePixelRatioF(); ++y) {
319 int xe = 0;
320
321 // Find horizontal extents of tongue on this line.
322
323 for (x = 0; x < d->pxcols * devicePixelRatioF(); ++x) {
324 if (QColor(Img.pixel(x + d->xBias, y)) != QColor(Qt::black))
325 {
326 for (xe = (d->pxcols * devicePixelRatioF()) - 1; xe >= x;
327 --xe) {
328 if (QColor(Img.pixel(xe + d->xBias, y)) != QColor(Qt::black))
329 {
330 break;
331 }
332 }
333
334 break;
335 }
336 }
337
338 if (x < d->pxcols * devicePixelRatioF()) {
339 for ( ; x <= xe; ++x)
340 {
341 QRgb Color = colorByCoord(x, y);
342 Img.setPixel(x + d->xBias, y, Color);
343 }
344 }
345 }
346
347 d->cietongue = QPixmap::fromImage(Img, Qt::AvoidDither);
348 d->cietongue.setDevicePixelRatio(devicePixelRatioF());
349}

References colorByCoord(), d, and pxcols.

◆ grids()

int KisCIETongueWidget::grids ( double val) const
protected

Definition at line 168 of file kis_cie_tongue_widget.cpp.

169{
170 return (int) floor(val * d->gridside + 0.5);
171}

References d.

◆ loadingFailed()

void KisCIETongueWidget::loadingFailed ( )

◆ loadingStarted()

void KisCIETongueWidget::loadingStarted ( )

◆ mapPoint()

void KisCIETongueWidget::mapPoint ( int & icx,
int & icy,
QPointF xy )
private

Definition at line 244 of file kis_cie_tongue_widget.cpp.

245{
246 icx = (int) floor((xy.x() * (d->pxcols - 1)) + .5);
247 icy = (int) floor(((d->pxrows - 1) - xy.y() * (d->pxrows - 1)) + .5);
248}

References d.

◆ outlineTongue()

void KisCIETongueWidget::outlineTongue ( )
protected

Definition at line 283 of file kis_cie_tongue_widget.cpp.

284{
285 int lx=0, ly=0;
286 int fx=0, fy=0;
287
288 for (int x = 380; x <= 700; x += 5) {
289 int ix = (x - 380) / 5;
290
291 QPointF p(spectral_chromaticity[ix][0], spectral_chromaticity[ix][1]);
292 int icx, icy;
293 mapPoint(icx, icy, p);
294
295 if (x > 380) {
296 biasedLine(lx, ly, icx, icy);
297 }
298 else {
299 fx = icx;
300 fy = icy;
301 }
302
303 lx = icx;
304 ly = icy;
305
306 }
307
308 biasedLine(lx, ly, fx, fy);
309}

References biasedLine(), mapPoint(), p, and spectral_chromaticity.

◆ paintEvent()

void KisCIETongueWidget::paintEvent ( QPaintEvent * )
overrideprotected

Definition at line 604 of file kis_cie_tongue_widget.cpp.

605{
606 QPainter p(this);
607
608 // Widget is disable : drawing grayed frame.
609
610 if ( !isEnabled() )
611 {
612 p.fillRect(0, 0, width(), height(),
613 palette().color(QPalette::Disabled, QPalette::Window));
614
615 QPen pen(palette().color(QPalette::Disabled, QPalette::WindowText));
616 pen.setStyle(Qt::SolidLine);
617 pen.setWidth(1);
618
619 p.setPen(pen);
620 p.drawRect(0, 0, width(), height());
621
622 return;
623 }
624
625
626 // No profile data to show, or RAW file
627
628 if (!d->profileDataAvailable)
629 {
630 p.fillRect(0, 0, width(), height(), palette().color(QPalette::Active, QPalette::Window));
631 QPen pen(palette().color(QPalette::Active, QPalette::Text));
632 pen.setStyle(Qt::SolidLine);
633 pen.setWidth(1);
634
635 p.setPen(pen);
636 p.drawRect(0, 0, width(), height());
637
638 if (d->uncalibratedColor)
639 {
640 p.drawText(0, 0, width(), height(), Qt::AlignCenter,
641 i18n("Uncalibrated color space"));
642 }
643 else
644 {
645 p.setPen(Qt::red);
646 p.drawText(0, 0, width(), height(), Qt::AlignCenter,
647 i18n("No profile available..."));
648 }
649
650 return;
651 }
652
653 // Create CIE tongue if needed
654 if (d->needUpdatePixmap)
655 {
656 updatePixmap();
657 }
658
659 // draw prerendered tongue
660 p.drawPixmap(0, 0, d->pixmap);
661}
rgba palette[MAX_PALETTE]
Definition palette.c:35

References d, p, palette, and updatePixmap().

◆ resizeEvent()

void KisCIETongueWidget::resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 663 of file kis_cie_tongue_widget.cpp.

664{
665 QWidget::resizeEvent(event);
666 d->needUpdatePixmap = true;
667 d->cieTongueNeedsUpdate = true;
668}

References d.

◆ setCMYKData()

void KisCIETongueWidget::setCMYKData ( KoColorimetryUtils::xyY whitepoint)

Definition at line 202 of file kis_cie_tongue_widget.cpp.

203{
204 //d->Primaries= colorants;
205
206 d->whitePoint = whitepoint;
207 d->needUpdatePixmap = true;
208 d->colorModel = KisCIETongueWidget::CMYKA;
209 d->profileDataAvailable = true;
210}

References CMYKA, and d.

◆ setGamut()

void KisCIETongueWidget::setGamut ( QPolygonF gamut)

Definition at line 185 of file kis_cie_tongue_widget.cpp.

186{
187 d->gamut=gamut;
188}

References d, and gamut.

◆ setGrayData()

void KisCIETongueWidget::setGrayData ( KoColorimetryUtils::xyY whitepoint)

Definition at line 218 of file kis_cie_tongue_widget.cpp.

219{
220 d->whitePoint = whitepoint;
221 d->needUpdatePixmap = true;
222 d->colorModel = KisCIETongueWidget::GRAYA;
223 d->profileDataAvailable = true;
224}

References d, and GRAYA.

◆ setLABData()

void KisCIETongueWidget::setLABData ( KoColorimetryUtils::xyY whitepoint)

Definition at line 225 of file kis_cie_tongue_widget.cpp.

226{
227 d->whitePoint = whitepoint;
228 d->needUpdatePixmap = true;
229 d->colorModel = KisCIETongueWidget::LABA;
230 d->profileDataAvailable = true;
231}

References d, and LABA.

◆ setProfileData()

void KisCIETongueWidget::setProfileData ( QVector< KoColorimetryUtils::xyY > p,
KoColorimetryUtils::xyY w,
bool profileData = false )

Definition at line 173 of file kis_cie_tongue_widget.cpp.

174{
175 d->profileDataAvailable = profileData;
176 if (profileData){
177 d->Primaries = p;
178
179 d->whitePoint = w;
180 d->needUpdatePixmap = true;
181 } else {
182 return;
183 }
184}

References d, and p.

◆ setProfileDataAvailable()

void KisCIETongueWidget::setProfileDataAvailable ( bool dataAvailable)

Definition at line 240 of file kis_cie_tongue_widget.cpp.

241{
242 d->profileDataAvailable = dataAvailable;
243}

References d.

◆ setRGBData()

void KisCIETongueWidget::setRGBData ( KoColorimetryUtils::xyY whitepoint,
QVector< KoColorimetryUtils::xyY > colorants )

Definition at line 189 of file kis_cie_tongue_widget.cpp.

190{
191 if (colorants.size()==3){
192 d->Primaries= colorants;
193
194 d->whitePoint = whitepoint;
195 d->needUpdatePixmap = true;
196 d->colorModel = KisCIETongueWidget::RGBA;
197 d->profileDataAvailable = true;
198 } else {
199 return;
200 }
201}

References d, and RGBA.

◆ setXYZData()

void KisCIETongueWidget::setXYZData ( KoColorimetryUtils::xyY whitepoint)

Definition at line 211 of file kis_cie_tongue_widget.cpp.

212{
213 d->whitePoint = whitepoint;
214 d->needUpdatePixmap = true;
215 d->colorModel = KisCIETongueWidget::XYZA;
216 d->profileDataAvailable = true;
217}

References d, and XYZA.

◆ setYCbCrData()

void KisCIETongueWidget::setYCbCrData ( KoColorimetryUtils::xyY whitepoint)

Definition at line 232 of file kis_cie_tongue_widget.cpp.

233{
234 d->whitePoint = whitepoint;
235 d->needUpdatePixmap = true;
236 d->colorModel = KisCIETongueWidget::YCbCrA;
237 d->profileDataAvailable = true;
238}

References d, and YCbCrA.

◆ uncalibratedColor()

void KisCIETongueWidget::uncalibratedColor ( )

◆ updatePixmap()

void KisCIETongueWidget::updatePixmap ( )
private

Definition at line 547 of file kis_cie_tongue_widget.cpp.

548{
549 d->needUpdatePixmap = false;
550 d->pixmap = QPixmap(size() * devicePixelRatioF());
551 d->pixmap.setDevicePixelRatio(devicePixelRatioF());
552
553 if (d->cieTongueNeedsUpdate){
554 // Draw the CIE tongue curve. I don't see why we need to redraw it every time the whitepoint and such changes so we cache it.
555 d->cieTongueNeedsUpdate = false;
556 d->cietongue = QPixmap(size() * devicePixelRatioF());
557 d->cietongue.setDevicePixelRatio(devicePixelRatioF());
558 d->cietongue.fill(Qt::black);
559 d->painter.begin(&d->cietongue);
560
561 int pixcols = static_cast<int>(d->cietongue.width()
562 / d->cietongue.devicePixelRatioF());
563 int pixrows = static_cast<int>(d->cietongue.height()
564 / d->cietongue.devicePixelRatioF());
565
566 d->gridside = (qMin(pixcols, pixrows)) / 512.0;
567 d->xBias = grids(32);
568 d->yBias = grids(20);
569 d->pxcols = pixcols - d->xBias;
570 d->pxrows = pixrows - d->yBias;
571
572 d->painter.setBackground(QBrush(qRgb(0, 0, 0)));
573 d->painter.setPen(qRgb(255, 255, 255));
574
576 d->painter.end();
577
578 fillTongue();
579
580 d->painter.begin(&d->cietongue);
582 drawLabels();
584 d->painter.end();
585 }
586 d->pixmap = d->cietongue;
587
588 d->painter.begin(&d->pixmap);
589 //draw whitepoint and colorants
590 if (d->whitePoint.Y > 0.0)
591 {
593 }
594
595 if (!d->Primaries.isEmpty())
596 {
598 }
599 drawGamut();
600
601 d->painter.end();
602}

References d, drawColorantTriangle(), drawGamut(), drawLabels(), drawTongueAxis(), drawTongueGrid(), drawWhitePoint(), fillTongue(), grids(), and outlineTongue().

Member Data Documentation

◆ cietongue

QPixmap KisCIETongueWidget::cietongue

Definition at line 147 of file kis_cie_tongue_widget.cpp.

◆ cieTongueNeedsUpdate

bool KisCIETongueWidget::cieTongueNeedsUpdate {true}

Definition at line 134 of file kis_cie_tongue_widget.cpp.

134{true};

◆ colorModel

model KisCIETongueWidget::colorModel {model::RGBA}

Definition at line 153 of file kis_cie_tongue_widget.cpp.

◆ d

Private* const KisCIETongueWidget::d {nullptr}
private

Definition at line 87 of file kis_cie_tongue_widget.h.

87{nullptr};

◆ gamut

QPolygonF KisCIETongueWidget::gamut

Definition at line 152 of file kis_cie_tongue_widget.cpp.

◆ gamutMap

QPixmap KisCIETongueWidget::gamutMap

Definition at line 148 of file kis_cie_tongue_widget.cpp.

◆ gridside

double KisCIETongueWidget::gridside {0.0}

Definition at line 142 of file kis_cie_tongue_widget.cpp.

142{0.0};

◆ needUpdatePixmap

bool KisCIETongueWidget::needUpdatePixmap {false}

Definition at line 133 of file kis_cie_tongue_widget.cpp.

133{false};

◆ painter

QPainter KisCIETongueWidget::painter

Definition at line 144 of file kis_cie_tongue_widget.cpp.

◆ pixmap

QPixmap KisCIETongueWidget::pixmap

Definition at line 146 of file kis_cie_tongue_widget.cpp.

◆ Primaries

QVector<KoColorimetryUtils::xyY> KisCIETongueWidget::Primaries

Definition at line 150 of file kis_cie_tongue_widget.cpp.

◆ profileDataAvailable

bool KisCIETongueWidget::profileDataAvailable {false}

Definition at line 132 of file kis_cie_tongue_widget.cpp.

132{false};

◆ pxcols

int KisCIETongueWidget::pxcols {0}

Definition at line 139 of file kis_cie_tongue_widget.cpp.

139{0};

◆ pxrows

int KisCIETongueWidget::pxrows {0}

Definition at line 140 of file kis_cie_tongue_widget.cpp.

140{0};

◆ uncalibratedColor

bool KisCIETongueWidget::uncalibratedColor {false}

Definition at line 135 of file kis_cie_tongue_widget.cpp.

135{false};

◆ whitePoint

KoColorimetryUtils::xyY KisCIETongueWidget::whitePoint

Definition at line 151 of file kis_cie_tongue_widget.cpp.

◆ xBias

int KisCIETongueWidget::xBias {0}

Definition at line 137 of file kis_cie_tongue_widget.cpp.

137{0};

◆ yBias

int KisCIETongueWidget::yBias {0}

Definition at line 138 of file kis_cie_tongue_widget.cpp.

138{0};

The documentation for this class was generated from the following files: