}
-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!");
const int h = size.height();
double dcol, dval;
+ double dx, dy;
for (int x = 0; x < w; x++) {
dval = (double)255*x/(w-1);
for (int y = 0; y < h; y++) {
- dcol = (double)255*y/(h-1);
+ dy = (double)y/(h-1);
+ dx = (double)x/(w-1);
+
+ if (1-scaling < 0.0001) {
+ dcol = (double)255*dy;
+ } else {
+ dcol = (double)255 * (dy - (dy-dx)*(1-scaling));
+ }
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));
}
}