Commit 9e686707 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove operator< and add a toString method to KoColor

parent 9f6a4b63
......@@ -134,15 +134,6 @@ KoColor & KoColor::operator=(const KoColor & rhs)
return * this;
}
bool KoColor::operator<(const KoColor &other) const
{
QColor c = toQColor();
int gray = qGray(c.red(), c.green(), c.blue());
QColor c2 = other.toQColor();
return gray > qGray(c2.red(), c2.green(), c2.blue());
}
bool KoColor::operator==(const KoColor &other) const
{
if (!(*colorSpace() == *other.colorSpace()))
......@@ -327,3 +318,15 @@ KoColor KoColor::fromXML(const QDomElement& elt, const QString & bitDepthId, con
return KoColor();
}
}
QString KoColor::toQString(const KoColor &color)
{
QStringList ls;
ls << color.colorSpace()->name();
foreach(KoChannelInfo *channel, KoChannelInfo::displayOrderSorted(color.colorSpace()->channels())) {
ls << channel->name();
ls << color.colorSpace()->channelValueText(color.data(), channel->pos());
}
return ls.join(" ");
}
......@@ -67,11 +67,6 @@ public:
*/
KoColor &operator=(const KoColor &other);
/**
* @brief operator < compares the current color the other color and return true if this color is darker
*/
bool operator<(const KoColor &other) const;
bool operator==(const KoColor &other) const;
/// return the current colorSpace
......@@ -161,6 +156,8 @@ public:
*/
static KoColor fromXML(const QDomElement& elt, const QString & bitDepthId, const QHash<QString, QString> & aliases);
static QString toQString(const KoColor &color);
#ifndef NODEBUG
/// use kDebug calls to print internal info
void dump() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment