Hello,
I’m having a problem adding a curveType to an AToB tag.
The code below (based on an earlier post in this mailing list) produces a
profile with AToB tag containing parametric curves, as expected. But when I
try to add a curve specified as a list of values (by uncommenting the commented
line, and commenting the one just before), then no profile is produced
(cmsSaveProfileToFile returns false).
Any suggestion about what’s going wrong ?
Best regards,
Gert
cmsContext context = cmsCreateContext(0, 0);
cmsHPROFILE profile = cmsCreateProfilePlaceholder(context);
cmsSetProfileVersion(profile, 4.3);
cmsSetDeviceClass(profile, cmsSigDisplayClass);
cmsSetColorSpace(profile, cmsSigRgbData);
cmsSetPCS(profile, cmsSigXYZData);
cmsPipeline* pipeline = cmsPipelineAlloc(context, 3, 3);
cmsFloat64Number data[] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
cmsFloat64Number offset[] = {0.0, 0.0, 0.0};
cmsToneCurve* gamma[3];
gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma(context, 1.0);
cmsToneCurve *curves[3];
cmsFloat32Number rr[256];
cmsFloat32Number gg[256];
cmsFloat32Number bb[256];
for (int i = 0; i < 256; ++i)
{
rr[i] = gg[i] = bb[i] = cmsFloat32Number(i) / 255;
}
curves[0] = cmsBuildTabulatedToneCurveFloat(context, 256, rr);
curves[1] = cmsBuildTabulatedToneCurveFloat(context, 256, gg);
curves[2] = cmsBuildTabulatedToneCurveFloat(context, 256, bb);
cmsPipelineInsertStage(pipeline, cmsAT_BEGIN,
cmsStageAllocToneCurves(context, 3, gamma));
//cmsPipelineInsertStage(pipeline, cmsAT_BEGIN,
cmsStageAllocToneCurves(context, 3, curves));
cmsPipelineInsertStage(pipeline, cmsAT_END, cmsStageAllocMatrix(context, 3,
3, data, offset));
cmsPipelineInsertStage(pipeline, cmsAT_END,
cmsStageAllocToneCurves(context, 3, gamma));
cmsFreeToneCurve(gamma[0]);
cmsWriteTag(profile, cmsSigAToB0Tag, pipeline);
cmsPipelineFree(pipeline);
cmsSaveProfileToFile(profile, "test.icc");
cmsCloseProfile(profile);
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user