mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-10-29 16:30:45 -04:00
--User changes
-Give tabs a height of 4px in the qss files. Looks a little large on 4k screens, but just right on HD screens which are much more common. -Allow for styling of zero and non-zero variation tree nodes via qss. -Allow for toggling whether to interpolate between colors in the palette editor, or to do hard cuts between colors. -Allow for adjusting spinner values with the + = or up arrow keys to increase, and - _ or down arrow keys to decrease. -Allow for responding to global presses of + = and - _ to cycle up or down to specify which xform is set as the current one. -Allow for adding "layers" via xaos which will add a user-specified number of xforms, and set certain xaos values to 0 or 1. -Add a new menu item under the Edit menu to copy the OpenCL iteration kernel source to the clipboard. -Show text on the status bar which indicates that an OpenCL kernel compilation is taking place. -Show xform name on xform combo box when expanded. Adjust size to fit all names. -Draw post affine circles using dashed lines. -Prevent QSS dialog from styling its editor, which makes it easier to see text when creating styles which have custom colors for text boxes. --Bug fixes -Fix up some table layouts which seemed to have regressed/decayed over time for reasons unknown. -Using undo/redo would create a new flame in the library every time. -Solo was not being preserved when using undo/redo. --Code changes -Make the solo flag be a part of the flame data now. -Fix some tabification in the OpenCL code for EllipticVariation. -Fix tabification in the varState code for OpenCL. -Add an event called m_CompileBegun to RendererCL that is called right before an OpenCL compile is begun. --This required making RendererCLBase not a pure virtual base class. Member functions just return defaults. -Filter key presses on main window to only process the third one. This is due to Qt triggering three events for every key press. -The palette preview table was installing an event filter for seemingly no reason. Remove it. -Mark certain virtual functions as override in SpinBox and DoubleSpinBox.
This commit is contained in:
@ -36,6 +36,24 @@ GradientColorsView::GradientColorsView(QWidget* p)
|
||||
ResetToDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get whether to interpolate color keys.
|
||||
/// </summary>
|
||||
/// <returns>True to interpolate (blend), false to do hard cuts.</returns>
|
||||
bool GradientColorsView::Blend()
|
||||
{
|
||||
return m_Blend;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set whether to interpolate color keys.
|
||||
/// </summary>
|
||||
/// <param name="blend">rue to interpolate (blend), false to do hard cuts.</param>
|
||||
void GradientColorsView::Blend(bool blend)
|
||||
{
|
||||
m_Blend = blend;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the focus to the arrow at the given normalized position.
|
||||
/// </summary>
|
||||
@ -374,23 +392,37 @@ Palette<float>& GradientColorsView::GetPalette(int size)
|
||||
{
|
||||
if (!m_Arrows.empty())
|
||||
{
|
||||
QPainter p;
|
||||
QSize imageSize(size, 1);
|
||||
QImage image(imageSize, QImage::Format_ARGB32_Premultiplied);
|
||||
QLinearGradient grad(QPoint(0, 0), QPoint(imageSize.width(), imageSize.height()));
|
||||
m_Palette.m_SourceColors.clear();
|
||||
QPainter painter(&image);
|
||||
float start = 0;
|
||||
|
||||
for (auto& it : m_Arrows)
|
||||
if (Blend())
|
||||
{
|
||||
auto pos = it.first;
|
||||
auto col = it.second.Color();
|
||||
m_Palette.m_SourceColors[pos] = v4F(col.red() / 255.0f, col.green() / 255.0f, col.blue() / 255.0f, 1.0f);
|
||||
grad.setColorAt(pos, col);
|
||||
QLinearGradient grad(QPoint(0, 0), QPoint(imageSize.width(), imageSize.height()));
|
||||
|
||||
for (auto& it : m_Arrows)
|
||||
{
|
||||
auto col = it.second.Color();
|
||||
m_Palette.m_SourceColors[it.first] = v4F(col.red() / 255.0f, col.green() / 255.0f, col.blue() / 255.0f, 1.0f);
|
||||
grad.setColorAt(it.first, col);
|
||||
}
|
||||
|
||||
painter.fillRect(image.rect(), grad);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto& it : m_Arrows)
|
||||
{
|
||||
auto col = it.second.Color();
|
||||
m_Palette.m_SourceColors[it.first] = v4F(col.red() / 255.0f, col.green() / 255.0f, col.blue() / 255.0f, 1.0f);
|
||||
painter.setBrush(col);
|
||||
painter.fillRect(start, 0, imageSize.width(), imageSize.height(), col);
|
||||
start = std::ceil(it.first * imageSize.width());
|
||||
}
|
||||
}
|
||||
|
||||
p.begin(&image);
|
||||
p.fillRect(image.rect(), grad);
|
||||
p.end();
|
||||
m_Palette.m_Entries.reserve(image.width());
|
||||
|
||||
for (int i = 0; i < image.width(); i++)
|
||||
@ -493,13 +525,25 @@ void GradientColorsView::paintEvent(QPaintEvent*)
|
||||
QPoint gradStart = QPoint(m_ViewRect.topLeft().x(), m_ViewRect.bottomLeft().y() / 2);
|
||||
QPoint gradStop = QPoint(m_ViewRect.topRight().x(), m_ViewRect.bottomRight().y() / 2);
|
||||
QLinearGradient grad(gradStart, gradStop);
|
||||
float start = m_ViewRect.x();
|
||||
|
||||
for (auto& it : m_Arrows)
|
||||
{
|
||||
GradientArrow& arrow = it.second;
|
||||
grad.setColorAt(it.first, arrow.Color());
|
||||
auto offset = std::ceil(it.first * RectWidth());
|
||||
|
||||
if (Blend())
|
||||
{
|
||||
grad.setColorAt(it.first, arrow.Color());
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.fillRect(start, m_ViewRect.y(), m_ViewRect.right() - start, m_ViewRect.height(), arrow.Color());
|
||||
start = m_ViewRect.x() + offset;
|
||||
}
|
||||
|
||||
QPolygon arrowPolygon = arrow.Area();
|
||||
int iPosX = it.first * RectWidth(),
|
||||
int iPosX = offset,
|
||||
iPosY = m_ViewRect.height() + m_ViewRect.top() + 3;
|
||||
arrowPolygon.translate(iPosX, iPosY);
|
||||
QPainterPath paintPath;
|
||||
@ -513,8 +557,11 @@ void GradientColorsView::paintEvent(QPaintEvent*)
|
||||
painter.setBrush(QBrush(Qt::NoBrush));
|
||||
}
|
||||
|
||||
QBrush brush(grad);
|
||||
painter.fillRect(m_ViewRect, brush);
|
||||
if (Blend())
|
||||
{
|
||||
painter.fillRect(m_ViewRect, grad);
|
||||
}
|
||||
|
||||
painter.drawRect(m_ViewRect);
|
||||
}
|
||||
else
|
||||
@ -534,8 +581,6 @@ void GradientColorsView::paintEvent(QPaintEvent*)
|
||||
//Draw text inside of the arrow.
|
||||
painter.drawText(topArrowRect.x() + (topArrowRect.width() - (topArrow.Width() - 5)) / 2.0, topArrowRect.y() + (topArrowRect.height() - 5), topArrow.Text());
|
||||
}
|
||||
|
||||
painter.end();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user