Thank you for your comments and help.
I need a display profile to allow users to temporarily switch between
the default display profile and the custom profile simulating color
blindness. This would affect the whole monitor.
The reason why I tried to directly generate a display profile was
that I could not find any way to combine an abstract profile with a
display profile to generate another display profile.
The following code tries to combine the currently used display
profile (read with cmsOpenProfileFromFile) and a dynamically
generated abstract profile. Both seem to be OK. The result is not a
valid display profile:
cmsHPROFILE combineDisplayAndAbstract(cmsHPROFILE displayProfile,
cmsHPROFILE abstractProfile) {
cmsHPROFILE inProfiles[2] = {displayProfile, abstractProfile};
DWORD dwFlags = 0;
dwFlags |= cmsFLAGS_GRIDPOINTS(LUTRESOLUTION);
DWORD InputFormat = TYPE_XYZ_DBL;
DWORD OutputFormat = TYPE_RGB_DBL;
cmsHTRANSFORM hTransform = cmsCreateMultiprofileTransform
(inProfiles, 2, InputFormat, OutputFormat, INTENT_PERCEPTUAL, dwFlags);
if (hTransform == NULL)
return NULL;
cmsHPROFILE combinedProfile = cmsTransform2DeviceLink
(hTransform, 0);
cmsSetDeviceClass(combinedProfile, icSigDisplayClass);
return combinedProfile;
}
The rXYZ, gXYZ, bXYZ and rTRC, gTRC and bTRC tags are missing in the
returned device link profile, which are mandatory in a display
profile, as far as I know.
Should I copy these tags (and possibly others too) from the original
display profile?
Another question concerning the size of the LUT in the abstract profile:
Please note since the matrix is a linear transform, 8 nodes would
be enough to model it on the CLUT. So, you end with the same
profile size.
Should I call cmsAlloc3DGrid with 8? i.e. cmsAlloc3DGrid(AToB0Lut, 8,
3, 3);
Thank you for your help!
Bernhard Jenny
On 07.09.2005, at 11:52, Marti wrote:
Hi,
The matrix XYZ -
I'm trying to write a little application that produces ICC
profiles for the simulation of color blindness (deuteranopia and
protanopia).
I think the correct way to deal with that would be to build an
abstract XYZ -> XYZ profile holding the simulation. In this
way you got no dependencies on any RGB space.
XYZ can be readily obtained by chaining XYZ to LMS and LMS to XYZ
matrices. You need not RGB anymore because all that is handled by
the input/output profiles. A multiprofile transform may be used
latter to obtain the RGB -> RGB, by means of icclink, for example.
As additional benefit you are not restricted to RGB anymore.
For bulding such abstract profile, you need a something like:
hProfile = cmsOpenProfileFromFile("abstract.icc", "w");
AToB0 = cmsAllocLUT();
cmsAlloc3DGrid(AToB0, GRID_POINTS, 3, 3);
cmsSample3DGrid(AToB0, Forward, NULL, 0);
cmsAddTag(hProfile, icSigAToB0Tag, AToB0);
cmsSetColorSpace(hProfile, icSigXYZData);
cmsSetPCS(hProfile, icSigXYZData);
cmsSetDeviceClass(hProfile, icSigAbstractClass);
cmsCloseProfile(hProfile);
cmsFreeLUT(AToB0);
Then, you need to write the callback:
static
int Forward(register WORD In[], register WORD Out[], register
LPVOID Cargo)
{ cmsCIEXYZ XYZ;
cmsXYZEncoded2Float(&XYZ, In);
// ... apply here the transform XYZ = [M] * XYZ
cmsFloat2XYZEncoded(Out, &XYZ);
return TRUE;
}
Hope this helps
Regards,
--
Marti Maria
The littlecms project.
www.littlecms.com
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/91 - Release Date:
06/09/2005
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user