64{
68
69 QLabel::paintEvent(event);
70 QPainter painter(this);
71 painter.fillRect(0, 0, this->width(), this->height(), this->
palette().dark().color());
72 painter.setPen(this->
palette().light().color());
73
74 const int NGRID = 4;
75 for (int i = 0; i <= NGRID; ++i) {
76 painter.drawLine(this->width()*i / NGRID, 0., this->width()*i / NGRID, this->height());
77 painter.drawLine(0., this->height()*i / NGRID, this->width(), this->height()*i / NGRID);
78 }
79
82 unsigned int highest = 0;
83
84 for (int chan = 0; chan < channels.size(); chan++) {
87
88 int nthPercentile = 2 * histogramTemp.size() / 100;
89
90 std::nth_element(histogramTemp.begin(),
91 histogramTemp.begin() + nthPercentile, histogramTemp.end(), std::greater<int>());
92 unsigned int max = *(histogramTemp.begin() + nthPercentile);
93
94 highest = std::max(max, highest);
95 }
96 }
97
98 painter.setWindow(QRect(-1, 0, nBins + 1, highest));
99 painter.setCompositionMode(QPainter::CompositionMode_Plus);
100
101 for (int chan = 0; chan < (int)nChannels; chan++) {
103 QColor color = channels.at(chan)->color();
104
105
107 color = QColor(Qt::gray);
108 }
109
110 QColor fill_color = color;
111 fill_color.setAlphaF(.25);
112 painter.setBrush(fill_color);
113 QPen pen = QPen(color);
114 pen.setWidth(0);
115 painter.setPen(pen);
116
118 QPainterPath path;
119 path.moveTo(QPointF(-1, highest));
120 for (qint32 i = 0; i < nBins; ++i) {
122 path.lineTo(QPointF(i,
v));
123
124 }
125 path.lineTo(QPointF(nBins + 1, highest));
126 path.closeSubpath();
127 painter.drawPath(path);
128 } else {
129 pen.setWidth(1);
130 painter.setPen(pen);
131 for (qint32 i = 0; i < nBins; ++i) {
133 painter.drawLine(QPointF(i, highest), QPointF(i,
v));
134 }
135 }
136 }
137 }
138 }
139}
@ ALPHA
The channel represents the opacity of a pixel.
QList< KoChannelInfo * > channels
virtual quint32 channelCount() const =0
virtual quint32 colorChannelCount() const =0
constexpr std::enable_if< sizeof...(values)==0, size_t >::type max()
rgba palette[MAX_PALETTE]