Subversion Repositories Scribus

Rev

Rev 2886 | Rev 3041 | 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);
73
 
74
/** Returns the 4 Values that form an ScColor */
75
        void getCMYK(int *c, int *m, int *y, int *k);
76
 
77
/** Returns the 3 Values that form an RGBColor */
78
        void getRGB(int *r, int *g, int *b);
79
 
80
/** get CMYK values of a specified shade */
81
        void getShadeColorCMYK(int *c, int *m, int *y, int *k, int level);
82
 
83
/** get RGB values of a specified shade */
84
        void getShadeColorRGB(int *r, int *g, int *b, int level);
85
 
86
/** Return a proofed QColor with the specified shade */
87
        QColor getShadeColorProof(int level);
88
 
89
/** Applys Gray-Component-Removal to an ScColor */
90
        void applyGCR();
91
 
92
/** Returns the ScColor as an Hex-String in the Form #CCYYMMKK for
93
 * a CMYK color or ##RRGGBB for a RGB color*/
94
        QString name();
95
 
96
/** Sets the Values of a color from an Hex-String in the Form #CCMMYYKK
97
 * or #RRGGBB */
98
        void setNamedColor(QString nam);
99
        void RecalcRGB();
100
 
101
private:
102
/** Cyan-Component of Color */
103
        int C;
104
 
105
/** Magenta-Component of Color */
106
        int M;
107
 
108
/** Yellow-Component of Color */
109
        int Y;
110
 
111
/** Black-Component of Color */
112
        int K;
113
 
114
/** Red-Component of Color */
115
        int R;
116
 
117
/** Green-Component of Color */
118
        int G;
119
 
120
/** Blue-Component of Color */
121
        int B;
122
 
123
/** RGB-Equivalent including color transforms */
124
        QColor RGB;
125
 
126
/** Flag, true if the Color is a Spotcolor */
127
        bool Spot;
128
 
129
/** Color model of the current color */
130
        colorModel Model;
131
};
132
 
133
#endif