Commit 92e75852 authored by Cyrille Berger's avatar Cyrille Berger

use the new function to access colorspace

svn path=/trunk/koffice/; revision=1075517
parent 7ce9a273
...@@ -284,14 +284,13 @@ KoColor KoColor::fromXML(const QDomElement& elt, const QString & bitDepthId, con ...@@ -284,14 +284,13 @@ KoColor KoColor::fromXML(const QDomElement& elt, const QString & bitDepthId, con
profileName = ""; profileName = "";
} }
} }
QString csId = KoColorSpaceRegistry::instance()->colorSpaceId(modelId, bitDepthId); const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(modelId, bitDepthId, profileName);
if (csId.isEmpty()) { if (cs == 0) {
QList<KoID> list = KoColorSpaceRegistry::instance()->colorDepthList(modelId, KoColorSpaceRegistry::AllColorSpaces); QList<KoID> list = KoColorSpaceRegistry::instance()->colorDepthList(modelId, KoColorSpaceRegistry::AllColorSpaces);
if (!list.empty()) { if (!list.empty()) {
csId = KoColorSpaceRegistry::instance()->colorSpaceId(modelId, list[0].id()); cs = KoColorSpaceRegistry::instance()->colorSpace(modelId, list[0].id(), profileName);
} }
} }
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(csId, profileName);
if (cs) { if (cs) {
KoColor c(cs); KoColor c(cs);
cs->colorFromXML(c.data(), elt); cs->colorFromXML(c.data(), elt);
......
...@@ -178,7 +178,7 @@ void KoColorConversionSystem::insertColorProfile(const KoColorProfile* _profile) ...@@ -178,7 +178,7 @@ void KoColorConversionSystem::insertColorProfile(const KoColorProfile* _profile)
const KoColorSpace* KoColorConversionSystem::defaultColorSpaceForNode(const Node* node) const const KoColorSpace* KoColorConversionSystem::defaultColorSpaceForNode(const Node* node) const
{ {
return KoColorSpaceRegistry::instance()->colorSpace(KoColorSpaceRegistry::instance()->colorSpaceId(node->modelId, node->depthId), node->profileName); return KoColorSpaceRegistry::instance()->colorSpace(node->modelId, node->depthId, node->profileName);
} }
KoColorConversionSystem::Node* KoColorConversionSystem::createNode(const QString& _modelId, const QString& _depthId, const QString& _profileName) KoColorConversionSystem::Node* KoColorConversionSystem::createNode(const QString& _modelId, const QString& _depthId, const QString& _profileName)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "KoColorSpaceRegistry.h" #include "KoColorSpaceRegistry.h"
#include <math.h> #include <math.h>
#include <KoColorModelStandardIds.h>
KoStopGradient::KoStopGradient(const QString& filename) KoStopGradient::KoStopGradient(const QString& filename)
: KoAbstractGradient(filename) : KoAbstractGradient(filename)
...@@ -326,7 +327,7 @@ void KoStopGradient::parseKarbonGradient(const QDomElement& element) ...@@ -326,7 +327,7 @@ void KoStopGradient::parseKarbonGradient(const QDomElement& element)
color3 = e.attribute("v3", "0.0").toFloat(); color3 = e.attribute("v3", "0.0").toFloat();
color4 = e.attribute("v4", "0.0").toFloat(); color4 = e.attribute("v4", "0.0").toFloat();
stopColorSpace = KoColorSpaceRegistry::instance()->colorSpace("CMYK", QString()); stopColorSpace = KoColorSpaceRegistry::instance()->colorSpace( CMYKAColorModelID.id(), Integer8BitsColorDepthID.id(), QString());
if (stopColorSpace) { if (stopColorSpace) {
quint8 data[5]; quint8 data[5];
data[0] = static_cast<quint8>(color1 * 255 + 0.5); data[0] = static_cast<quint8>(color1 * 255 + 0.5);
...@@ -355,7 +356,7 @@ void KoStopGradient::parseKarbonGradient(const QDomElement& element) ...@@ -355,7 +356,7 @@ void KoStopGradient::parseKarbonGradient(const QDomElement& element)
break; break;
case 3: // gray case 3: // gray
color1 = e.attribute("v1", "0.0").toFloat(); color1 = e.attribute("v1", "0.0").toFloat();
stopColorSpace = KoColorSpaceRegistry::instance()->colorSpace("GRAY", QString()); stopColorSpace = KoColorSpaceRegistry::instance()->colorSpace( GrayAColorModelID.id(), Integer8BitsColorDepthID.id(), QString());
if (stopColorSpace) { if (stopColorSpace) {
quint8 data[2]; quint8 data[2];
data[0] = static_cast<quint8>(color1 * 255 + 0.5); data[0] = static_cast<quint8>(color1 * 255 + 0.5);
......
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