Back to index

scribus-ng  1.3.4.dfsg+svn20071115
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 <qstring.h>
00028 #include <qcolor.h>
00029 #include <qmap.h>
00030 #include <qguardedptr.h>
00031 
00032 class ScribusDoc;
00033 #include "scribusapi.h"
00034 
00035 
00043 enum colorModel
00044 {
00045        colorModelRGB,
00046        colorModelCMYK
00047 };
00048 
00049 class SCRIBUS_API ScColor 
00050 {
00051 public:
00052 
00053        friend class ScColorEngine;
00054 
00056        ScColor(void);
00058        ScColor(int c, int m, int y, int k);
00060        ScColor(int r, int g, int b);
00061        
00062        bool operator==(const ScColor& other) const;
00063 
00065        void setColor(ScribusDoc* doc, const QString& name);
00066 
00068        void setColor(int c, int m, int y, int k);
00069 
00073        void setColorRGB(int r, int g, int b);
00074 
00076        colorModel getColorModel () const;
00077 
00079        void fromQColor(QColor color);
00080 
00083        void getRawRGBColor(int *r, int *g, int *b) const;
00084        QColor getRawRGBColor() const;
00085 
00089        void getCMYK(int *c, int *m, int *y, int *k) const;
00090 
00094        void getRGB(int *r, int *g, int *b) const;
00095 
00098        QString name();
00101        QString nameRGB(const ScribusDoc* doc = NULL);
00104        QString nameCMYK(const ScribusDoc* doc = NULL);
00105 
00107        void setNamedColor(QString nam);
00108 
00110        bool isSpotColor() const;
00112        void setSpotColor(bool s);
00114        bool isRegistrationColor() const;
00116        void setRegistrationColor(bool s);
00117 
00118 private:
00119 
00121        int CR;
00123        int MG;
00125        int YB;
00127        int K;
00128 
00130        bool Spot;
00132        bool Regist;
00134        colorModel Model;
00135 };
00136 
00137 class SCRIBUS_API ColorList : public QMap<QString,ScColor>
00138 {
00139 protected:
00140        QGuardedPtr<ScribusDoc> m_doc;
00141        bool m_retainDoc;
00142 
00144        void ensureBlack(void);
00145 
00147        void ensureWhite(void);
00148 
00149 public:
00150        ColorList(ScribusDoc* doc = NULL, bool retainDoc = false);
00151 
00152        ColorList& operator= (const ColorList& list);
00153 
00155        ScribusDoc* document(void) { return m_doc; }
00156 
00158        void setDocument(ScribusDoc* doc);
00159 
00161        void addColors(const ColorList& colorList, bool overwrite = TRUE);
00162 
00164        void copyColors(const ColorList& colorList, bool overwrite = TRUE);
00165 
00167        void ensureBlackAndWhite(void);
00168 };
00169 
00170 #endif