Implement drawing border for framing tool
* Draws border after all resize operations are complete * Update the RGB sliders for 16-bit channels
This commit is contained in:
parent
a96dc4cdde
commit
7ccab91434
@ -237,6 +237,8 @@ enum class BlurType {
|
|||||||
int framedHeight = 0;
|
int framedHeight = 0;
|
||||||
};
|
};
|
||||||
FramingData framing(const FramingArgs& args) const;
|
FramingData framing(const FramingArgs& args) const;
|
||||||
|
Imagefloat* drawFrame(Imagefloat* rgb, const procparams::FramingParams& params,
|
||||||
|
const FramingData& dims) const;
|
||||||
|
|
||||||
void deconvsharpening(float** luminance, float** buffer, const float* const * blend, int W, int H, const procparams::SharpeningParams &sharpenParam, double Scale);
|
void deconvsharpening(float** luminance, float** buffer, const float* const * blend, int W, int H, const procparams::SharpeningParams &sharpenParam, double Scale);
|
||||||
void deconvsharpeningloc(float** luminance, float** buffer, int W, int H, float** loctemp, int damp, double radi, int ite, int amo, int contrast, double blurrad, int sk);
|
void deconvsharpeningloc(float** luminance, float** buffer, int W, int H, float** loctemp, int damp, double radi, int ite, int amo, int contrast, double blurrad, int sk);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "improcfun.h"
|
#include "improcfun.h"
|
||||||
|
|
||||||
#include "alignedbuffer.h"
|
#include "alignedbuffer.h"
|
||||||
|
#include "color.h"
|
||||||
#include "imagefloat.h"
|
#include "imagefloat.h"
|
||||||
#include "labimage.h"
|
#include "labimage.h"
|
||||||
#include "opthelper.h"
|
#include "opthelper.h"
|
||||||
@ -1065,4 +1066,60 @@ ImProcFunctions::FramingData ImProcFunctions::framing(const FramingArgs& args) c
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draws the border around the input image.
|
||||||
|
// It should be called after gamma correction.
|
||||||
|
Imagefloat* ImProcFunctions::drawFrame(Imagefloat* rgb, const FramingParams& params,
|
||||||
|
const FramingData& dims) const
|
||||||
|
{
|
||||||
|
if (rgb->getWidth() > dims.framedWidth || rgb->getHeight() > dims.framedHeight) {
|
||||||
|
return rgb;
|
||||||
|
}
|
||||||
|
if (rgb->getWidth() == dims.framedWidth && rgb->getHeight() == dims.framedHeight) {
|
||||||
|
return rgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
Imagefloat* framed = new Imagefloat(dims.framedWidth, dims.framedHeight);
|
||||||
|
|
||||||
|
auto clip = [](int v) { return std::max(0, std::min(v, 65535)); };
|
||||||
|
|
||||||
|
float r = Color::gamma2curve[clip(params.borderRed)];
|
||||||
|
float g = Color::gamma2curve[clip(params.borderGreen)];
|
||||||
|
float b = Color::gamma2curve[clip(params.borderBlue)];
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel for if (multiThread)
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < framed->getHeight(); i++) {
|
||||||
|
for (int j = 0; j < framed->getWidth(); j++) {
|
||||||
|
framed->r(i, j) = r;
|
||||||
|
framed->g(i, j) = g;
|
||||||
|
framed->b(i, j) = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto offset = [](int inner, int outer) {
|
||||||
|
double u = inner;
|
||||||
|
double v = outer;
|
||||||
|
return static_cast<int>(std::round((v - u) / 2.0));
|
||||||
|
};
|
||||||
|
int rowOffset = offset(rgb->getHeight(), framed->getHeight());
|
||||||
|
int colOffset = offset(rgb->getWidth(), framed->getWidth());
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel for if (multiThread)
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < rgb->getHeight(); i++) {
|
||||||
|
for (int j = 0; j < rgb->getWidth(); j++) {
|
||||||
|
int row = i + rowOffset;
|
||||||
|
int col = j + colOffset;
|
||||||
|
|
||||||
|
framed->r(row, col) = rgb->r(i, j);
|
||||||
|
framed->g(row, col) = rgb->g(i, j);
|
||||||
|
framed->b(row, col) = rgb->b(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return framed;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace rtengine
|
} // namespace rtengine
|
@ -2027,7 +2027,9 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Blit framing border + image
|
if (framingData.enabled) {
|
||||||
|
readyImg = ipf.drawFrame(readyImg, params.framing, framingData);
|
||||||
|
}
|
||||||
|
|
||||||
Exiv2Metadata info(imgsrc->getFileName());
|
Exiv2Metadata info(imgsrc->getFileName());
|
||||||
|
|
||||||
|
@ -449,11 +449,11 @@ void Framing::setupBorderColorsGui()
|
|||||||
frame->set_label_widget(*label);
|
frame->set_label_widget(*label);
|
||||||
|
|
||||||
Gtk::Box* const box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
|
Gtk::Box* const box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
|
||||||
redAdj = Gtk::manage(new Adjuster(M("TP_FRAMING_RED"), 0, 255, 1, 255));
|
redAdj = Gtk::manage(new Adjuster(M("TP_FRAMING_RED"), 0, 65535, 1, 65535));
|
||||||
box->add(*redAdj);
|
box->add(*redAdj);
|
||||||
greenAdj = Gtk::manage(new Adjuster(M("TP_FRAMING_GREEN"), 0, 255, 1, 255));
|
greenAdj = Gtk::manage(new Adjuster(M("TP_FRAMING_GREEN"), 0, 65535, 1, 65535));
|
||||||
box->add(*greenAdj);
|
box->add(*greenAdj);
|
||||||
blueAdj = Gtk::manage(new Adjuster(M("TP_FRAMING_BLUE"), 0, 255, 1, 255));
|
blueAdj = Gtk::manage(new Adjuster(M("TP_FRAMING_BLUE"), 0, 65535, 1, 65535));
|
||||||
box->add(*blueAdj);
|
box->add(*blueAdj);
|
||||||
|
|
||||||
frame->add(*box);
|
frame->add(*box);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user