Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

sccolor.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           sccolor.h  -  description
00009                              -------------------
00010     begin                : Sun Sep 9 2001
00011     copyright            : (C) 2001 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #ifndef SCCOLOR_H
00025 #define SCCOLOR_H
00026 
00027 #include <QColor>
00028 #include <QMap>
00029 #include <QPointer>
00030 #include <QString>
00031 
00032 #include "scribusapi.h"
00033 
00034 class ScribusDoc;
00035 
00036 
00044 enum colorModel
00045 {
00046     colorModelRGB,
00047     colorModelCMYK
00048 };
00049 
00050 class SCRIBUS_API ScColor 
00051 {
00052 public:
00053 
00054     friend class ScColorEngine;
00055 
00057     ScColor(void);
00059     ScColor(int c, int m, int y, int k);
00061     ScColor(int r, int g, int b);
00062     
00063     bool operator==(const ScColor& other) const;
00064 
00066     void setColor(ScribusDoc* doc, const QString& name);
00067 
00069     void setColor(int c, int m, int y, int k);
00070 
00074     void setColorRGB(int r, int g, int b);
00075 
00077     colorModel getColorModel () const;
00078 
00080     void fromQColor(QColor color);
00081 
00084     void getRawRGBColor(int *r, int *g, int *b) const;
00085     QColor getRawRGBColor() const;
00086 
00090     void getCMYK(int *c, int *m, int *y, int *k) const;
00091 
00095     void getRGB(int *r, int *g, int *b) const;
00096 
00099     QString name();
00102     QString nameRGB(const ScribusDoc* doc = NULL);
00105     QString nameCMYK(const ScribusDoc* doc = NULL);
00106 
00108     void setNamedColor(QString nam);
00109 
00111     bool isSpotColor() const;
00113     void setSpotColor(bool s);
00115     bool isRegistrationColor() const;
00117     void setRegistrationColor(bool s);
00118 
00119 private:
00120 
00122     int CR;
00124     int MG;
00126     int YB;
00128     int K;
00129 
00131     bool Spot;
00133     bool Regist;
00135     colorModel Model;
00136 };
00137 
00138 class SCRIBUS_API ColorList : public QMap<QString,ScColor>
00139 {
00140 protected:
00141     QPointer<ScribusDoc> m_doc;
00142     bool m_retainDoc;
00143 
00145     void ensureBlack(void);
00146 
00148     void ensureWhite(void);
00149 
00150 public:
00151     ColorList(ScribusDoc* doc = NULL, bool retainDoc = false);
00152 
00153     ColorList& operator= (const ColorList& list);
00154 
00156     ScribusDoc* document(void);
00157 
00159     void setDocument(ScribusDoc* doc);
00160 
00162     void addColors(const ColorList& colorList, bool overwrite = TRUE);
00163 
00165     void copyColors(const ColorList& colorList, bool overwrite = TRUE);
00166 
00168     void ensureBlackAndWhite(void);
00169 };
00170 
00171 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.