[Digikam-devel] extragear/graphics/digikam/libs/dimg/filters
Francisco J. Cruz
fj.cruz at supercable.es
Sat Jan 21 22:58:43 GMT 2006
SVN commit 501055 by fjcruz:
IccTransform::apply( DImg& image, QByteArray& profile, ...) has been modified: now intent and checkGamut are working
CCMAIL:digikam-devel at kde.org
M +41 -15 icctransform.cpp
M +1 -1 icctransform.h
--- trunk/extragear/graphics/digikam/libs/dimg/filters/icctransform.cpp #501054:501055
@@ -279,14 +279,32 @@
cmsCloseProfile(proofprofile);
}
-void IccTransform::apply( DImg& image, QByteArray& profile, bool useBPC, bool checkGamut, bool useBuiltin )
+void IccTransform::apply( DImg& image, QByteArray& profile, int intent, bool useBPC, bool checkGamut, bool useBuiltin )
{
- /// FIXME use of checkGamut is not implemented. -- Paco Cruz
cmsHPROFILE inprofile=0, outprofile=0, proofprofile=0;
cmsHTRANSFORM transform;
int transformFlags = 0;
+ int renderingIntent;
+ switch (intent)
+ {
+ case 0:
+ intent = INTENT_PERCEPTUAL;
+ break;
+ case 1:
+ intent = INTENT_RELATIVE_COLORIMETRIC;
+ break;
+ case 2:
+ intent = INTENT_SATURATION;
+ break;
+ case 3:
+ intent = INTENT_ABSOLUTE_COLORIMETRIC;
+ break;
+ }
+
+ kdDebug() << "icctransform.cpp/308-Intent is: " << intent << endl;
+
if (!profile.isNull())
{
inprofile = cmsOpenProfileFromMem(profile.data(),
@@ -306,7 +324,7 @@
if (useBPC)
{
- transformFlags = cmsFLAGS_WHITEBLACKCOMPENSATION;
+ transformFlags |= cmsFLAGS_WHITEBLACKCOMPENSATION;
}
if (!d->do_proof_profile)
@@ -319,7 +337,7 @@
TYPE_BGRA_16,
outprofile,
TYPE_BGRA_16,
- INTENT_PERCEPTUAL,
+ intent,
transformFlags);
}
else
@@ -328,7 +346,7 @@
TYPE_BGR_16,
outprofile,
TYPE_BGR_16,
- INTENT_PERCEPTUAL,
+ intent,
transformFlags);
}
@@ -341,7 +359,7 @@
TYPE_BGRA_8,
outprofile,
TYPE_BGRA_8,
- INTENT_PERCEPTUAL,
+ intent,
transformFlags);
}
else
@@ -350,7 +368,7 @@
TYPE_BGR_8,
outprofile,
TYPE_BGR_8,
- INTENT_PERCEPTUAL,
+ intent,
transformFlags);
}
@@ -359,6 +377,12 @@
else
{
proofprofile = cmsOpenProfileFromFile(QFile::encodeName( d->proof_profile ), "r");
+ transformFlags |= cmsFLAGS_SOFTPROOFING;
+ if (checkGamut)
+ {
+ cmsSetAlarmCodes(126, 255, 255);
+ transformFlags |= cmsFLAGS_GAMUTCHECK;
+ }
if (image.sixteenBit())
{
@@ -369,8 +393,8 @@
outprofile,
TYPE_BGRA_16,
proofprofile,
- INTENT_ABSOLUTE_COLORIMETRIC,
- INTENT_ABSOLUTE_COLORIMETRIC,
+ intent,
+ intent,
transformFlags);
}
else
@@ -380,8 +404,8 @@
outprofile,
TYPE_BGR_16,
proofprofile,
- INTENT_ABSOLUTE_COLORIMETRIC,
- INTENT_ABSOLUTE_COLORIMETRIC,
+ intent,
+ intent,
transformFlags);
}
}
@@ -394,8 +418,8 @@
outprofile,
TYPE_BGR_8,
proofprofile,
- INTENT_ABSOLUTE_COLORIMETRIC,
- INTENT_ABSOLUTE_COLORIMETRIC,
+ intent,
+ intent,
transformFlags);
}
else
@@ -405,13 +429,15 @@
outprofile,
TYPE_BGR_8,
proofprofile,
- INTENT_ABSOLUTE_COLORIMETRIC,
- INTENT_ABSOLUTE_COLORIMETRIC,
+ intent,
+ intent,
transformFlags);
}
}
}
+ kdDebug() << "icctransform.cpp/439 Transform flags are: " << transformFlags << endl;
+
// We need to work using temp pixel buffer to apply ICC transformations.
uchar transdata[image.bytesDepth()];
--- trunk/extragear/graphics/digikam/libs/dimg/filters/icctransform.h #501054:501055
@@ -42,7 +42,7 @@
void getTransformType(bool do_proof_profile);
void apply(DImg& image);
- void apply(DImg& image, QByteArray& profile, bool useBPC = false, bool checkGamut = false,
+ void apply(DImg& image, QByteArray& profile, int intent, bool useBPC = false, bool checkGamut = false,
bool useBuiltin=false);
void getEmbeddedProfile(DImg image);
More information about the Digikam-devel
mailing list