test: dec97/test/getcsa.h File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# getcsa.h File Reference

Go to the source code of this file.

## Functions

BOOL EXTERN | GetPS2ColorSpaceArray (CHANDLE cp, DWORD InputIntent, DWORD InpDrvClrSp, MEMPTR lpBuffer, LPDWORD lpcbSize, BOOL AllowBinary)
BOOL | GetPS2CSA_DEFG_Intent (CHANDLE cp, MEMPTR lpBuffer, LPDWORD lpcbSize, DWORD InpDrvClrSp, CSIG Intent, int Type, BOOL AllowBinary)
BOOL | GetPS2CSA_ABC (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, DWORD InpDrvClrSp, BOOL AllowBinary)
BOOL | GetPS2CSA_ABC_LAB (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, DWORD InpDrvClrSp, BOOL AllowBinary)
SINT | GetPublicArrayName (CHANDLE cp, CSIG IntentSig, MEMPTR PublicArrayName)
SINT | CreateInputArray (MEMPTR lpMem, SINT nInputCh, SINT nInputTable, MEMPTR Intent, CSIG Tag, MEMPTR Buff, BOOL AllowBinary)
SINT | CreateOutputArray (MEMPTR lpMem, SINT nOutputCh, SINT nOutputTable, SINT Offset, MEMPTR Intent, CSIG Tag, MEMPTR Buff, BOOL AllowBinary)

## Function Documentation

SINT CreateInputArray | ( | MEMPTR | lpMem,
|  | SINT | nInputCh,
|  | SINT | nInputTable,
|  | MEMPTR | Intent,
|  | CSIG | Tag,
|  | MEMPTR | Buff,
|  | BOOL | AllowBinary
| ) |

SINT CreateOutputArray | ( | MEMPTR | lpMem,
|  | SINT | nOutputCh,
|  | SINT | nOutputTable,
|  | SINT | Offset,
|  | MEMPTR | Intent,
|  | CSIG | Tag,
|  | MEMPTR | Buff,
|  | BOOL | AllowBinary
| ) |

BOOL EXTERN GetPS2ColorSpaceArray | ( | CHANDLE | cp,
|  | DWORD | InputIntent,
|  | DWORD | InpDrvClrSp,
|  | MEMPTR | lpBuffer,
|  | LPDWORD | lpcbSize,
|  | BOOL | AllowBinary
| ) |

Definition at line 1579 of file aug98/dll32/getcsa.c.

    01586 {
    01587     CSIG ColorSpace, Intent;
    01588     BOOL Success = FALSE;
    01589     DWORD dwSaveSize;
    01590     if (!cp)
    01591         return Success;
    01592
    01593     if (!GetCPDevSpace (cp, (LPCSIG) & ColorSpace) ||
    01594         !GetCPRenderIntent (cp, (LPCSIG) & Intent))
    01595     {
    01596         return Success;
    01597     }
    01598     dwSaveSize = *lpcbSize;
    01599     if (InputIntent == icUseRenderingIntent)
    01600         InputIntent = (DWORD)Intent;
    01601
    01602  // Get ColorSpace from Profile.
    01603     if ((CSIG) InputIntent == Intent)
    01604     {
    01605         Success = GetCSAFromProfile (cp, lpBuffer, lpcbSize,
    01606                                      InpDrvClrSp, ColorSpace, AllowBinary);
    01607     }
    01608     if (!Success)
    01609     {
    01610         switch (ColorSpace)
    01611         {
    01612             case icSigRgbData:
    01613                 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize,
    01614                                                  InpDrvClrSp, (CSIG) InputIntent,
    01615                                                  TYPE_CIEBASEDDEF, AllowBinary);
    01616                 if (Success)
    01617                 {                       // Create CieBasedABC or DeviceRGB
    01618                                         // for the printer
    01619                                         // which does not support CieBasedDEF(G).
    01620                     DWORD cbNewSize = 0;
    01621                     MEMPTR lpNewBuffer;
    01622                     MEMPTR lpOldBuffer;
    01623                     if (lpBuffer)
    01624                     {
    01625                         lpNewBuffer = lpBuffer + *lpcbSize;
    01626                         lpOldBuffer = lpNewBuffer;
    01627                         lpNewBuffer += WriteObject (lpNewBuffer, NewLine);
    01628                         cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer);
    01629                     } else
    01630                         lpNewBuffer = NULL;
    01631
    01632                     if (!GetPS2CSA_ABC (cp, lpNewBuffer, &cbNewSize,
    01633                                         (CSIG)InputIntent, InpDrvClrSp,
    01634                                         AllowBinary, 1))   // create a backup CSA
    01635                         GetDeviceRGB (lpNewBuffer, &cbNewSize, InpDrvClrSp, 1);
    01636
    01637                     if (lpBuffer)
    01638                     {
    01639                         lpNewBuffer += cbNewSize;
    01640                         *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer);
    01641                     } else
    01642                         *lpcbSize += cbNewSize;
    01643
    01644                 }
    01645                 if (!Success)
    01646                 {                           // Create CieBasedABC
    01647                     Success = GetPS2CSA_ABC (cp, lpBuffer, lpcbSize,
    01648                                          (CSIG)InputIntent, InpDrvClrSp,
    01649                                          AllowBinary, 0);
    01650                 }
    01651                 if (!Success)
    01652                 {                           // Create DeviceRGB
    01653                     Success = GetDeviceRGB (lpBuffer, lpcbSize, InpDrvClrSp, 0);
    01654                     Success = FALSE;
    01655                 }
    01656                 break;
    01657             case icSigCmykData:
    01658                 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize,
    01659                                                  InpDrvClrSp, (CSIG) InputIntent,
    01660                                                  TYPE_CIEBASEDDEFG, AllowBinary);
    01661                 if (Success)
    01662                 {                       // Create DeviceCMYK for the printer
    01663                                         // which does not support CieBasedDEF(G).
    01664                     DWORD cbNewSize = 0;
    01665                     MEMPTR lpNewBuffer;
    01666                     MEMPTR lpOldBuffer;
    01667                     if (lpBuffer)
    01668                     {
    01669                         lpNewBuffer = lpBuffer + *lpcbSize;
    01670                         lpOldBuffer = lpNewBuffer;
    01671                         lpNewBuffer += WriteObject (lpNewBuffer, NewLine);
    01672                         lpNewBuffer += WriteNewLineObject (lpNewBuffer, NotSupportDEFG_S);
    01673                         cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer);
    01674                     } else
    01675                         lpNewBuffer = NULL;
    01676
    01677                     GetDeviceCMYK (lpNewBuffer, &cbNewSize, InpDrvClrSp);
    01678
    01679                     if (lpBuffer)
    01680                     {
    01681                         lpNewBuffer += cbNewSize;
    01682                         lpNewBuffer += WriteNewLineObject (lpNewBuffer, SupportDEFG_E);
    01683                         *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer);
    01684                     } else
    01685                         *lpcbSize += cbNewSize;
    01686                 }
    01687                 if (!Success)
    01688                 {                           // Create DeviceCMYK
    01689                     Success = GetDeviceCMYK (lpBuffer, lpcbSize, InpDrvClrSp);
    01690                     Success = FALSE;
    01691                 }
    01692                 break;
    01693             case icSigGrayData:
    01694                 Success = GetPS2CSA_MONO (cp, lpBuffer, lpcbSize, InpDrvClrSp,
    01695                                           (CSIG)InputIntent, AllowBinary);
    01696                 if (!Success)
    01697                 {                           // Create DeviceGray
    01698                     Success = GetDeviceGray (lpBuffer, lpcbSize, InpDrvClrSp);
    01699                     Success = FALSE;
    01700                 }
    01701                 break;
    01702             case icSigLabData:
    01703                 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize,
    01704                                                  InpDrvClrSp, (CSIG) InputIntent,
    01705                                                  TYPE_CIEBASEDDEF, AllowBinary);
    01706                 if (Success)
    01707                 {                       // Create CieBasedABC or DeviceRGB
    01708                                         // for the printer
    01709                                         // which does not support CieBasedDEF(G).
    01710                     DWORD cbNewSize = 0;
    01711                     MEMPTR lpNewBuffer;
    01712                     MEMPTR lpOldBuffer;
    01713                     if (lpBuffer)
    01714                     {
    01715                         lpNewBuffer = lpBuffer + *lpcbSize;
    01716                         lpOldBuffer = lpNewBuffer;
    01717                         lpNewBuffer += WriteObject (lpNewBuffer, NewLine);
    01718                         lpNewBuffer += WriteNewLineObject (lpNewBuffer, NotSupportDEFG_S);
    01719                         cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer);
    01720                     } else
    01721                         lpNewBuffer = NULL;
    01722
    01723                     GetPS2CSA_ABC_LAB (cp, lpNewBuffer, &cbNewSize,
    01724                                         (CSIG)InputIntent, InpDrvClrSp, AllowBinary);
    01725
    01726                     if (lpBuffer)
    01727                     {
    01728                         lpNewBuffer += cbNewSize;
    01729                         lpNewBuffer += WriteNewLineObject (lpNewBuffer, SupportDEFG_E);
    01730                         *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer);
    01731                     } else
    01732                         *lpcbSize += cbNewSize;
    01733                 }
    01734                 if (!Success)
    01735                 {                           // Create CieBasedABC
    01736                     Success = GetPS2CSA_ABC_LAB (cp, lpBuffer, lpcbSize,
    01737                                          (CSIG)InputIntent, InpDrvClrSp, AllowBinary);
    01738                 }
    01739                 break;
    01740
    01741             default:
    01742                 break;
    01743         }
    01744     }
    01745     return Success;
    01746 }

BOOL GetPS2CSA_ABC | ( | CHANDLE | cp,
|  | MEMPTR | lpMem,
|  | LPDWORD | lpcbSize,
|  | CSIG | InputIntent,
|  | DWORD | InpDrvClrSp,
|  | BOOL | AllowBinary
| ) |

Definition at line 634 of file dec97/dll32/getcsa.c.

    00636 {
    00637     CSIG PCS, Dev;
    00638     SFLOAT IlluminantWP[3];
    00639     SFLOAT MediaWP[3];
    00640
    00641     SINT i;
    00642     MEMPTR lpOldMem = lpMem;
    00643     SINT Ret = 0;
    00644  // Check if we can generate the CS.
    00645  // Required  tags are: red, green and blue Colorants.
    00646  // As for TRC tags - we are quite flexible here - if we cannot find the
    00647  // required tag - we assume the linear responce
    00648     if (!GetCPConnSpace (cp, (LPCSIG) & PCS) ||
    00649         !GetCPDevSpace (cp, (LPCSIG) & Dev) ||
    00650         (Dev != icSigRgbData) ||
    00651         !DoesCPTagExist (cp, icSigRedColorantTag) ||
    00652         !DoesCPTagExist (cp, icSigGreenColorantTag) ||
    00653         !DoesCPTagExist (cp, icSigBlueColorantTag) ||
    00654         !DoesCPTagExist (cp, icSigRedTRCTag) ||
    00655         !DoesCPTagExist (cp, icSigGreenTRCTag) ||
    00656         !DoesCPTagExist (cp, icSigBlueTRCTag))
    00657     {
    00658         return (FALSE);
    00659     }
    00660     if ((InpDrvClrSp != icSigRgbData) &&
    00661         (InpDrvClrSp != icSigDefData) &&
    00662         (InpDrvClrSp != 0))
    00663     {
    00664         return (FALSE);
    00665     }
    00666  // Estimate the memory size required to hold CS
    00667
    00668     if (lpMem == NULL)                  // This is a size request
    00669     {
    00670         *lpcbSize = 65530;
    00671         return (TRUE);
    00672     }
    00673  // Get info about Illuminant White Point from the header
    00674     GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP);     // .. Illuminant
    00675
    00676  // Support absolute whitePoint
    00677     GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP);
    00678
    00679  //*********** Creating global data
    00680     lpMem += WriteObject (lpMem, NewLine);
    00681     lpMem += WriteObject (lpMem, CieBasedABCBegin);
    00682
    00683     lpMem += EnableGlobalDict(lpMem);
    00684
    00685     lpMem += CreateColSpArray (cp, lpMem, icSigRedTRCTag, AllowBinary);
    00686     lpMem += CreateColSpArray (cp, lpMem, icSigGreenTRCTag, AllowBinary);
    00687     lpMem += CreateColSpArray (cp, lpMem, icSigBlueTRCTag, AllowBinary);
    00688
    00689     lpMem += WriteObject (lpMem, NewLine);
    00690     lpMem += WriteObject (lpMem, SetGlobalOp);
    00691     lpMem += WriteObject (lpMem, EndOp);
    00692
    00693
    00694  //*********** Start creating the ColorSpace
    00695     lpMem += WriteObject (lpMem, NewLine);
    00696     lpMem += WriteObject (lpMem, BeginArray);   // Begin array
    00697  //********** /CIEBasedABC
    00698     lpMem += WriteObject (lpMem, CIEBasedABCTag);   // Create entry
    00699     lpMem += WriteObject (lpMem, BeginDict);    // Begin dictionary
    00700
    00701  //********** Black/White Point
    00702     lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP);
    00703
    00704  //********** /DecodeABC
    00705     lpMem += WriteObject (lpMem, NewLine);
    00706     lpMem += WriteObject (lpMem, DecodeABCTag);
    00707     lpMem += WriteObject (lpMem, BeginArray);
    00708
    00709     lpMem += WriteObject (lpMem, NewLine);
    00710     lpMem += CreateColSpProc (cp, lpMem, icSigRedTRCTag, AllowBinary);
    00711     lpMem += WriteObject (lpMem, NewLine);
    00712     lpMem += CreateColSpProc (cp, lpMem, icSigGreenTRCTag, AllowBinary);
    00713     lpMem += WriteObject (lpMem, NewLine);
    00714     lpMem += CreateColSpProc (cp, lpMem, icSigBlueTRCTag, AllowBinary);
    00715     lpMem += WriteObject (lpMem, EndArray);
    00716
    00717  //********** /MatrixABC
    00718     lpMem += WriteObject (lpMem, NewLine);
    00719     lpMem += WriteObject (lpMem, MatrixABCTag);
    00720     lpMem += WriteObject (lpMem, BeginArray);
    00721
    00722     lpMem += CreateFloatString (cp, lpMem, icSigRedColorantTag);
    00723     lpMem += CreateFloatString (cp, lpMem, icSigGreenColorantTag);
    00724     lpMem += CreateFloatString (cp, lpMem, icSigBlueColorantTag);
    00725
    00726     lpMem += WriteObject (lpMem, EndArray);
    00727
    00728  //********** /RangeLMN
    00729     lpMem += WriteObject (lpMem, NewLine);
    00730     lpMem += WriteObject (lpMem, RangeLMNTag);
    00731     lpMem += WriteObject (lpMem, RangeLMN);
    00732
    00733  //********** /DecodeLMN
    00734     if (InputIntent == icAbsoluteColorimetric)
    00735     {
    00736         // Support absolute whitePoint
    00737         lpMem += WriteObject (lpMem, NewLine);
    00738         lpMem += WriteObject (lpMem, DecodeLMNTag);
    00739         lpMem += WriteObject (lpMem, BeginArray);
    00740         for (i = 0; i < 3; i ++)
    00741         {
    00742             lpMem += WriteObject (lpMem, BeginFunction);
    00743             lpMem += WriteFloat (lpMem, (double)MediaWP[i]/IlluminantWP[i]);
    00744             lpMem += WriteObject (lpMem, MulOp);
    00745             lpMem += WriteObject (lpMem, EndFunction);
    00746         }
    00747         lpMem += WriteObject (lpMem, EndArray);
    00748     }
    00749
    00750  //********** End dictionary definition
    00751     lpMem += WriteObject (lpMem, NewLine);
    00752     lpMem += WriteObject (lpMem, EndDict);
    00753     lpMem += WriteObject (lpMem, EndArray);
    00754
    00755     lpMem += WriteObject (lpMem, NewLine);
    00756     lpMem += WriteObject (lpMem, CieBasedABCEnd);
    00757     *lpcbSize = (DWORD) ((lpMem - lpOldMem));
    00758     return (TRUE);
    00759 }

