fractorium/Source/Fractorium/PaletteEditor/GradientArrow.h

79 lines
2.4 KiB
C
Raw Normal View History

--User changes -Add a palette editor. -Add support for reading .ugr/.gradient/.gradients palette files. -Allow toggling on spinners whose minimum value is not zero. -Allow toggling display of image, affines and grid. -Add new variations: cylinder2, circlesplit, tile_log, truchet_fill, waves2_radial. --Bug fixes -cpow2 was wrong. -Palettes with rapid changes in color would produce slightly different outputs from Apo/Chaotica. This was due to a long standing bug from flam3. -Use exec() on Apple and show() on all other OSes for dialog boxes. -Trying to render a sequence with no frames would crash. -Selecting multiple xforms and rotating them would produce the wrong rotation. -Better handling when parsing flames using different encoding, such as unicode and UTF-8. -Switching between SP/DP didn't reselect the selected flame in the Library tab. --Code changes -Make all types concerning palettes be floats, including PaletteTableWidgetItem. -PaletteTableWidgetItem is no longer templated because all palettes are float. -Include the source colors for user created gradients. -Change parallel_for() calls to work with very old versions of TBB which are lingering on some systems. -Split conditional out of accumulation loop on the CPU for better performance. -Vectorize summing when doing density filter for better performance. -Make all usage of palettes be of type float, double is pointless. -Allow palettes to reside in multiple folders, while ensuring only one of each name is added. -Refactor some palette path searching code. -Make ReadFile() throw and catch an exception if the file operation fails. -A little extra safety in foci and foci3D with a call to Zeps(). -Cast to (real_t) in the OpenCL string for the w variation, which was having trouble compiling on Mac. -Fixing missing comma between paths in InitPaletteList(). -Move Xml and PaletteList classes into cpp to shorten build times when working on them. -Remove default param values for IterOpenCLKernelCreator<T>::SharedDataIndexDefines in cpp file. -Change more NULL to nullptr.
2017-02-26 03:02:21 -05:00
/****************************************************************************/
// This file is part of the gradLib library originally made by Stian Broen
//
// For more free libraries, please visit <http://broentech.no>
//
// gradLib is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this library. If not, see <http://www.gnu.org/licenses/>
/****************************************************************************/
#pragma once
#include "FractoriumPch.h"
/// <summary>
/// Class for drawing the small arrows below the gradient in the palette editor.
/// The drawing is accomplished via a QPolygon object.
/// </summary>
class GradientArrow
{
public:
/// <summary>
/// Default constructor which sets up the size of the arrow.
/// </summary>
explicit GradientArrow()
{
QPolygon area;
area << QPoint(5, 5) << QPoint(10, 0) << QPoint(15, 5) << QPoint(15, 15) << QPoint(5, 15) << QPoint(5, 5);
Area(area);
}
/// <summary>
/// Constructor which takes the color and focus state of the arrow.
/// </summary>
/// <param name="col">The color of the arrow</param>
/// <param name="focus">Whether the arrow is focused</param>
explicit GradientArrow(QColor col, bool focus)
: GradientArrow()
{
m_Color = col;
m_Focus = focus;
}
/// <summary>
/// Copy constructor to copy another GradientArrow.
/// </summary>
/// <param name="other">The GradientArrow object to copy</param>
GradientArrow(const GradientArrow& other)
: m_Focus(other.Focus()),
m_Area(other.Area()),
m_Color(other.Color())
{
}
/// <summary>
/// Getters and setters.
/// </summary>
inline bool Focus() const { return m_Focus; }
inline void Focus(bool val) { m_Focus = val; }
inline const QPolygon Area() const { return m_Area; }
inline void Area(const QPolygon& val) {m_Area = val; }
inline const QColor Color() const { return m_Color; }
inline void Color(const QColor& val) { m_Color = val; }
private:
bool m_Focus;
QPolygon m_Area;
QColor m_Color;
};