chalk

kis_color.h
1/*
2 * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18#ifndef _KIS_COLOR_H_
19#define _KIS_COLOR_H_
20
21#include <tqcolor.h>
22#include "ksharedptr.h"
23
24#include "kis_global.h"
25#include "kis_profile.h"
26#include "kis_colorspace.h"
27
28
33class KisColor {
34
35public:
37 KisColor();
38
39 virtual ~KisColor();
40
43 KisColor(const TQColor & color, KisColorSpace * colorSpace);
44
47 KisColor(const TQColor & color, TQ_UINT8 alpha, KisColorSpace * colorSpace);
48
50 KisColor(const TQ_UINT8 * data, KisColorSpace * colorSpace);
51
53 KisColor(const KisColor &src, KisColorSpace * colorSpace);
54
56 KisColor(const KisColor & rhs);
57
59 KisColor &operator=(const KisColor &);
60
62 TQ_UINT8 * data() const { return m_data; }
63
64 KisColorSpace * colorSpace() const { return m_colorSpace; }
65
66 KisProfile * profile() const { return m_colorSpace->getProfile(); }
67
70 void convertTo(KisColorSpace * cs);
71
73 void setColor(TQ_UINT8 * data, KisColorSpace * colorSpace = 0);
74
76 void toTQColor(TQColor *c) const;
77 void toTQColor(TQColor *c, TQ_UINT8 *opacity) const;
78
79 TQColor toTQColor() const;
80
81 void dump() const;
82
83private:
84
85 TQ_UINT8 * m_data;
86
87 KisColorSpace * m_colorSpace;
88};
89
90#endif
A colorspace is the definition of a certain color model in Chalk.
virtual KisProfile * getProfile() const =0
Return the profile of this color space.
void toTQColor(TQColor *c) const
To save the user the trouble of doing color->colorSpace()->toTQColor(color->data(),...
KisColor & operator=(const KisColor &)
Effective C++, item 11.
Definition kis_color.cpp:91
KisColor()
Create an empty KisColor. It will be valid, but also black and transparent.
Definition kis_color.cpp:27
void convertTo(KisColorSpace *cs)
Convert this KisColor to the specified colorspace.
void setColor(TQ_UINT8 *data, KisColorSpace *colorSpace=0)
Replace the existing color data, and colorspace with the specified data.
TQ_UINT8 * data() const
For easy memcpy'ing etc.
Definition kis_color.h:62