Changeset View
Changeset View
Standalone View
Standalone View
libs/pigment/KoColor.h
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 46 | public: | |||
---|---|---|---|---|---|
94 | const KoColorSpace * colorSpace() const { | 94 | const KoColorSpace * colorSpace() const { | ||
95 | return m_colorSpace; | 95 | return m_colorSpace; | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | /// return the current profile | 98 | /// return the current profile | ||
99 | const KoColorProfile *profile() const; | 99 | const KoColorProfile *profile() const; | ||
100 | 100 | | |||
101 | /// Convert this KoColor to the specified colorspace. If the specified colorspace is the | 101 | /// Convert this KoColor to the specified colorspace. If the specified colorspace is the | ||
102 | /// same as the original colorspace, do nothing. Returns the converted KoColor. | 102 | /// same as the original colorspace, do nothing | ||
103 | void convertTo(const KoColorSpace * cs, | 103 | void convertTo(const KoColorSpace * cs, | ||
104 | KoColorConversionTransformation::Intent renderingIntent, | 104 | KoColorConversionTransformation::Intent renderingIntent, | ||
105 | KoColorConversionTransformation::ConversionFlags conversionFlags); | 105 | KoColorConversionTransformation::ConversionFlags conversionFlags); | ||
106 | 106 | | |||
107 | void convertTo(const KoColorSpace * cs); | 107 | void convertTo(const KoColorSpace * cs); | ||
108 | 108 | | |||
109 | /// Copies this color and converts it to the specified colorspace. If the specified colorspace is the | ||||
110 | /// same as the original colorspace, just returns a copy | ||||
111 | KoColor convertedTo(const KoColorSpace * cs, | ||||
112 | KoColorConversionTransformation::Intent renderingIntent, | ||||
113 | KoColorConversionTransformation::ConversionFlags conversionFlags) const; | ||||
114 | | ||||
115 | /// Copies this color and converts it to the specified colorspace. If the specified colorspace is the | ||||
116 | /// same as the original colorspace, just returns a copy | ||||
117 | KoColor convertedTo(const KoColorSpace * cs) const; | ||||
118 | | ||||
119 | | ||||
120 | | ||||
109 | /// assign new profile without converting pixel data | 121 | /// assign new profile without converting pixel data | ||
110 | void setProfile(const KoColorProfile *profile); | 122 | void setProfile(const KoColorProfile *profile); | ||
111 | 123 | | |||
112 | /// Replace the existing color data, and colorspace with the specified data. | 124 | /// Replace the existing color data, and colorspace with the specified data. | ||
113 | /// The data is copied. | 125 | /// The data is copied. | ||
114 | void setColor(const quint8 * data, const KoColorSpace * colorSpace = 0); | 126 | void setColor(const quint8 * data, const KoColorSpace * colorSpace = 0); | ||
115 | 127 | | |||
116 | /// Convert the color from src and replace the value of the current color with the converted data. | 128 | /// Convert the color from src and replace the value of the current color with the converted data. | ||
Show All 32 Lines | |||||
149 | * @return the buffer associated with this color object to be used with the | 161 | * @return the buffer associated with this color object to be used with the | ||
150 | * transformation object created by the color space of this KoColor | 162 | * transformation object created by the color space of this KoColor | ||
151 | * or to copy to a different buffer from the same color space | 163 | * or to copy to a different buffer from the same color space | ||
152 | */ | 164 | */ | ||
153 | const quint8 * data() const { | 165 | const quint8 * data() const { | ||
154 | return m_data; | 166 | return m_data; | ||
155 | } | 167 | } | ||
156 | 168 | | |||
169 | | ||||
170 | /** | ||||
171 | * Channelwise subtracts \p value from *this and stores the result in *this | ||||
172 | * | ||||
173 | * Throws a safe assert if the colorspaces of the two colors are different | ||||
174 | */ | ||||
175 | void subtract(const KoColor &value); | ||||
176 | | ||||
177 | /** | ||||
178 | * Channelwise subtracts \p value from a copy of *this and returns the result | ||||
179 | * | ||||
180 | * Throws a safe assert if the colorspaces of the two colors are different | ||||
181 | */ | ||||
182 | KoColor subtracted(const KoColor &value) const; | ||||
183 | | ||||
184 | /** | ||||
185 | * Channelwise adds \p value to *this and stores the result in *this | ||||
186 | * | ||||
187 | * Throws a safe assert if the colorspaces of the two colors are different | ||||
188 | */ | ||||
189 | void add(const KoColor &value); | ||||
190 | | ||||
191 | /** | ||||
192 | * Channelwise adds \p value to a copy of *this and returns the result | ||||
193 | * | ||||
194 | * Throws a safe assert if the colorspaces of the two colors are different | ||||
195 | */ | ||||
196 | KoColor added(const KoColor &value) const; | ||||
197 | | ||||
157 | /** | 198 | /** | ||
158 | * Serialize this color following Create's swatch color specification available | 199 | * Serialize this color following Create's swatch color specification available | ||
159 | * at http://create.freedesktop.org/wiki/index.php/Swatches_-_colour_file_format | 200 | * at http://create.freedesktop.org/wiki/index.php/Swatches_-_colour_file_format | ||
160 | * | 201 | * | ||
161 | * This function doesn't create the <color /> element but rather the <CMYK />, | 202 | * This function doesn't create the <color /> element but rather the <CMYK />, | ||
162 | * <sRGB />, <RGB /> ... elements. It is assumed that colorElt is the <color /> | 203 | * <sRGB />, <RGB /> ... elements. It is assumed that colorElt is the <color /> | ||
163 | * element. | 204 | * element. | ||
164 | * | 205 | * | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 259 | #endif | |||
220 | 261 | | |||
221 | const KoColorSpace *m_colorSpace; | 262 | const KoColorSpace *m_colorSpace; | ||
222 | quint8 m_data[MAX_PIXEL_SIZE]; | 263 | quint8 m_data[MAX_PIXEL_SIZE]; | ||
223 | quint8 m_size; | 264 | quint8 m_size; | ||
224 | }; | 265 | }; | ||
225 | 266 | | |||
226 | Q_DECLARE_METATYPE(KoColor) | 267 | Q_DECLARE_METATYPE(KoColor) | ||
227 | 268 | | |||
269 | KRITAPIGMENT_EXPORT QDebug operator<<(QDebug dbg, const KoColor &color); | ||||
270 | | ||||
271 | | ||||
228 | #endif | 272 | #endif |