summaryrefslogtreecommitdiff
path: root/WFPalette.hpp
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@debian.org>2015-10-18 18:51:00 +0100
committerIain R. Learmonth <irl@debian.org>2015-10-18 18:51:00 +0100
commitd63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch)
treeb9c1f6245147a310aac3762630bad389bbb57335 /WFPalette.hpp
parentc720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff)
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'WFPalette.hpp')
-rw-r--r--WFPalette.hpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/WFPalette.hpp b/WFPalette.hpp
new file mode 100644
index 00000000..271ca535
--- /dev/null
+++ b/WFPalette.hpp
@@ -0,0 +1,55 @@
+#ifndef W_F_PALETTE_HPP__
+#define W_F_PALETTE_HPP__
+
+#include <QList>
+#include <QVector>
+#include <QColor>
+
+class QString;
+
+//
+// Class WFPalette
+//
+// Encapulates a waterfall palette description. A colour gradient
+// over 256 intervals is described by a list of RGB colour triplets.
+// The list of colours are use to interpolate the full 256 interval
+// waterfall colour gradient.
+//
+// Responsibilities
+//
+// Construction from a string which is a path to a file containing
+// colour descriptions in the form rrr;ggg;bbb on up to 256
+// consecutive lines, where rrr, ggg and, bbb are integral numbers in
+// the range 0<=n<256.
+//
+// Construction from a list of QColor instances. Up to the first 256
+// list elements are used.
+//
+// Includes a design GUI to create or adjust a WFPalette.
+//
+class WFPalette
+{
+public:
+ using Colours = QList<QColor>;
+
+ WFPalette () = default;
+ explicit WFPalette (Colours const&);
+ explicit WFPalette (QString const& file_path);
+ WFPalette (WFPalette const&) = default;
+ WFPalette& operator = (WFPalette const&) = default;
+
+ Colours colours () const {return colours_;}
+
+ // interpolate a gradient over 256 steps
+ QVector<QColor> interpolate () const;
+
+ // returns true if colours have been modified
+ bool design ();
+
+private:
+ Colours colours_;
+};
+
+Q_DECLARE_METATYPE (WFPalette::Colours);
+
+#endif