Add selection of background colour (or checkerboard pattern)

This commit is contained in:
baldurk
2016-10-03 14:56:55 +02:00
parent 5135fd6a56
commit 97130b25d8
2 changed files with 46 additions and 0 deletions
+43
View File
@@ -1,5 +1,6 @@
#include "TextureViewer.h"
#include <QColorDialog>
#include "Code/Core.h"
#include "FlowLayout.h"
#include "ui_TextureViewer.h"
@@ -30,6 +31,8 @@ TextureViewer::TextureViewer(Core *core, QWidget *parent)
m_TexDisplay.linearDisplayAsGamma = true;
m_TexDisplay.rangemax = 1.0f;
on_checkerBack_clicked();
QWidget *renderContainer = ui->renderContainer;
QObject::connect(ui->render, &CustomPaintWidget::clicked, this, &TextureViewer::render_mouseClick);
@@ -1163,3 +1166,43 @@ void TextureViewer::on_reset01_clicked()
void TextureViewer::on_visualiseRange_clicked()
{
}
void TextureViewer::on_backcolorPick_clicked()
{
QColor col = QColorDialog::getColor(Qt::black, this, tr("Choose background colour"));
if(!col.isValid())
col = QColor(0, 0, 0);
col = col.toRgb();
m_TexDisplay.darkBackgroundColour = m_TexDisplay.lightBackgroundColour =
FloatVector(col.redF(), col.greenF(), col.blueF(), 1.0f);
ui->backcolorPick->setChecked(true);
ui->checkerBack->setChecked(false);
INVOKE_MEMFN(RT_UpdateAndDisplay);
if(m_Output == NULL)
{
ui->render->update();
ui->pixelcontextgrid->update();
}
}
void TextureViewer::on_checkerBack_clicked()
{
ui->checkerBack->setChecked(true);
ui->backcolorPick->setChecked(false);
m_TexDisplay.lightBackgroundColour = FloatVector(0.81f, 0.81f, 0.81f, 1.0f);
m_TexDisplay.darkBackgroundColour = FloatVector(0.57f, 0.57f, 0.57f, 1.0f);
INVOKE_MEMFN(RT_UpdateAndDisplay);
if(m_Output == NULL)
{
ui->render->update();
ui->pixelcontextgrid->update();
}
}
+3
View File
@@ -46,6 +46,9 @@ private slots:
void on_channelsWidget_toggled(bool checked) { UI_UpdateChannels(); }
void on_channelsWidget_selected(int index) { UI_UpdateChannels(); }
void on_backcolorPick_clicked();
void on_checkerBack_clicked();
private:
void RT_FetchCurrentPixel(uint32_t x, uint32_t y, PixelValue &pickValue, PixelValue &realValue);
void RT_PickPixelsAndUpdate();