mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 05:30:06 -05:00
8a4127d5d7
-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.
79 lines
2.5 KiB
C++
79 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "FractoriumPch.h"
|
|
#include "ColorPickerWidget.h"
|
|
#include "GradientColorsView.h"
|
|
#include "EmberFile.h"
|
|
#include "ui_PaletteEditor.h"
|
|
|
|
namespace Ui
|
|
{
|
|
class PaletteEditor;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dialog for editing user created palettes.
|
|
/// This will load with all available user created palettes populated in the combo
|
|
/// box. As the user changes the selected index, the palettes for that file
|
|
/// are shown in the list box. The user can click on those and then edit them and either
|
|
/// save it back to the same position in the file, or append it to the end.
|
|
/// They can also click in the name column to set/rename the palette name.
|
|
/// Any changes on this dialog can be "synced". That is, when the Sync checkbox is checked
|
|
/// any changes result in a signal being sent back to the main window.
|
|
/// </summary>
|
|
class PaletteEditor : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PaletteEditor(PaletteList<float>& paletteList, QWidget* p = nullptr);
|
|
|
|
public:
|
|
bool Sync();
|
|
QPixmap* GetBackGround();
|
|
Palette<float>& GetPalette(int size);
|
|
void SetPalette(Palette<float>& palette);
|
|
|
|
signals:
|
|
void PaletteChanged();
|
|
void PaletteFileChanged();
|
|
|
|
private slots:
|
|
void OnAddColorButtonClicked();
|
|
void OnRemoveColorButtonClicked();
|
|
void OnInvertColorsButtonClicked();
|
|
void OnRandomColorsButtonClicked();
|
|
void OnDistributeColorsButtonClicked();
|
|
void OnResetToDefaultButtonClicked();
|
|
void OnCreatePaletteFromImageButtonClicked();
|
|
void OnCreatePaletteAgainFromImageButton();
|
|
void OnColorPickerColorChanged(const QColor& col);
|
|
void OnArrowDoubleClicked(const GradientArrow& arrow);
|
|
void OnSyncCheckBoxStateChanged(int state);
|
|
void OnArrowMoved(qreal lastPos, const GradientArrow& arrow);
|
|
void OnPaletteFilenameComboChanged(const QString& text);
|
|
void OnPaletteCellClicked(int row, int col);
|
|
void OnPaletteCellChanged(int row, int col);
|
|
void OnNewPaletteFileButtonClicked();
|
|
void OnCopyPaletteFileButtonClicked();
|
|
void OnAppendPaletteButtonClicked();
|
|
void OnOverwritePaletteButtonClicked();
|
|
void OnDeletePaletteButtonClicked();
|
|
|
|
private:
|
|
void EmitPaletteChanged();
|
|
QStringList SetupOpenImagesDialog();
|
|
void AddArrow(const QColor& color);
|
|
map<float, GradientArrow> GetRandomColorsFromImage(QString filename, int numPoints);
|
|
|
|
bool m_PaletteFileChanged = false;
|
|
int m_PaletteIndex = 0;
|
|
QString m_Filename;
|
|
string m_CurrentPaletteFilePath;
|
|
ColorPickerWidget* m_ColorPicker = nullptr;
|
|
GradientColorsView* m_GradientColorView = nullptr;
|
|
QFileDialog* m_FileDialog = nullptr;
|
|
PaletteList<float>& m_PaletteList;
|
|
std::unique_ptr<Ui::PaletteEditor> ui;
|
|
};
|