BOOL GetPS2CSA_ABC_LAB | ( | CHANDLE | cp,
|  | MEMPTR | lpMem,
|  | LPDWORD | lpcbSize,
|  | CSIG | InputIntent,
|  | DWORD | InpDrvClrSp,
|  | BOOL | AllowBinary
| ) |

Definition at line 812 of file aug98/dll32/getcsa.c.

    00814 {
    00815     CSIG PCS, Dev;
    00816     SFLOAT IlluminantWP[3];
    00817     SFLOAT MediaWP[3];
    00818
    00819     SINT i;
    00820     MEMPTR lpOldMem = lpMem;
    00821     SINT Ret = 0;
    00822  // Check if we can generate the CS.
    00823  // Required  tags are: red, green and blue Colorants.
    00824  // As for TRC tags - we are quite flexible here - if we cannot find the
    00825  // required tag - we assume the linear responce
    00826     if (!GetCPConnSpace (cp, (LPCSIG) & PCS) ||
    00827         !GetCPDevSpace (cp, (LPCSIG) & Dev) ||
    00828         (Dev != icSigLabData))
    00829     {
    00830         return (FALSE);
    00831     }
    00832     if ((InpDrvClrSp != icSigLabData) &&
    00833         (InpDrvClrSp != icSigDefData) &&
    00834         (InpDrvClrSp != 0))
    00835     {
    00836         return (FALSE);
    00837     }
    00838  // Estimate the memory size required to hold CS
    00839
    00840     if (lpMem == NULL)                  // This is a size request
    00841     {
    00842         *lpcbSize = 65530;
    00843         return (TRUE);
    00844     }
    00845  // Get info about Illuminant White Point from the header
    00846     GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP);     // .. Illuminant
    00847
    00848  // Support absolute whitePoint
    00849     GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP);
    00850
    00851  //*********** Start creating the ColorSpace
    00852     lpMem += WriteNewLineObject (lpMem, BeginArray);   // Begin array
    00853
    00854  //********** /CIEBasedABC
    00855     lpMem += WriteObject (lpMem, CIEBasedABCTag);   // Create entry
    00856     lpMem += WriteObject (lpMem, BeginDict);    // Begin dictionary
    00857
    00858  //********** Black/White Point
    00859     lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP);
    00860
    00861  //********** /RangeABC
    00862     lpMem += WriteNewLineObject (lpMem, RangeABCTag);
    00863     lpMem += WriteObject (lpMem, RangeABC_Lab);
    00864
    00865  //********** /DecodeABC
    00866     lpMem += WriteNewLineObject (lpMem, DecodeABCTag);
    00867     lpMem += WriteObject (lpMem, DecodeABCLab1);
    00868
    00869  //********** /MatrixABC
    00870     lpMem += WriteNewLineObject (lpMem, MatrixABCTag);
    00871     lpMem += WriteObject (lpMem, MatrixABCLab);
    00872
    00873  //********** /DecodeLMN
    00874     lpMem += WriteNewLineObject (lpMem, DecodeLMNTag);
    00875     lpMem += WriteObject (lpMem, BeginArray);
    00876     for (i = 0; i < 3; i ++)
    00877     {
    00878         lpMem += WriteObject (lpMem, BeginFunction);
    00879         lpMem += WriteObject (lpMem, DecodeLMNLab);
    00880         if (InputIntent == icAbsoluteColorimetric)
    00881         {
    00882             lpMem += WriteFloat (lpMem, (double) MediaWP[i]);
    00883         }
    00884         else
    00885         {
    00886             lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]);
    00887         }
    00888         lpMem += WriteObject (lpMem, MulOp);
    00889         lpMem += WriteObject (lpMem, EndFunction);
    00890         lpMem += WriteObject (lpMem, NewLine);
    00891     }
    00892     lpMem += WriteObject (lpMem, EndArray);
    00893
    00894
    00895  //********** End dictionary definition
    00896     lpMem += WriteNewLineObject (lpMem, EndDict);
    00897     lpMem += WriteObject (lpMem, EndArray);
    00898
    00899     lpMem += WriteNewLineObject (lpMem, CieBasedABCEnd);
    00900     *lpcbSize = (DWORD) ((lpMem - lpOldMem));
    00901     return (TRUE);
    00902 }

