Restored tone mapping control of canvas preview
This commit is contained in:
parent
8ef8b0386c
commit
18a669675f
5 changed files with 29 additions and 5 deletions
|
@ -28,6 +28,16 @@ void WidgetPreviewCanvas::setCanvas(const Canvas *canvas)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WidgetPreviewCanvas::setToneMapping(const ColorProfile &profile)
|
||||||
|
{
|
||||||
|
if (canvas)
|
||||||
|
{
|
||||||
|
canvas->getPreview()->setToneMapping(profile);
|
||||||
|
canvas->getPreview()->updateLive(this);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WidgetPreviewCanvas::paintEvent(QPaintEvent *)
|
void WidgetPreviewCanvas::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
namespace paysages {
|
namespace paysages {
|
||||||
namespace desktop {
|
namespace desktop {
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
* \brief Widget to display a live-updated preview of a Canvas software rendering.
|
* Widget to display a live-updated preview of a Canvas software rendering.
|
||||||
*/
|
*/
|
||||||
class WidgetPreviewCanvas : public QWidget, public CanvasLiveClient
|
class WidgetPreviewCanvas : public QWidget, public CanvasLiveClient
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,18 @@ public:
|
||||||
explicit WidgetPreviewCanvas(QWidget *parent = 0);
|
explicit WidgetPreviewCanvas(QWidget *parent = 0);
|
||||||
virtual ~WidgetPreviewCanvas();
|
virtual ~WidgetPreviewCanvas();
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
* \brief Set the canvas to watch and display, null to stop watching.
|
* Set the canvas to watch and display, null to stop watching.
|
||||||
*
|
*
|
||||||
* This function must be called from the graphics thread.
|
* This function must be called from the graphics thread.
|
||||||
*/
|
*/
|
||||||
void setCanvas(const Canvas *canvas);
|
void setCanvas(const Canvas *canvas);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the tone mapping to apply to pixel colors.
|
||||||
|
*/
|
||||||
|
void setToneMapping(const ColorProfile &profile);
|
||||||
|
|
||||||
virtual void paintEvent(QPaintEvent* event);
|
virtual void paintEvent(QPaintEvent* event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -99,6 +99,8 @@ DialogRender::DialogRender(QWidget *parent, SoftwareCanvasRenderer* renderer):
|
||||||
connect(_save_button, SIGNAL(clicked()), this, SLOT(saveRender()));
|
connect(_save_button, SIGNAL(clicked()), this, SLOT(saveRender()));
|
||||||
connect(_tonemapping_control, SIGNAL(currentIndexChanged(int)), this, SLOT(toneMappingChanged()));
|
connect(_tonemapping_control, SIGNAL(currentIndexChanged(int)), this, SLOT(toneMappingChanged()));
|
||||||
connect(_exposure_control, SIGNAL(valueChanged(int)), this, SLOT(toneMappingChanged()));
|
connect(_exposure_control, SIGNAL(valueChanged(int)), this, SLOT(toneMappingChanged()));
|
||||||
|
|
||||||
|
toneMappingChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogRender::~DialogRender()
|
DialogRender::~DialogRender()
|
||||||
|
@ -166,7 +168,7 @@ void DialogRender::saveRender()
|
||||||
void DialogRender::toneMappingChanged()
|
void DialogRender::toneMappingChanged()
|
||||||
{
|
{
|
||||||
ColorProfile profile((ColorProfile::ToneMappingOperator)_tonemapping_control->currentIndex(), ((double)_exposure_control->value()) * 0.01);
|
ColorProfile profile((ColorProfile::ToneMappingOperator)_tonemapping_control->currentIndex(), ((double)_exposure_control->value()) * 0.01);
|
||||||
//canvas_renderer->render_area->setToneMapping(profile);
|
canvas_preview->setToneMapping(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogRender::loadLastRender()
|
void DialogRender::loadLastRender()
|
||||||
|
|
|
@ -72,6 +72,12 @@ void CanvasPreview::setSize(int real_width, int real_height, int preview_width,
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CanvasPreview::setToneMapping(const ColorProfile &profile)
|
||||||
|
{
|
||||||
|
profile.copy(this->profile);
|
||||||
|
setAllDirty();
|
||||||
|
}
|
||||||
|
|
||||||
void CanvasPreview::reset()
|
void CanvasPreview::reset()
|
||||||
{
|
{
|
||||||
lock->acquire();
|
lock->acquire();
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
const Color &getFinalPixel(int x, int y) const;
|
const Color &getFinalPixel(int x, int y) const;
|
||||||
|
|
||||||
void setSize(int real_width, int real_height, int preview_width, int preview_height);
|
void setSize(int real_width, int real_height, int preview_width, int preview_height);
|
||||||
|
void setToneMapping(const ColorProfile &profile);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
void initLive(CanvasLiveClient *client);
|
void initLive(CanvasLiveClient *client);
|
||||||
|
|
Loading…
Reference in a new issue