Permalink
Browse files

[FEATURE]: new palette format! (Merge of palette-branch)

This commit merges the changes we did to the palette resource object in the improved palette format branch. It includes...
- A new zip-based file format.
 - This file format can hold high-bit depth colors, and supports all the colors that Krita can process.
 - It also has support for palette groups, though the groups can not be edited inside Krita yet.
 - Support for metadata like ID, name, and whether it is a spotcolor.
- Support for loading sbz, the swatchbooker format(courtesy of L. E. Segovia/Amyspark)

With this, we can start on a nice docker for palette mangling with all sorts of new goodies :)

CCMAIL:kimageshop@kde.org
Fixes T4121
Differential Revision: https://phabricator.kde.org/D4719
Differential Revision: https://phabricator.kde.org/D3254
  • Loading branch information...
therahedwig committed Mar 15, 2017
2 parents 7e7c378 + 5f1d09e commit b9d9a40fe85e40c5efa1d9649be8d29e4b191d00
@@ -255,7 +255,7 @@ KoColor KisPropertiesConfiguration::getColor(const QString& name, const KoColor&
QDomDocument doc;
doc.setContent(v.toString());
QDomElement e = doc.documentElement().firstChild().toElement();
return KoColor::fromXML(e, Integer16BitsColorDepthID.id(), QHash<QString, QString>());
return KoColor::fromXML(e, Integer16BitsColorDepthID.id());
}
} else {
return color;
@@ -437,7 +437,7 @@ KoColor KisRecordedPaintActionFactory::colorFromXML(const QDomElement& elt, cons
KoColor bC;
if (!colorElt.isNull()) {
bC = KoColor::fromXML(colorElt.firstChildElement(), Integer8BitsColorDepthID.id(), QHash<QString, QString>());
bC = KoColor::fromXML(colorElt.firstChildElement(), Integer8BitsColorDepthID.id());
bC.setOpacity(quint8(255));
dbgImage << elementName << " color : " << bC.toQColor();
} else {
@@ -206,7 +206,7 @@ void KisMimeDatabase::fillMimeData()
mimeType.mimeType = "application/x-gimp-color-palette";
mimeType.description = i18nc("description of a file type", "Color Palette");
mimeType.suffixes = QStringList() << "*.gpl" << "*.pal" << "*.act" << "*.aco" << "*.colors" << "*.xml";
mimeType.suffixes = QStringList() << "*.gpl" << "*.pal" << "*.act" << "*.aco" << "*.colors" << "*.xml" << "*.sbz";
s_mimeDatabase << mimeType;
mimeType.mimeType = "application/x-opencolorio-configuration";
@@ -105,6 +105,7 @@ target_include_directories( kritapigment
target_link_libraries( kritapigment
PUBLIC
kritaplugin
kritastore
${EXTRA_LIBRARIES}
KF5::I18n
KF5::ConfigCore
View
@@ -283,7 +283,7 @@ qreal KoColor::opacityF() const
return d->colorSpace->opacityF(d->data);
}
KoColor KoColor::fromXML(const QDomElement& elt, const QString & bitDepthId, const QHash<QString, QString> & aliases)
KoColor KoColor::fromXML(const QDomElement& elt, const QString & bitDepthId)
{
QString modelId;
if (elt.tagName() == "CMYK") {
@@ -304,10 +304,6 @@ KoColor KoColor::fromXML(const QDomElement& elt, const QString & bitDepthId, con
QString profileName;
if (elt.tagName() != "sRGB") {
profileName = elt.attribute("space", "");
const QHash<QString, QString>::ConstIterator it = aliases.find(profileName);
if (it != aliases.end()) {
profileName = it.value();
}
if (!KoColorSpaceRegistry::instance()->profileByName(profileName)) {
profileName.clear();
}
View
@@ -111,7 +111,6 @@ class KRITAPIGMENT_EXPORT KoColor
quint8 opacityU8() const;
qreal opacityF() const;
// what about making the next two methods static factory methods?
/// Convenient function for converting from a QColor
void fromQColor(const QColor& c) const;
@@ -152,12 +151,10 @@ class KRITAPIGMENT_EXPORT KoColor
* a preferred bit depth for creating the KoColor object (if that
* bit depth isn't available, this function will randomly select
* an other bit depth)
* @param profileAliases alias between the profile name specified by the "space"
* attribute and the profile name used inside pigment
* @return the unserialize color, or an empty color object if the function failed
* to unserialize the color
*/
static KoColor fromXML(const QDomElement& elt, const QString & bitDepthId, const QHash<QString, QString> & aliases);
static KoColor fromXML(const QDomElement& elt, const QString & bitDepthId);
static QString toQString(const KoColor &color);
Oops, something went wrong.

0 comments on commit b9d9a40

Please sign in to comment.