Subversion Repositories Scribus

Rev

Rev 2969 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2886 fschmid 1
/***************************************************************************
2
                          sccolor.h  -  description
3
                             -------------------
4
    begin                : Sun Sep 9 2001
5
    copyright            : (C) 2001 by Franz Schmid
6
    email                : Franz.Schmid@altmuehlnet.de
7
 ***************************************************************************/
8
 
9
/***************************************************************************
10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 ***************************************************************************/
17
 
18
#ifndef SCCOLOR_H
19
#define SCCOLOR_H
20
 
21
 
22
#include <qcolor.h>
23
class QString;
24
 
25
/**
26
  *@author Franz Schmid
27
  * This Class adds support for CMYK-Colors to QT.
28
  * its API is based on the API of QColor
29
  */
30
 
31
/** Scribus color models */
32
enum colorModel
33
{
34
        colorModelRGB,
35
        colorModelCMYK
36
};
37
 
38
class ScColor
39
{
40
public:
41
        ScColor();
42
/** Constructs a ScColor with 4 Components
43
 * in the range from 0 - 255 */
44
        ScColor(int c, int m, int y, int k);
45
/** Constructs a RGBColor with 3 Components
46
 * in the range from 0 - 255 */
47
        ScColor(int r, int g, int b);
48
        ~ScColor() {};
49
/** flag to enable and disable use of color management (default: true) */
50
        static bool UseProf;
51
 
52
/** Same as the Constructor but for an existing Color */
53
        void setColor(int c, int m, int y, int k);
54
 
55
/** Computes a ScColor from an RGB-Color
56
 * Applies Gray-Component-Removal to the resulting ScColor
57
 * or if color management is enabled, an approriate transform */
58
        void setColorRGB(int r, int g, int b);
59
 
60
/** set the color model */
61
        void setColorModel (colorModel cm);
62
 
63
/** get the color model */
64
        colorModel getColorModel ();
65
 
66
/** Computes a ScColor for a QColor */
67
        void fromQColor(QColor color);
68
 
69
/** Returns the transformed/proofed RGB color  */
70
        QColor getRGBColor();
71
        void getRawRGBColor(int *r, int *g, int *b);
72
 
73
/** Returns the 4 Values that form an ScColor */
74
        void getCMYK(int *c, int *m, int *y, int *k);
75
 
76
/** Returns the 3 Values that form an RGBColor */
77
        void getRGB(int *r, int *g, int *b);
78
 
79
/** get CMYK values of a specified shade */
80
        void getShadeColorCMYK(int *c, int *m, int *y, int *k, int level);
81
 
82
/** get RGB values of a specified shade */
83
        void getShadeColorRGB(int *r, int *g, int *b, int level);
84
 
85
/** Return a proofed QColor with the specified shade */
86
        QColor getShadeColorProof(int level);
87
 
88
/** Applys Gray-Component-Removal to an ScColor */
89
        void applyGCR();
90
 
91
/** Returns the ScColor as an Hex-String in the Form #CCYYMMKK for
92
 * a CMYK color or ##RRGGBB for a RGB color*/
93
        QString name();
94
 
95
/** Sets the Values of a color from an Hex-String in the Form #CCMMYYKK
96
 * or #RRGGBB */
97
        void setNamedColor(QString nam);
98
        void RecalcRGB();
99
 
100
private:
101
/** Cyan-Component of Color */
102
        int C;
103
 
104
/** Magenta-Component of Color */
105
        int M;
106
 
107
/** Yellow-Component of Color */
108
        int Y;
109
 
110
/** Black-Component of Color */
111
        int K;
112
 
113
/** Red-Component of Color */
114
        int R;
115
 
116
/** Green-Component of Color */
117
        int G;
118
 
119
/** Blue-Component of Color */
120
        int B;
121
 
122
/** RGB-Equivalent including color transforms */
123
        QColor RGB;
124
 
125
/** Flag, true if the Color is a Spotcolor */
126
        bool Spot;
127
 
128
/** Color model of the current color */
129
        colorModel Model;
130
};
131
 
132
#endif