< prev index next >

src/java.desktop/share/native/liblcms/cmssamp.c

Print this page

135     if (hLab == NULL) {
136        BlackPoint -> X = BlackPoint ->Y = BlackPoint -> Z = 0.0;
137        return FALSE;
138     }
139 
140     // Create the transform
141     xform = cmsCreateTransformTHR(ContextID, hInput, dwFormat,
142                                 hLab, TYPE_Lab_DBL, Intent, cmsFLAGS_NOOPTIMIZE|cmsFLAGS_NOCACHE);
143     cmsCloseProfile(hLab);
144 
145     if (xform == NULL) {
146 
147         // Something went wrong. Get rid of open resources and return zero as black
148         BlackPoint -> X = BlackPoint ->Y = BlackPoint -> Z = 0.0;
149         return FALSE;
150     }
151 
152     // Convert black to Lab
153     cmsDoTransform(xform, Black, &Lab, 1);
154 
155     // Force it to be neutral, check for inconsistences
156     Lab.a = Lab.b = 0;
157     if (Lab.L > 50 || Lab.L < 0) Lab.L = 0;
158 
159     // Free the resources
160     cmsDeleteTransform(xform);
161 
162     // Convert from Lab (which is now clipped) to XYZ.
163     cmsLab2XYZ(NULL, &BlackXYZ, &Lab);
164 
165     if (BlackPoint != NULL)
166         *BlackPoint = BlackXYZ;
167 
168     return TRUE;
169 
170     cmsUNUSED_PARAMETER(dwFlags);
171 }
172 
173 // Get a black point of output CMYK profile, discounting any ink-limiting embedded
174 // in the profile. For doing that, we use perceptual intent in input direction:
175 // Lab (0, 0, 0) -> [Perceptual] Profile -> CMYK -> [Rel. colorimetric] Profile -> Lab

135     if (hLab == NULL) {
136        BlackPoint -> X = BlackPoint ->Y = BlackPoint -> Z = 0.0;
137        return FALSE;
138     }
139 
140     // Create the transform
141     xform = cmsCreateTransformTHR(ContextID, hInput, dwFormat,
142                                 hLab, TYPE_Lab_DBL, Intent, cmsFLAGS_NOOPTIMIZE|cmsFLAGS_NOCACHE);
143     cmsCloseProfile(hLab);
144 
145     if (xform == NULL) {
146 
147         // Something went wrong. Get rid of open resources and return zero as black
148         BlackPoint -> X = BlackPoint ->Y = BlackPoint -> Z = 0.0;
149         return FALSE;
150     }
151 
152     // Convert black to Lab
153     cmsDoTransform(xform, Black, &Lab, 1);
154 
155     // Force it to be neutral, check for inconsistencies
156     Lab.a = Lab.b = 0;
157     if (Lab.L > 50 || Lab.L < 0) Lab.L = 0;
158 
159     // Free the resources
160     cmsDeleteTransform(xform);
161 
162     // Convert from Lab (which is now clipped) to XYZ.
163     cmsLab2XYZ(NULL, &BlackXYZ, &Lab);
164 
165     if (BlackPoint != NULL)
166         *BlackPoint = BlackXYZ;
167 
168     return TRUE;
169 
170     cmsUNUSED_PARAMETER(dwFlags);
171 }
172 
173 // Get a black point of output CMYK profile, discounting any ink-limiting embedded
174 // in the profile. For doing that, we use perceptual intent in input direction:
175 // Lab (0, 0, 0) -> [Perceptual] Profile -> CMYK -> [Rel. colorimetric] Profile -> Lab
< prev index next >