BOOL GetPS2CSA_DEFG_Intent | ( | CHANDLE | cp,
|  | MEMPTR | lpBuffer,
|  | LPDWORD | lpcbSize,
|  | DWORD | InpDrvClrSp,
|  | CSIG | Intent,
|  | int | Type,
|  | BOOL | AllowBinary
| ) |

Definition at line 1502 of file aug98/dll32/getcsa.c.

    01510 {
    01511     SINT Index;
    01512     BOOL Success = FALSE;
    01513     CSIG icSigAToBx;
    01514
    01515  // Try to create CieBasedDEFG CSA first.
    01516     if (((Type == TYPE_CIEBASEDDEFG) && (InpDrvClrSp != icSigCmykData) ||
    01517          (Type == TYPE_CIEBASEDDEF) && (InpDrvClrSp != icSigDefData)) &&
    01518         (InpDrvClrSp != 0))
    01519     {
    01520         return (FALSE);
    01521     }
    01522     switch (Intent)
    01523     {
    01524         case icPerceptual:
    01525             icSigAToBx = icSigAToB0Tag;
    01526             break;
    01527         case icRelativeColorimetric:
    01528             icSigAToBx = icSigAToB1Tag;
    01529             break;
    01530         case icSaturation:
    01531             icSigAToBx = icSigAToB2Tag;
    01532             break;
    01533         case icAbsoluteColorimetric:
    01534             icSigAToBx = icSigAToB1Tag;
    01535             break;
    01536         default:
    01537             return Success;
    01538     }
    01539
    01540     if (DoesCPTagExist (cp, icSigAToBx) &&
    01541         GetCPTagIndex (cp, icSigAToBx, (LPSINT) & Index))
    01542     {
    01543         Success = GetPS2CSA_DEFG (cp, lpBuffer, lpcbSize, Intent, Index, Type, AllowBinary);
    01544     }
    01545
    01546     return Success;
    01547 }

SINT GetPublicArrayName | ( | CHANDLE | cp,
|  | CSIG | IntentSig,
|  | MEMPTR | PublicArrayName
| ) |

Definition at line 154 of file aug98/dll32/getcsa.c.

    00155 {
    00156     MEMPTR OldPtr;
    00157     OldPtr = PublicArrayName;
    00158     PublicArrayName[0] = 0;
    00159     MemCopy (PublicArrayName, (MEMPTR) & IntentSig, sizeof (CSIG));
    00160     PublicArrayName += sizeof (CSIG);
    00161     PublicArrayName[0] = 0;
    00162     return (PublicArrayName - OldPtr);
    00163 }