{
m_scaling = 1 - (float)sliderScaling->value()/100;
- lblScaleNr->setText("0..." + QString::number(m_scaling, 'f', 2));
+ switch(cbColorspace->itemData(cbColorspace->currentIndex()).toInt()){
+ case CPE_RGB_CURVE:
+ lblScaleNr->setText(QChar(0xb1) + QString::number(sliderScaling->value(), 'f', 2));;
+ break;
+ default:
+ lblScaleNr->setText("0..." + QString::number(m_scaling, 'f', 2));
+ break;
+ }
switch (cbColorspace->itemData(cbColorspace->currentIndex()).toInt()) {
case CPE_YUV_Y:
img = m_colorTools->yuvColorWheel(size, sliderColor->value(), m_scaling, true, false);
break;
case CPE_RGB_CURVE:
- img = m_colorTools->rgbCurvePlane(size, (ColorTools::ColorsRGB) (cbVariant->itemData(cbVariant->currentIndex()).toInt()));
+ img = m_colorTools->rgbCurvePlane(size, (ColorTools::ColorsRGB) (cbVariant->itemData(cbVariant->currentIndex()).toInt()),
+ (double)sliderScaling->value()/255);
break;
case CPE_YPbPr:
img = m_colorTools->yPbPrColorWheel(size, sliderColor->value(), m_scaling, false);
lblSliderName->setToolTip(i18n("Angle through the UV plane, with all possible Y values."));
break;
case CPE_RGB_CURVE:
- // deliberately fall through
+ enableSliderScaling(true);
+ enableSliderColor(false);
+ enableCbVariant(true);
+ sliderScaling->setRange(1,255);
+ sliderScaling->setValue(255);
+ cbVariant->addItem(i18n("Red"), QVariant(ColorTools::COL_R));
+ cbVariant->addItem(i18n("Green"), QVariant(ColorTools::COL_G));
+ cbVariant->addItem(i18n("Blue"), QVariant(ColorTools::COL_B));
+ cbVariant->addItem(i18n("Luma"), QVariant(ColorTools::COL_Luma));
+ break;
default:
enableSliderScaling(false);
enableSliderColor(false);
cbVariant->addItem(i18n("Red"), QVariant(ColorTools::COL_R));
cbVariant->addItem(i18n("Green"), QVariant(ColorTools::COL_G));
cbVariant->addItem(i18n("Blue"), QVariant(ColorTools::COL_B));
+ cbVariant->addItem(i18n("Luma"), QVariant(ColorTools::COL_Luma));
break;
}
this->update();
}
-QImage ColorTools::rgbCurvePlane(const QSize &size, const ColorsRGB &color)
+QImage ColorTools::rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color, float scaling)
{
+ Q_ASSERT(scaling > 0 && scaling <= 1);
+
QImage plane(size, QImage::Format_ARGB32);
if (size.width() == 0 || size.height() == 0) {
qCritical("ERROR: Size of the color plane must not be 0!");
dval = (double)255*x/(w-1);
for (int y = 0; y < h; y++) {
- dcol = (double)255*y/(h-1);
+ if (1-scaling < 0.0001) {
+ dcol = (double)255*y/(h-1);
+ } else {
+ dcol = (double)255 * (y - (y-x)*(1-scaling))/(h-1);
+ }
if (color == ColorTools::COL_R) {
plane.setPixel(x, (h-y-1), qRgb(dcol, dval, dval));
} else if (color == ColorTools::COL_G) {
plane.setPixel(x, (h-y-1), qRgb(dval, dcol, dval));
- } else {
+ } else if (color == ColorTools::COL_B){
plane.setPixel(x, (h-y-1), qRgb(dval, dval, dcol));
+ } else {
+ plane.setPixel(x, (h-y-1), qRgb(dcol, dcol, dcol));
}
}
public:
ColorTools();
- enum ColorsRGB { COL_R, COL_G, COL_B };
+ enum ColorsRGB { COL_R, COL_G, COL_B, COL_Luma };
/**
@brief Draws a UV plane with given Y value.
are neutral colors. The colors on the y axis show what the neutral color will look like when modifying the curve.
color defines the color to modify on the y axis. The other two components will be increased
in equal terms (linear as well) on the x axis.
+ scaling \in ]0,1] defines the maximum variance of the selected component; Chosing a value lower than 1
+ simulates the case that the curves can adjust only +- scaling*255. This mainly delivers a more constant look
+ when also using the Luma component for the curves display but might not represent the actual color change!
*/
- static QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color);
+ static QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color, float scaling = 1);
/**
@brief Draws a YPbPr plane with Pb on the x axis and Pr on the y axis.
Y is the Y value to use.
<rect>
<x>0</x>
<y>0</y>
- <width>553</width>
- <height>241</height>
+ <width>551</width>
+ <height>239</height>
</rect>
</property>
<property name="windowTitle">
<item row="2" column="0">
<widget class="QLabel" name="lblSliderName">
<property name="text">
- <string notr="true">(notr.ansl.)</string>
+ <string notr="true">(notransl.)</string>
</property>
</widget>
</item>