14#include <QDomDocument>
57 return d->color == other.
d->color;
62 QColor c = QColor(0,0,0);
94 return d->color.colorSpace()->colorDepthId().id();
99 return d->color.colorSpace()->colorModelId().id();
104 return d->color.colorSpace()->profile()->name();
110 if (!profile)
return false;
111 d->color.setProfile(profile);
118 if (!colorSpace)
return false;
119 d->color.convertTo(colorSpace);
126 d->color.colorSpace()->normalisedChannelsValue(
d->color.data(), values);
135 for (
int i=0; i<values.size();i++) {
137 values[location] = valuesUnsorted[i];
144 d->color.colorSpace()->fromNormalisedChannelsValue(
d->color.data(), values);
150 QDomElement root = doc.createElement(
"Color");
152 doc.appendChild(root);
153 d->color.toXML(doc, root);
154 return doc.toString();
161 QDomElement e = doc.documentElement();
162 QDomElement c = e.firstChildElement(
"Color");
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
KisDisplayColorConverter * displayColorConverter() const
KoColorDisplayRendererInterface * displayRendererInterface() const
static int displayPositionToChannelIndex(int displayPosition, const QList< KoChannelInfo * > &channels)
virtual KoColor approximateFromRenderedQColor(const QColor &c) const =0
virtual QColor toQColor(const KoColor &c, bool proofToPaintColors=false) const =0
static KoColor fromXML(const QDomElement &elt, const QString &channelDepthId)
static QString toQString(const KoColor &color)
toQString create a user-visible string of the channel names and the channel values
static KoColorDisplayRendererInterface * instance()
The ManagedColor class is a class to handle colors that are color managed. A managed color is a color...
QString colorModel() const
colorModel retrieve the current color model of this document:
ManagedColor(QObject *parent=0)
ManagedColor Create a ManagedColor that is black and transparent.
bool operator==(const ManagedColor &other) const
bool setColorProfile(const QString &colorProfile)
setColorProfile set the color profile of the image to the given profile. The profile has to be regist...
QString colorProfile() const
QVector< float > components() const
components
QColor colorForCanvas(Canvas *canvas) const
colorForCanvas
static ManagedColor * fromQColor(const QColor &qcolor, Canvas *canvas=0)
fromQColor is the (approximate) reverse of colorForCanvas()
bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile)
setColorSpace convert the nodes and the image to the given colorspace. The conversion is done with Pe...
QString toQString()
toQString create a user-visible string of the channel names and the channel values
void fromXML(const QString &xml)
const QScopedPointer< Private > d
void setComponents(const QVector< float > &values)
setComponents Set the channel/components with normalized values. For integer colorspace,...
QVector< float > componentsOrdered() const
componentsOrdered()
QString colorDepth() const
const KoColorProfile * profileByName(const QString &name) const
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()