Commits

Fredrik Lundh committed 64b0e12

Additional ImageCms fixes from Florian Böch (part 2 of 2).

Florian writes: Very nice - it just needs LCMS flags support so we can
use black point compensation and softproofing :) See attached
patches. They also fix a naming issue which could cause confusion -
display profile (ImageCms wording) actually means proof profile (lcms
wording), so I changed variable names and docstrings where
applicable. Patches are tested under Python 2.6.

Comments (0)

Files changed (1)

 }
 
 static cmsHTRANSFORM
-_buildTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, char *sInMode, char *sOutMode, int iRenderingIntent)
+_buildTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, char *sInMode, char *sOutMode, int iRenderingIntent, DWORD cmsFLAGS)
 {
   cmsHTRANSFORM hTransform;
 
                                  findLCMStype(sInMode),
                                  hOutputProfile,
                                  findLCMStype(sOutMode),
-                                 iRenderingIntent, 0);
+                                 iRenderingIntent, cmsFLAGS);
 
   Py_END_ALLOW_THREADS
 
 }
 
 static cmsHTRANSFORM
-_buildProofTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, cmsHPROFILE hDisplayProfile, char *sInMode, char *sOutMode, int iRenderingIntent, int iDisplayIntent)
+_buildProofTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, cmsHPROFILE hProofProfile, char *sInMode, char *sOutMode, int iRenderingIntent, int iProofIntent, DWORD cmsFLAGS)
 {
   cmsHTRANSFORM hTransform;
 
                           findLCMStype(sInMode),
                           hOutputProfile,
                           findLCMStype(sOutMode),
-                          hDisplayProfile,
+                          hProofProfile,
                           iRenderingIntent,
-                          iDisplayIntent,
-                          0);
+                          iProofIntent,
+                          cmsFLAGS);
 
   Py_END_ALLOW_THREADS
 
   char *sInMode;
   char *sOutMode;
   int iRenderingIntent = 0;
+  int cmsFLAGS = 0;
 
   cmsHTRANSFORM transform = NULL;
 
-  if (!PyArg_ParseTuple(args, "O!O!ss|i:buildTransform", &CmsProfile_Type, &pInputProfile, &CmsProfile_Type, &pOutputProfile, &sInMode, &sOutMode, &iRenderingIntent))
+  if (!PyArg_ParseTuple(args, "O!O!ss|ii:buildTransform", &CmsProfile_Type, &pInputProfile, &CmsProfile_Type, &pOutputProfile, &sInMode, &sOutMode, &iRenderingIntent, &cmsFLAGS))
     return NULL;
 
   cmsErrorAction(LCMS_ERROR_IGNORE);
 
-  transform = _buildTransform(pInputProfile->profile, pOutputProfile->profile, sInMode, sOutMode, iRenderingIntent);
+  transform = _buildTransform(pInputProfile->profile, pOutputProfile->profile, sInMode, sOutMode, iRenderingIntent, cmsFLAGS);
 
   if (!transform)
     return NULL;
 {
   CmsProfileObject *pInputProfile;
   CmsProfileObject *pOutputProfile;
-  CmsProfileObject *pDisplayProfile;
+  CmsProfileObject *pProofProfile;
   char *sInMode;
   char *sOutMode;
   int iRenderingIntent = 0;
-  int iDisplayIntent = 0;
+  int iProofIntent = 0;
+  int cmsFLAGS = 0;
 
   cmsHTRANSFORM transform = NULL;
 
-  if (!PyArg_ParseTuple(args, "O!O!O!ss|ii:buildProofTransform", &CmsProfile_Type, &pInputProfile, &CmsProfile_Type, &pOutputProfile, &CmsProfile_Type, &pDisplayProfile, &sInMode, &sOutMode, &iRenderingIntent, &iDisplayIntent))
+  if (!PyArg_ParseTuple(args, "O!O!O!ss|iii:buildProofTransform", &CmsProfile_Type, &pInputProfile, &CmsProfile_Type, &pOutputProfile, &CmsProfile_Type, &pProofProfile, &sInMode, &sOutMode, &iRenderingIntent, &iProofIntent, &cmsFLAGS))
     return NULL;
 
   cmsErrorAction(LCMS_ERROR_IGNORE);
 
-  transform = _buildProofTransform(pInputProfile->profile, pOutputProfile->profile, pDisplayProfile->profile, sInMode, sOutMode, iRenderingIntent, iDisplayIntent);
+  transform = _buildProofTransform(pInputProfile->profile, pOutputProfile->profile, pProofProfile->profile, sInMode, sOutMode, iRenderingIntent, iProofIntent, cmsFLAGS);
   
   if (!transform)
     return NULL;