Scribus
Open source desktop publishing at your fingertips
sccolor.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  sccolor.h - description
9  -------------------
10  begin : Sun Sep 9 2001
11  copyright : (C) 2001 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 /***************************************************************************
16  * *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or *
20  * (at your option) any later version. *
21  * *
22  ***************************************************************************/
23 
24 #ifndef SCCOLOR_H
25 #define SCCOLOR_H
26 
27 #include <QColor>
28 #include <QMap>
29 #include <QPointer>
30 #include <QString>
31 
32 #include "scribusapi.h"
33 
34 class ScribusDoc;
35 
36 
44 enum colorModel
45 {
46  colorModelRGB,
47  colorModelCMYK,
48  colorModelLab
49 };
50 
51 class SCRIBUS_API ScColor
52 {
53 public:
54 
55  friend class ScColorEngine;
56 
58  ScColor(void);
60  ScColor(int c, int m, int y, int k);
62  ScColor(int r, int g, int b);
64  ScColor(double l, double a, double b);
65 
66  bool operator==(const ScColor& other) const;
67 
69  void setColor(ScribusDoc* doc, const QString& name);
70 
72  void setColor(int c, int m, int y, int k);
73 
75  void setColor(double l, double a, double b);
76 
80  void setColorRGB(int r, int g, int b);
81 
83  colorModel getColorModel () const;
84 
86  void fromQColor(QColor color);
87 
90  void getRawRGBColor(int *r, int *g, int *b) const;
91  QColor getRawRGBColor() const;
92 
96  void getCMYK(int *c, int *m, int *y, int *k) const;
97 
101  void getRGB(int *r, int *g, int *b) const;
102 
106  void getLab(double *L, double *a, double *b) const;
107 
110  QString name();
113  QString nameRGB(const ScribusDoc* doc = NULL);
116  QString nameCMYK(const ScribusDoc* doc = NULL);
117 
119  void setNamedColor(QString nam);
120 
122  bool isSpotColor() const;
124  void setSpotColor(bool s);
126  bool isRegistrationColor() const;
128  void setRegistrationColor(bool s);
129 
130 private:
131 
133  int CR;
135  int MG;
137  int YB;
139  int K;
141  double L_val;
143  double a_val;
145  double b_val;
146 
148  bool Spot;
150  bool Regist;
152  colorModel Model;
153 };
154 
155 class SCRIBUS_API ColorList : public QMap<QString,ScColor>
156 {
157 protected:
158  QPointer<ScribusDoc> m_doc;
159  bool m_retainDoc;
160 
162  void ensureBlack(void);
163 
165  void ensureWhite(void);
166 
168  void ensureRegistration(void);
169 
170 public:
171  ColorList(ScribusDoc* doc = NULL, bool retainDoc = false);
172 
173  ColorList& operator= (const ColorList& list);
174 
176  ScribusDoc* document(void) const;
177 
179  void setDocument(ScribusDoc* doc);
180 
182  void addColors(const ColorList& colorList, bool overwrite = true);
183 
185  void copyColors(const ColorList& colorList, bool overwrite = true);
186 
188  void ensureDefaultColors(void);
189 
191  QString tryAddColor(QString name, ScColor col);
192 };
193 
194 #endif
Definition: sccolor.h:51
Definition: sccolor.h:155
Definition: sccolorengine.h:32
the Document Class
Definition: scribusdoc.h:90