Subversion Repositories Scribus

Rev

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