00001 /* 00002 File: PI_CWRuntime.c 00003 00004 Contains: 00005 00006 Written by: U. J. Krabbenhoeft 00007 00008 Version: 00009 00010 Copyright: � 1993-1997 by Heidelberger Druckmaschinen AG, all rights reserved. 00011 00012 */ 00013 00014 #ifndef LHGeneralIncs_h 00015 #include "General.h" 00016 #endif 00017 00018 00019 #ifndef LHCMRuntime_h 00020 #include "Runtime.h" 00021 #endif 00022 /* ______________________________________________________________________ 00023 00024 CMError CWMatchBitmap ( 00025 CMWorldRef Storage, 00026 CMBitmap* bitMap, 00027 CMBitmapCallBackUPP progressProc, 00028 void* refCon, 00029 CMBitmap* matchedBitMap) 00030 Abstract: 00031 Match pixel data of bitMap according to the CMProfileRef parameters 00032 supplied to a previous call to CMMInitPrivate(�), CWNewColorWorld(...), 00033 CMMConcatInitPrivate(�) or CWConcatColorWorld(...). 00034 00035 Params: 00036 storage (in) Reference to ColorWorld storage. 00037 bitMap (in/out) Describes source BitMap data. 00038 progressProc (in) Client function which is called once 00039 per row of the BitMap. If the 00040 function result is TRUE then the 00041 operation is aborted. May be NULL. 00042 refCon (in) Client data which is passed as a 00043 parameter to calls to progressProc. 00044 matchedBitMap (in/out) Result matched BitMap. The caller 00045 is responsible for allocating the 00046 pixel buffer pointed to by baseAddr. 00047 If NULL then the source BitMap is 00048 matched in place. 00049 00050 Return: 00051 noErr successful 00052 System or result code if an error occurs. 00053 00054 _____________________________________________________________________ */ 00055 00056 CMError CWMatchBitmap ( 00057 CMWorldRef Storage, 00058 CMBitmap* bitMap, 00059 CMBitmapCallBackUPP progressProc, 00060 void* refCon, 00061 CMBitmap* matchedBitMap) 00062 00063 { 00064 CMError err = noErr; 00065 CMMModelPtr aPtr; 00066 00067 if( Storage == 0 )return cmparamErr; 00068 LOCK_DATA( Storage ); 00069 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00070 err = LHMatchBitMapPrivate( aPtr, 00071 (const CMBitmap*)bitMap, 00072 progressProc, 00073 refCon, 00074 matchedBitMap ); 00075 UNLOCK_DATA( Storage ); 00076 return err; 00077 } 00078 00079 /* ______________________________________________________________________ 00080 00081 CMError CWCheckBitmap ( 00082 CMWorldRef Storage, 00083 const CMBitmap *bitMap, 00084 CMBitmapCallBackUPP progressProc, 00085 void *refCon, 00086 CMBitmap *resultBitMap ) 00087 00088 Abstract: 00089 Gamut test pixel data of bitMap according to the CMProfileRef 00090 parameters supplied to a previous call to CMMInitPrivate(�), CWNewColorWorld(...), 00091 CMMConcatInitPrivate(�) or CWConcatColorWorld(...). 00092 00093 Params: 00094 storage (in) Reference to ColorWorld storage. 00095 bitMap (in/out) Describes BitMap data. 00096 progressProc (in) Client function which is called 00097 once per row of the BitMap. If 00098 the function result is true then 00099 the operation is aborted.May be NULL. 00100 refCon (in) Client data which is passed as a 00101 parameter to calls to progressProc. 00102 resultBitMap (in/out) Result BitMap. Must be one bit depth 00103 and equal bounds of bitMap parameter. 00104 Pixels are set to 1 if corresponding 00105 pixel of bitMap is out of gamut. 00106 00107 Return: 00108 noErr successful 00109 System or result code if an error occurs. 00110 00111 _____________________________________________________________________ */ 00112 00113 CMError CWCheckBitmap ( 00114 CMWorldRef Storage, 00115 const CMBitmap *bitMap, 00116 CMBitmapCallBackUPP progressProc, 00117 void *refCon, 00118 CMBitmap *resultBitMap ) 00119 { 00120 CMError err = noErr; 00121 CMMModelPtr aPtr; 00122 00123 if( Storage == 0 )return cmparamErr; 00124 LOCK_DATA( Storage ); 00125 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00126 err = LHCheckBitMapPrivate( aPtr, 00127 (const CMBitmap*)bitMap, 00128 progressProc, 00129 refCon, 00130 resultBitMap ); 00131 UNLOCK_DATA( Storage ); 00132 return err; 00133 } 00134 /* ______________________________________________________________________ 00135 00136 CMError CWMatchBitmapPlane( CMWorldRef Storage, 00137 LH_CMBitmapPlane* bitMap, 00138 CMBitmapCallBackUPP progressProc, 00139 void* refCon, 00140 LH_CMBitmapPlane* matchedBitMap) 00141 00142 Abstract: 00143 Match pixel data of LH_CMBitmapPlane according to the CMProfileRef parameters 00144 supplied to a previous call to CMMInitPrivate(�), CWNewColorWorld(...), 00145 CMMConcatInitPrivate(�) or CWConcatColorWorld(...). 00146 00147 Params: 00148 storage (in) Reference to ColorWorld storage. 00149 bitMap (in/out) Describes source BitMap data. 00150 progressProc (in) Client function which is called once 00151 per row of the BitMap. If the 00152 function result is TRUE then the 00153 operation is aborted. May be NULL. 00154 refCon (in) Client data which is passed as a 00155 parameter to calls to progressProc. 00156 matchedBitMap (in/out) Result matched BitMap. The caller 00157 is responsible for allocating the 00158 pixel buffer pointed to by baseAddr. 00159 If NULL then the source BitMap is 00160 matched in place. 00161 00162 Return: 00163 noErr successful 00164 System or result code if an error occurs. 00165 00166 _____________________________________________________________________ */ 00167 00168 CMError CWMatchBitmapPlane( CMWorldRef Storage, 00169 LH_CMBitmapPlane* bitMap, 00170 CMBitmapCallBackUPP progressProc, 00171 void* refCon, 00172 LH_CMBitmapPlane* matchedBitMap) 00173 00174 { 00175 CMError err = noErr; 00176 CMMModelPtr aPtr; 00177 00178 if( Storage == 0 )return cmparamErr; 00179 LOCK_DATA( Storage ); 00180 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00181 err = LHMatchBitMapPlanePrivate( aPtr, 00182 (const LH_CMBitmapPlane*)bitMap, 00183 progressProc, 00184 refCon, 00185 matchedBitMap ); 00186 UNLOCK_DATA( Storage ); 00187 return err; 00188 } 00189 00190 /* ______________________________________________________________________ 00191 00192 CMError CWCheckBitmapPlane( CMWorldRef Storage, 00193 LH_CMBitmapPlane* bitMap, 00194 CMBitmapCallBackUPP progressProc, 00195 void* refCon, 00196 LH_CMBitmapPlane* CheckedBitMap) 00197 00198 Abstract: 00199 Check pixel data of LH_CMBitmapPlane according to the CMProfileRef parameters 00200 supplied to a previous call to CMMInitPrivate(�), CWNewColorWorld(...), 00201 CMMConcatInitPrivate(�) or CWConcatColorWorld(...). 00202 00203 Params: 00204 storage (in) Reference to ColorWorld storage. 00205 bitMap (in/out) Describes source BitMap data. 00206 progressProc (in) Client function which is called once 00207 per row of the BitMap. If the 00208 function result is TRUE then the 00209 operation is aborted. May be NULL. 00210 refCon (in) Client data which is passed as a 00211 parameter to calls to progressProc. 00212 CheckedBitMap (in/out) Result Checked BitMap. The caller 00213 is responsible for allocating the 00214 pixel buffer pointed to by baseAddr. 00215 If NULL then the source BitMap is 00216 Checked in place. 00217 00218 Return: 00219 noErr successful 00220 System or result code if an error occurs. 00221 00222 _____________________________________________________________________ */ 00223 00224 CMError CWCheckBitmapPlane( CMWorldRef Storage, 00225 LH_CMBitmapPlane* bitMap, 00226 CMBitmapCallBackUPP progressProc, 00227 void* refCon, 00228 LH_CMBitmapPlane* CheckedBitMap) 00229 00230 { 00231 Storage=Storage; 00232 bitMap=bitMap; 00233 progressProc=progressProc; 00234 refCon=refCon; 00235 CheckedBitMap=CheckedBitMap; 00236 return cmparamErr; 00237 /*CMError err = noErr; 00238 CMMModelPtr aPtr; 00239 00240 if( Storage == 0 )return cmparamErr; 00241 LOCK_DATA( Storage ); 00242 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00243 err = LHMatchBitMapPlanePrivate( aPtr, 00244 (const LH_CMBitmapPlane*)bitMap, 00245 progressProc, 00246 refCon, 00247 CheckedBitMap ); 00248 UNLOCK_DATA( Storage ); 00249 return err;*/ 00250 } 00251 00252 /*--------------------------------------------------------------------------------- 00253 CMError CWMatchColors( CMWorldRef Storage, 00254 CMColor *myColors, 00255 unsigned long count ) 00256 00257 Abstract: 00258 Color-matching on a list of CMColor. The source and destination 00259 data types are specified by the CMProfileRef parameters to the 00260 previous call to the CMMInitPrivate(�), CWNewColorWorld(...), 00261 CMMConcatInitPrivate(�) or CWConcatColorWorld(...) function. 00262 00263 Params: 00264 storage (in) Reference to ColorWorld storage. 00265 myColors (in/out) Array of CMColor. 00266 count (in) One-based count of elements in array. 00267 00268 Return: 00269 noErr successful 00270 System or result code if an error occurs. 00271 00272 _____________________________________________________________________ */ 00273 CMError CWMatchColors( CMWorldRef Storage, 00274 CMColor *myColors, 00275 unsigned long count ) 00276 00277 { 00278 CMError err = noErr; 00279 CMMModelPtr aPtr; 00280 00281 if( Storage == 0 )return cmparamErr; 00282 LOCK_DATA( Storage ); 00283 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00284 err = LHMatchColorsPrivate( aPtr, myColors, count ); 00285 UNLOCK_DATA( Storage ); 00286 return err; 00287 } 00288 00289 /* ______________________________________________________________________ 00290 00291 CMError CWCheckColorsMS ( 00292 CMWorldRef Storage, 00293 CMColor *myColors, 00294 unsigned long count, 00295 long *result ) 00296 00297 Abstract: 00298 Gamut test a list of CMColor. The source and destination are 00299 specified by the CMProfileRef parameters to the previous call to 00300 the CMMInitPrivate(�), CWNewColorWorld(...), 00301 CMMConcatInitPrivate(�) or CWConcatColorWorld(...) function. 00302 00303 Params: 00304 storage (in) Reference to ColorWorld storage. 00305 myColors (in) Array of CMColor. 00306 count (in) One-based count of elements in array. 00307 result (in/out) Bits in array are set to 1 if the corresponding color is out of gamut. 00308 00309 Return: 00310 noErr successful 00311 System or result code if an error occurs. 00312 00313 _____________________________________________________________________ */ 00314 00315 00316 CMError CWCheckColorsMS ( 00317 CMWorldRef Storage, 00318 CMColor *myColors, 00319 unsigned long count, 00320 UINT8 *result ) 00321 { 00322 CMError err = noErr; 00323 CMMModelPtr aPtr; 00324 00325 if( Storage == 0 )return cmparamErr; 00326 LOCK_DATA( Storage ); 00327 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00328 err = LHCheckColorsPrivateMS( aPtr, myColors, count, result ); 00329 UNLOCK_DATA( Storage ); 00330 return err; 00331 } 00332 /* ______________________________________________________________________ 00333 00334 CMError CWCheckColors ( 00335 CMWorldRef Storage, 00336 CMColor *myColors, 00337 unsigned long count, 00338 unsigned char *result ) 00339 00340 Abstract: 00341 Gamut test a list of CMColor. The source and destination are 00342 specified by the CMProfileRef parameters to the previous call to 00343 the CMMInitPrivate(�), CWNewColorWorld(...), 00344 CMMConcatInitPrivate(�) or CWConcatColorWorld(...) function. 00345 00346 Params: 00347 storage (in) Reference to ColorWorld storage. 00348 myColors (in) Array of CMColor. 00349 count (in) One-based count of elements in array. 00350 result (in/out) Bits in array are set to 1 if the corresponding color is out of gamut. 00351 00352 Return: 00353 noErr successful 00354 System or result code if an error occurs. 00355 00356 _____________________________________________________________________ */ 00357 00358 00359 CMError CWCheckColors ( 00360 CMWorldRef Storage, 00361 CMColor *myColors, 00362 unsigned long count, 00363 unsigned char *result ) 00364 { 00365 CMError err = noErr; 00366 CMMModelPtr aPtr; 00367 00368 if( Storage == 0 )return cmparamErr; 00369 LOCK_DATA( Storage ); 00370 aPtr = (CMMModelPtr)(DATA_2_PTR( Storage )); 00371 err = LHCheckColorsPrivate( aPtr, myColors, count, result ); 00372 UNLOCK_DATA( Storage ); 00373 return err; 00374 } 00375 /* ______________________________________________________________________ 00376 00377 CMError CWGetColorSpaces( CMWorldRef cw, 00378 CMBitmapColorSpace *In, 00379 CMBitmapColorSpace *Out ); 00380 00381 Abstract: 00382 Get input and output colorspace out of CMWorldRef. 00383 00384 Params: 00385 cw (in) Reference to ColorWorld storage. 00386 In (Out) Reference to input CMBitmapColorSpace. 00387 In (Out) Reference to output CMBitmapColorSpace. 00388 00389 Return: 00390 noErr successful 00391 System or result code if an error occurs. 00392 00393 _____________________________________________________________________ */ 00394 00395 CMError CWGetColorSpaces( CMWorldRef cw, 00396 CMBitmapColorSpace *In, 00397 CMBitmapColorSpace *Out ) 00398 00399 { 00400 CMError err = noErr; 00401 CMMModelPtr aPtr; 00402 00403 if( cw == 0 )return cmparamErr; 00404 LOCK_DATA( cw ); 00405 aPtr = (CMMModelPtr)(DATA_2_PTR( cw )); 00406 *In = aPtr->firstColorSpace; 00407 *Out = aPtr->lastColorSpace; 00408 UNLOCK_DATA( cw ); 00409 return err; 00410 } 00411