Commits

Robert Kern committed 73d52a4

Expose certain whitepoint, blackpoint, illuminant, and colorant information about profiles.

  • Participants
  • Parent commits bf97dca

Comments (0)

Files changed (2)

     char* cmsTakeManufacturer(cmsHPROFILE hProfile)
     char* cmsTakeModel(cmsHPROFILE hProfile)
     char* cmsTakeCopyright(cmsHPROFILE hProfile)
+    bool cmsTakeMediaWhitePoint(LPcmsCIEXYZ Dest, cmsHPROFILE hProfile)
+    bool cmsTakeMediaBlackPoint(LPcmsCIEXYZ Dest, cmsHPROFILE hProfile)
+    bool cmsTakeIluminant(LPcmsCIEXYZ Dest, cmsHPROFILE hProfile)
+    bool cmsTakeColorants(LPcmsCIEXYZTRIPLE Dest, cmsHPROFILE hProfile)
     icColorSpaceSignature cmsGetPCS(cmsHPROFILE hProfile)
     icColorSpaceSignature cmsGetColorSpace(cmsHPROFILE hProfile)
     icProfileClassSignature cmsGetDeviceClass(cmsHPROFILE hProfile)
                 nchannels = _cmsChannelsOf(space)
                 return ('?',) * nchannels
 
-
     property double_format:
         def __get__(self):
             cdef icColorSpaceSignature space
             else:
                 return None
 
+    property media_whitepoint:
+        def __get__(self):
+            cdef cmsCIEXYZ wp
+            cdef int success
+
+            success = cmsTakeMediaWhitePoint(&wp, self.profile_ptr)
+            if success:
+                return (wp.X, wp.Y, wp.Z)
+            else:
+                raise AttributeError("could not obtain media whitepoint")
+
+    property media_blackpoint:
+        def __get__(self):
+            cdef cmsCIEXYZ bp
+            cdef int success
+
+            success = cmsTakeMediaBlackPoint(&bp, self.profile_ptr)
+            if success:
+                return (bp.X, bp.Y, bp.Z)
+            else:
+                raise AttributeError("could not obtain media blackpoint")
+
+    property illuminant:
+        def __get__(self):
+            cdef cmsCIEXYZ illum
+            cdef int success
+
+            success = cmsTakeIluminant(&illum, self.profile_ptr)
+            if success:
+                return (illum.X, illum.Y, illum.Z)
+            else:
+                raise AttributeError("could not obtain illuminant")
+
+    property colorants:
+        def __get__(self):
+            cdef cmsCIEXYZTRIPLE rgb
+            cdef int success
+
+            success = cmsTakeColorants(&rgb, self.profile_ptr)
+            if success:
+                return ((rgb.Red.X,   rgb.Red.Y,   rgb.Red.Z),
+                        (rgb.Green.X, rgb.Green.Y, rgb.Green.Z),
+                        (rgb.Blue.X,  rgb.Blue.Y,  rgb.Blue.Z))
+            else:
+                raise AttributeError("could not obtain colorants")
+
 
     def __new__(self, *args, **kwds):
         self.profile_ptr = NULL