Subversion Repositories Scribus

Rev

Rev 3251 | Rev 4535 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 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
*/
2886 fschmid 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
 
3251 craig 27
#include "qstring.h"
28
#include <qcolor.h>
29
#include "qmap.h"
30
 
2969 craig 31
#include "scribusapi.h"
2886 fschmid 32
 
33
 
34
/**
35
  *@author Franz Schmid
36
  * This Class adds support for CMYK-Colors to QT.
37
  * its API is based on the API of QColor
38
  */
39
 
40
/** Scribus color models */
41
enum colorModel
42
{
43
        colorModelRGB,
44
        colorModelCMYK
45
};
46
 
2969 craig 47
class SCRIBUS_API ScColor
2886 fschmid 48
{
49
public:
50
        ScColor();
51
/** Constructs a ScColor with 4 Components
52
 * in the range from 0 - 255 */
53
        ScColor(int c, int m, int y, int k);
54
/** Constructs a RGBColor with 3 Components
55
 * in the range from 0 - 255 */
56
        ScColor(int r, int g, int b);
57
        ~ScColor() {};
58
/** flag to enable and disable use of color management (default: true) */
59
        static bool UseProf;
60
 
61
/** Same as the Constructor but for an existing Color */
62
        void setColor(int c, int m, int y, int k);
63
 
64
/** Computes a ScColor from an RGB-Color
65
 * Applies Gray-Component-Removal to the resulting ScColor
66
 * or if color management is enabled, an approriate transform */
67
        void setColorRGB(int r, int g, int b);
68
 
69
/** set the color model */
70
        void setColorModel (colorModel cm);
71
 
72
/** get the color model */
73
        colorModel getColorModel ();
74
 
75
/** Computes a ScColor for a QColor */
76
        void fromQColor(QColor color);
77
 
78
/** Returns the transformed/proofed RGB color  */
79
        QColor getRGBColor();
80
        void getRawRGBColor(int *r, int *g, int *b);
3046 fschmid 81
        QColor getRawRGBColor();
2886 fschmid 82
 
83
/** Returns the 4 Values that form an ScColor */
84
        void getCMYK(int *c, int *m, int *y, int *k);
85
 
86
/** Returns the 3 Values that form an RGBColor */
87
        void getRGB(int *r, int *g, int *b);
88
 
89
/** get CMYK values of a specified shade */
90
        void getShadeColorCMYK(int *c, int *m, int *y, int *k, int level);
91
 
92
/** get RGB values of a specified shade */
93
        void getShadeColorRGB(int *r, int *g, int *b, int level);
94
 
95
/** Return a proofed QColor with the specified shade */
96
        QColor getShadeColorProof(int level);
97
 
98
/** Applys Gray-Component-Removal to an ScColor */
99
        void applyGCR();
100
 
101
/** Returns the ScColor as an Hex-String in the Form #CCYYMMKK for
102
 * a CMYK color or ##RRGGBB for a RGB color*/
103
        QString name();
104
 
105
/** Sets the Values of a color from an Hex-String in the Form #CCMMYYKK
106
 * or #RRGGBB */
107
        void setNamedColor(QString nam);
108
        void RecalcRGB();
3041 fschmid 109
        bool isOutOfGamut();
3046 fschmid 110
        void checkGamut();
3051 fschmid 111
        bool isSpotColor();
112
        void setSpotColor(bool s);
3060 fschmid 113
        bool isRegistrationColor();
114
        void setRegistrationColor(bool s);
2886 fschmid 115
 
116
private:
117
/** Cyan-Component of Color */
118
        int C;
119
 
120
/** Magenta-Component of Color */
121
        int M;
122
 
123
/** Yellow-Component of Color */
124
        int Y;
125
 
126
/** Black-Component of Color */
127
        int K;
128
 
129
/** Red-Component of Color */
130
        int R;
131
 
132
/** Green-Component of Color */
133
        int G;
134
 
135
/** Blue-Component of Color */
136
        int B;
137
 
138
/** RGB-Equivalent including color transforms */
139
        QColor RGB;
140
 
141
/** Flag, true if the Color is a Spotcolor */
142
        bool Spot;
143
 
3060 fschmid 144
/** Flag, true if the Color is a Registration color */
145
        bool Regist;
146
 
2886 fschmid 147
/** Color model of the current color */
148
        colorModel Model;
3041 fschmid 149
 
150
/** Flag, true if out of Gamut */
151
        bool outOfGamutFlag;
2886 fschmid 152
};
153
 
3251 craig 154
/** Definition der Farbenlisten */
155
typedef QMap<QString,ScColor> ColorList;
156
 
2886 fschmid 157
#endif