src/colors.h

changeset 94
164f53fb5921
parent 89
7abaf1d64719
child 132
488d0ba6070b
equal deleted inserted replaced
93:6fe24fd945c0 94:164f53fb5921
22 22
23 namespace ldraw 23 namespace ldraw
24 { 24 {
25 struct Color; 25 struct Color;
26 class ColorTable; 26 class ColorTable;
27 Color directColor(const QColor& color);
28 bool isDirectColor(Color color);
29 QColor directColorFace(Color color);
30 QColor colorFace(Color color, const ColorTable& colorTable);
27 } 31 }
28 32
29 struct ldraw::Color 33 struct ldraw::Color
30 { 34 {
31 qint32 index = 0; 35 qint32 index = 0;
39 struct ColorDefinition 43 struct ColorDefinition
40 { 44 {
41 QColor faceColor; 45 QColor faceColor;
42 QColor edgeColor; 46 QColor edgeColor;
43 QString name; 47 QString name;
48 QString displayName;
44 }; 49 };
45 void clear(); 50 void clear();
46 Result load(QIODevice& device, QTextStream& errors); 51 Result load(QIODevice& device, QTextStream& errors);
47 const ColorDefinition& operator[](Color index) const; 52 const ColorDefinition& operator[](Color index) const;
48 static const ColorDefinition unknownColor; 53 static const ColorDefinition unknownColor;
54 auto begin() const { return this->definitions.begin(); }
55 auto end() const { return this->definitions.end(); }
56 int size() const { return this->definitions.size(); }
49 private: 57 private:
50 void loadColorFromString(const QString& string); 58 void loadColorFromString(const QString& string);
51 QMap<qint32, ColorDefinition> definitions; 59 std::map<qint32, ColorDefinition> definitions;
52 }; 60 };
53 61
54 namespace ldraw 62 namespace ldraw
55 { 63 {
56 inline bool operator==(const ldraw::Color& one, const ldraw::Color& other) 64 inline bool operator==(const ldraw::Color& one, const ldraw::Color& other)

mercurial