Fix bug when using rotation with strips by adding a new member to Ember named m_RotCenterY which is a copy of the original center value since the center value gets changed when using strips.

Change PaletteList Count() member to Size() to be consistent with other code.

Remove PaletteImage option, it's unused. Improve documentation for some other options.

Make ComposePath() always return a unique string.

Add Random Palette and Random Adjustment buttons.

Another attempt at solving the locale bug with the affine adjustment combo boxes.
This commit is contained in:
mfeemster
2014-10-27 14:21:06 -07:00
parent 2a98e8c05b
commit 6b2b6ede7f
19 changed files with 440 additions and 375 deletions

View File

@ -155,7 +155,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
m_GuiState = m_FinalRenderDialog->State();//Cache render settings from the GUI before running.
bool doAll = m_GuiState.m_DoAll && m_EmberFile.Size() > 1;
unsigned int currentStripForProgress = 0;//Sort of a hack to get the strip value to the progress function.
QString path = EmberFile<T>::UniqueFilename(doAll ? ComposePath(QString::fromStdString(m_EmberFile.m_Embers[0].m_Name)) : ComposePath(Name()));
QString path = doAll ? ComposePath(QString::fromStdString(m_EmberFile.m_Embers[0].m_Name)) : ComposePath(Name());
QString backup = path + "_backup.flame";
//Save backup Xml.
@ -219,7 +219,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
//Render each image, cancelling if m_Run ever gets set to false.
for (i = 0; i < m_EmberFile.Size() && m_Run; i++)
{
Output("Image " + ToString(m_FinishedImageCount) + ":\n" + EmberFile<T>::UniqueFilename(ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name))));
Output("Image " + ToString(m_FinishedImageCount) + ":\n" + ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name)));
m_Renderer->Reset();//Have to manually set this since the ember is not set each time through.
m_RenderTimer.Tic();//Toc() is called in RenderComplete().
@ -244,7 +244,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
//Render each image, cancelling if m_Run ever gets set to false.
for (i = 0; i < m_EmberFile.Size() && m_Run; i++)
{
Output("Image " + ToString(m_FinishedImageCount) + ":\n" + EmberFile<T>::UniqueFilename(ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name))));
Output("Image " + ToString(m_FinishedImageCount) + ":\n" + ComposePath(QString::fromStdString(m_EmberFile.m_Embers[i].m_Name)));
m_Renderer->SetEmber(m_EmberFile.m_Embers[i]);
m_Renderer->PrepFinalAccumVector(m_FinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run().
m_Stats.Clear();
@ -272,7 +272,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
m_Renderer->PrepFinalAccumVector(m_FinalImage);//Must manually call this first because it could be erroneously made smaller due to strips if called inside Renderer::Run().
m_Stats.Clear();
Memset(m_FinalImage);
Output(EmberFile<T>::UniqueFilename(ComposePath(QString::fromStdString(m_Ember->m_Name))));
Output(ComposePath(QString::fromStdString(m_Ember->m_Name)));
m_RenderTimer.Tic();//Toc() is called in RenderComplete().
StripsRender<T>(m_Renderer.get(), *m_Ember, m_FinalImage, 0, m_GuiState.m_Strips, m_GuiState.m_YAxisUp,
@ -496,7 +496,7 @@ void FinalRenderEmberController<T>::SyncCurrentToGui()
m_FinalRenderDialog->Scale(m_Ember->ScaleType());
m_FinalRenderDialog->m_QualitySpin->SetValueStealth(m_Ember->m_Quality);
m_FinalRenderDialog->m_SupersampleSpin->SetValueStealth(m_Ember->m_Supersample);
m_FinalRenderDialog->Path(EmberFile<T>::UniqueFilename(ComposePath(Name())));
m_FinalRenderDialog->Path(ComposePath(Name()));
}
/// <summary>
@ -606,7 +606,7 @@ QString FinalRenderEmberController<T>::ComposePath(const QString& name)
QString path = MakeEnd(m_Settings->SaveFolder(), '/');//Base path.
QString full = path + m_FinalRenderDialog->Prefix() + name + m_FinalRenderDialog->Suffix() + "." + m_FinalRenderDialog->Ext();
return full;
return EmberFile<T>::UniqueFilename(full);
}
/// <summary>
@ -635,7 +635,7 @@ template<typename T>
void FinalRenderEmberController<T>::RenderComplete(Ember<T>& ember)
{
string renderTimeString = m_RenderTimer.Format(m_RenderTimer.Toc()), totalTimeString;
QString status, filename = EmberFile<T>::UniqueFilename(ComposePath(QString::fromStdString(ember.m_Name)));
QString status, filename = ComposePath(QString::fromStdString(ember.m_Name));
QString itersString = ToString(m_Stats.m_Iters);
QString itersPerSecString = ToString(size_t(m_Stats.m_Iters / (m_Stats.m_IterMs / 1000.0)));

View File

@ -221,6 +221,8 @@ public slots:
void OnPaletteAdjust(int d);
void OnPaletteCellClicked(int row, int col);
void OnPaletteCellDoubleClicked(int row, int col);
void OnPaletteRandomSelectButtonClicked(bool checked);
void OnPaletteRandomAdjustButtonClicked(bool checked);
//Library.
void OnEmberTreeItemChanged(QTreeWidgetItem* item, int col);

View File

@ -2314,6 +2314,9 @@ SpinBox
<string>Color</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="leftMargin">
<number>6</number>
</property>
@ -2326,192 +2329,6 @@ SpinBox
<property name="bottomMargin">
<number>6</number>
</property>
<item row="3" column="0" colspan="2">
<widget class="TableWidget" name="XformColorValuesTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>68</height>
</size>
</property>
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="gridStyle">
<enum>Qt::SolidLine</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>110</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>27</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>22</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>22</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>Color Speed</string>
</property>
</row>
<row>
<property name="text">
<string>Opacity</string>
</property>
</row>
<row>
<property name="text">
<string>Direct Color</string>
</property>
</row>
<column>
<property name="text">
<string>Field</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Color Speed</string>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>0</string>
</property>
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Opacity</string>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string>0</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Direct Color</string>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>0</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="TableWidget" name="XformColorIndexTable">
<property name="sizePolicy">
@ -2731,6 +2548,58 @@ SpinBox
</item>
<item row="2" column="0" colspan="2">
<widget class="QScrollBar" name="XformColorScroll">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>162</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>18</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
<number>128</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="TableWidget" name="XformColorValuesTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
@ -2740,30 +2609,179 @@ SpinBox
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
<height>68</height>
</size>
</property>
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<enum>Qt::NoFocus</enum>
</property>
<property name="maximum">
<number>255</number>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="value">
<number>128</number>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="invertedAppearance">
<property name="lineWidth">
<number>1</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="gridStyle">
<enum>Qt::SolidLine</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>110</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>27</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>22</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>22</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>Color Speed</string>
</property>
</row>
<row>
<property name="text">
<string>Opacity</string>
</property>
</row>
<row>
<property name="text">
<string>Direct Color</string>
</property>
</row>
<column>
<property name="text">
<string>Field</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Color Speed</string>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>0</string>
</property>
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Opacity</string>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string>0</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Direct Color</string>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>0</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
@ -3214,36 +3232,6 @@ SpinBox
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>0.5</string>
</property>
</item>
<item>
<property name="text">
<string>0.25</string>
</property>
</item>
<item>
<property name="text">
<string>0.1</string>
</property>
</item>
<item>
<property name="text">
<string>0.05</string>
</property>
</item>
<item>
<property name="text">
<string>0.025</string>
</property>
</item>
<item>
<property name="text">
<string>0.01</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3">
@ -3818,36 +3806,6 @@ SpinBox
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>0.5</string>
</property>
</item>
<item>
<property name="text">
<string>0.25</string>
</property>
</item>
<item>
<property name="text">
<string>0.1</string>
</property>
</item>
<item>
<property name="text">
<string>0.05</string>
</property>
</item>
<item>
<property name="text">
<string>0.025</string>
</property>
</item>
<item>
<property name="text">
<string>0.01</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3">
@ -4029,7 +3987,7 @@ SpinBox
<item>
<widget class="QGroupBox" name="PostAffineShowGroupBox">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="title">
<string>Show</string>
@ -4050,7 +4008,7 @@ SpinBox
<item>
<widget class="QRadioButton" name="ShowPostAffineCurrentRadio">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="text">
<string>Current</string>
@ -4619,7 +4577,7 @@ SpinBox
<attribute name="title">
<string>Palette</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_16" rowstretch="0,0,0" columnstretch="0">
<layout class="QGridLayout" name="gridLayout_16" rowstretch="0,0,0,0" columnstretch="0">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
@ -4638,6 +4596,88 @@ SpinBox
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<widget class="TableWidget" name="PalettePreviewTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>19</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>19</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<property name="rowCount">
<number>1</number>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>19</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>19</number>
</attribute>
<row/>
<column/>
<column/>
</widget>
</item>
<item row="0" column="0">
<widget class="TableWidget" name="PaletteAdjustTable">
<property name="sizePolicy">
@ -4771,7 +4811,7 @@ SpinBox
</item>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QTableWidget" name="PaletteListTable">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
@ -4846,86 +4886,37 @@ SpinBox
</widget>
</item>
<item row="1" column="0">
<widget class="TableWidget" name="PalettePreviewTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>4</number>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>19</height>
</size>
<property name="leftMargin">
<number>0</number>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>19</height>
</size>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<property name="rowCount">
<number>1</number>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>19</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>19</number>
</attribute>
<row/>
<column/>
<column/>
</widget>
<item>
<widget class="QPushButton" name="PaletteRandomSelect">
<property name="toolTip">
<string>Select a random palette from the list</string>
</property>
<property name="text">
<string>Random Palette</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PaletteRandomAdjust">
<property name="text">
<string>Random Adjustment</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

View File

@ -27,6 +27,9 @@ void Fractorium::InitPaletteUI()
SetupSpinner<SpinBox, int>(table, this, row, 3, m_PaletteContrastSpin, spinHeight, -100, 100, 1, SIGNAL(valueChanged(int)), SLOT(OnPaletteAdjust(int)), true, 0, 0, 0);
SetupSpinner<SpinBox, int>(table, this, row, 3, m_PaletteBlurSpin, spinHeight, 0, 127, 1, SIGNAL(valueChanged(int)), SLOT(OnPaletteAdjust(int)), true, 0, 0, 0);
SetupSpinner<SpinBox, int>(table, this, row, 3, m_PaletteFrequencySpin, spinHeight, 1, 10, 1, SIGNAL(valueChanged(int)), SLOT(OnPaletteAdjust(int)), true, 1, 1, 1);
connect(ui.PaletteRandomSelect, SIGNAL(clicked(bool)), this, SLOT(OnPaletteRandomSelectButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PaletteRandomAdjust, SIGNAL(clicked(bool)), this, SLOT(OnPaletteRandomAdjustButtonClicked(bool)), Qt::QueuedConnection);
}
/// <summary>
@ -55,7 +58,7 @@ bool FractoriumEmberController<T>::InitPaletteTable(const string& s)
palettePreviewTable->setItem(0, 1, previewPaletteItem);
//Palette list table.
paletteTable->setRowCount(m_PaletteList.Count());
paletteTable->setRowCount(m_PaletteList.Size());
paletteTable->setColumnWidth(1, 260);//256 plus small margin on each side.
paletteTable->horizontalHeader()->setSectionsClickable(false);
@ -70,7 +73,7 @@ bool FractoriumEmberController<T>::InitPaletteTable(const string& s)
paletteTable->setHorizontalHeaderItem(1, paletteHeader);
//Palette list table.
for (size_t i = 0; i < m_PaletteList.Count(); i++)
for (size_t i = 0; i < m_PaletteList.Size(); i++)
{
Palette<T>* p = m_PaletteList.GetPalette(i);
vector<unsigned char> v = p->MakeRgbPaletteBlock(PALETTE_CELL_HEIGHT);
@ -220,6 +223,52 @@ void Fractorium::OnPaletteCellDoubleClicked(int row, int col)
OnPaletteCellClicked(row, col);
}
/// <summary>
/// Set the selected palette to a randomly selected one,
/// applying any adjustments previously specified.
/// Called when the Random Palette button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="row">The current row selected</param>
void Fractorium::OnPaletteRandomSelectButtonClicked(bool checked)
{
unsigned int i = 0;
int rowCount = ui.PaletteListTable->rowCount() - 1;
while ((i = QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Rand(rowCount)) == m_PreviousPaletteRow);
OnPaletteCellClicked(i, 1);
}
/// <summary>
/// Apply random adjustments to the selected palette.
/// Called when the Random Adjustment button is clicked.
/// Resets the rendering process.
/// </summary>
void Fractorium::OnPaletteRandomAdjustButtonClicked(bool checked)
{
QTIsaac<ISAAC_SIZE, ISAAC_INT>* gRand = QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand.get();
m_PaletteHueSpin->setValue(-180 + gRand->Rand(361));
m_PaletteSaturationSpin->setValue(-50 + gRand->Rand(101));//Full range of these leads to bad palettes, so clamp range.
m_PaletteBrightnessSpin->setValue(-50 + gRand->Rand(101));
m_PaletteContrastSpin->setValue(-50 + gRand->Rand(101));
//Doing frequency and blur together gives bad palettes that are just a solid color.
if (gRand->RandBit())
{
m_PaletteBlurSpin->setValue(gRand->Rand(21));
m_PaletteFrequencySpin->setValue(1);
}
else
{
m_PaletteBlurSpin->setValue(0);
m_PaletteFrequencySpin->setValue(1 + gRand->Rand(10));
}
OnPaletteAdjust(0);
}
/// <summary>
/// Reset the palette controls.
/// Usually in response to a palette cell double click.

View File

@ -242,7 +242,7 @@ void Fractorium::OnCenterXChanged(double d) { m_Controller->CenterXChanged(d); }
/// Resets the rendering process.
/// </summary>
/// <param name="d">The y offset value</param>
template <typename T> void FractoriumEmberController<T>::CenterYChanged(double d) { Update([&] { m_Ember.m_CenterY = d; }); }
template <typename T> void FractoriumEmberController<T>::CenterYChanged(double d) { Update([&] { m_Ember.m_CenterY = m_Ember.m_RotCenterY = d; }); }
void Fractorium::OnCenterYChanged(double d) { m_Controller->CenterYChanged(d); }
/// <summary>
@ -493,7 +493,7 @@ template <typename T>
void FractoriumEmberController<T>::SetCenter(double x, double y)
{
m_Ember.m_CenterX = x;
m_Ember.m_CenterY = y;
m_Ember.m_CenterY = m_Ember.m_RotCenterY = y;
m_Fractorium->m_CenterXSpin->SetValueStealth(x);//Don't trigger a redraw twice.
m_Fractorium->m_CenterYSpin->SetValueStealth(y);
@ -581,7 +581,7 @@ void FractoriumEmberController<T>::ParamsToEmber(Ember<T>& ember)
ember.m_FinalRasW = m_Fractorium->m_WidthSpin->value();//Geometry.
ember.m_FinalRasH = m_Fractorium->m_HeightSpin->value();
ember.m_CenterX = m_Fractorium->m_CenterXSpin->value();
ember.m_CenterY = m_Fractorium->m_CenterYSpin->value();
ember.m_CenterY = ember.m_RotCenterY = m_Fractorium->m_CenterYSpin->value();
ember.m_PixelsPerUnit = m_Fractorium->m_ScaleSpin->value();
ember.m_Zoom = m_Fractorium->m_ZoomSpin->value();
ember.m_Rotate = m_Fractorium->m_RotateSpin->value();

View File

@ -49,6 +49,18 @@ void Fractorium::InitXformsAffineUI()
ui.PostMoveCombo->setValidator(postMoveVal);
ui.PostScaleCombo->setValidator(postScaleVal);
QStringList moveList;
moveList.append(ToString(0.5));
moveList.append(ToString(0.25));
moveList.append(ToString(0.1));
moveList.append(ToString(0.05));
moveList.append(ToString(0.025));
moveList.append(ToString(0.01));
ui.PreMoveCombo->addItems(moveList);
ui.PostMoveCombo->addItems(moveList);
connect(ui.PreFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PreFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PreRotate90CButton, SIGNAL(clicked(bool)), this, SLOT(OnRotate90CButtonClicked(bool)), Qt::QueuedConnection);

View File

@ -15,12 +15,12 @@ void Fractorium::InitXformsColorUI()
ui.XformPaletteRefTable->setItem(0, 0, m_PaletteRefItem);
ui.XformPaletteRefTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
connect(ui.XformPaletteRefTable->horizontalHeader(), SIGNAL(sectionResized(int, int, int)), this, SLOT(OnXformRefPaletteResized(int, int, int)), Qt::QueuedConnection);
SetupSpinner<DoubleSpinBox, double>(ui.XformColorIndexTable, this, row, 1, m_XformColorIndexSpin, spinHeight, 0, 1, 0.01, SIGNAL(valueChanged(double)), SLOT(OnXformColorIndexChanged(double)), false, 0, 1, 0);
SetupSpinner<DoubleSpinBox, double>(ui.XformColorValuesTable, this, row, 1, m_XformColorSpeedSpin, spinHeight, -1, 1, 0.1, SIGNAL(valueChanged(double)), SLOT(OnXformColorSpeedChanged(double)), true, 0.5, 0.5, 0.5);
SetupSpinner<DoubleSpinBox, double>(ui.XformColorValuesTable, this, row, 1, m_XformOpacitySpin, spinHeight, 0, 1, 0.1, SIGNAL(valueChanged(double)), SLOT(OnXformOpacityChanged(double)), true, 1, 1, 0);
SetupSpinner<DoubleSpinBox, double>(ui.XformColorValuesTable, this, row, 1, m_XformDirectColorSpin, spinHeight, 0, 1, 0.1, SIGNAL(valueChanged(double)), SLOT(OnXformDirectColorChanged(double)), true, 1, 1, 0);
m_XformColorIndexSpin->setDecimals(3);
m_XformColorSpeedSpin->setDecimals(3);
m_XformOpacitySpin->setDecimals(3);

View File

@ -189,6 +189,7 @@ void Fractorium::OnClearXaosButtonClicked(bool checked) { m_Controller->ClearXao
/// Set all xaos values to random numbers.
/// There is a 50% chance they're set to 0 or 1, and
/// 50% that they're 0-3.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template <typename T>

View File

@ -633,7 +633,7 @@ void GLEmberController<T>::MouseMove(QMouseEvent* e)
v2T v2 = rotMat.TransformVector(v1);
ember->m_CenterX = v2.x;
ember->m_CenterY = v2.y;
ember->m_CenterY = ember->m_RotCenterY = v2.y;
m_FractoriumEmberController->SetCenter(ember->m_CenterX, ember->m_CenterY);//Will restart the rendering process.
}
else if (m_DragState == DragRotateScale)//Rotating and scaling the whole image.