home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / icm.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  30.1 KB  |  911 lines

  1. /*++
  2.  
  3. Copyright (c) 1996-1999 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     icm.h
  8.  
  9. Abstract:
  10.  
  11.     Public header file for Image Color Management
  12.  
  13. Revision History:
  14.  
  15. --*/
  16.  
  17. #ifndef _ICM_H_
  18. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  19. #define _ICM_H_
  20.  
  21. #if _MSC_VER > 1000
  22. #pragma once
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. //
  30. // Support for named color profiles
  31. //
  32.  
  33. typedef char COLOR_NAME[32];
  34. typedef COLOR_NAME *PCOLOR_NAME, *LPCOLOR_NAME;
  35.  
  36. typedef struct tagNAMED_PROFILE_INFO{
  37.     DWORD        dwFlags;
  38.     DWORD        dwCount;
  39.     DWORD        dwCountDevCoordinates;
  40.     COLOR_NAME    szPrefix;
  41.     COLOR_NAME    szSuffix;
  42. }NAMED_PROFILE_INFO;
  43. typedef NAMED_PROFILE_INFO *PNAMED_PROFILE_INFO, *LPNAMED_PROFILE_INFO;
  44.  
  45.  
  46. //
  47. // Color spaces
  48. //
  49. // The following color spaces are supported.
  50. // Gray, RGB, CMYK, XYZ, Yxy, Lab, generic 3 channel color spaces where
  51. // the profiles defines how to interpret the 3 channels, named color spaces
  52. // which can either be indices into the space or have color names, and
  53. // multichannel spaces with 1 byte per channel upto MAX_COLOR_CHANNELS.
  54. //
  55.  
  56. #define MAX_COLOR_CHANNELS  8   // maximum number of HiFi color channels
  57.  
  58. struct GRAYCOLOR {
  59.     WORD    gray;
  60. };
  61.  
  62. struct RGBCOLOR {
  63.     WORD    red;
  64.     WORD    green;
  65.     WORD    blue;
  66. };
  67.  
  68. struct CMYKCOLOR {
  69.     WORD    cyan;
  70.     WORD    magenta;
  71.     WORD    yellow;
  72.     WORD    black;
  73. };
  74.  
  75. struct XYZCOLOR {
  76.     WORD    X;
  77.     WORD    Y;
  78.     WORD    Z;
  79. };
  80.  
  81. struct YxyCOLOR {
  82.     WORD    Y;
  83.     WORD    x;
  84.     WORD    y;
  85. };
  86.  
  87. struct LabCOLOR {
  88.     WORD    L;
  89.     WORD    a;
  90.     WORD    b;
  91. };
  92.  
  93. struct GENERIC3CHANNEL {
  94.     WORD    ch1;
  95.     WORD    ch2;
  96.     WORD    ch3;
  97. };
  98.  
  99. struct NAMEDCOLOR {
  100.     DWORD        dwIndex;
  101. };
  102.  
  103. struct HiFiCOLOR {
  104.     BYTE    channel[MAX_COLOR_CHANNELS];
  105. };
  106.  
  107.  
  108. typedef union tagCOLOR {
  109.     struct GRAYCOLOR        gray;
  110.     struct RGBCOLOR         rgb;
  111.     struct CMYKCOLOR        cmyk;
  112.     struct XYZCOLOR         XYZ;
  113.     struct YxyCOLOR         Yxy;
  114.     struct LabCOLOR         Lab;
  115.     struct GENERIC3CHANNEL  gen3ch;
  116.     struct NAMEDCOLOR       named;
  117.     struct HiFiCOLOR        hifi;
  118. } COLOR;
  119. typedef COLOR *PCOLOR, *LPCOLOR;
  120.  
  121. typedef enum {
  122.     COLOR_GRAY       =   1,
  123.     COLOR_RGB,
  124.     COLOR_XYZ,
  125.     COLOR_Yxy,
  126.     COLOR_Lab,
  127.     COLOR_3_CHANNEL,        // WORD per channel
  128.     COLOR_CMYK,
  129.     COLOR_5_CHANNEL,        // BYTE per channel
  130.     COLOR_6_CHANNEL,        //      - do -
  131.     COLOR_7_CHANNEL,        //      - do -
  132.     COLOR_8_CHANNEL,        //      - do -
  133.     COLOR_NAMED,
  134. } COLORTYPE;
  135. typedef COLORTYPE *PCOLORTYPE, *LPCOLORTYPE;
  136.  
  137. //
  138. // Bitmap formats supported
  139. //
  140.  
  141. typedef enum {
  142.  
  143.     //
  144.     // 16bpp - 5 bits per channel. The most significant bit is ignored.
  145.     //
  146.  
  147.     BM_x555RGB      = 0x0000,
  148.     BM_x555XYZ      = 0x0101,
  149.     BM_x555Yxy,
  150.     BM_x555Lab,
  151.     BM_x555G3CH,
  152.  
  153.     //
  154.     // Packed 8 bits per channel => 8bpp for GRAY and
  155.     // 24bpp for the 3 channel colors, more for hifi channels
  156.     //
  157.  
  158.     BM_RGBTRIPLETS  = 0x0002,
  159.     BM_BGRTRIPLETS  = 0x0004,
  160.     BM_XYZTRIPLETS  = 0x0201,
  161.     BM_YxyTRIPLETS,
  162.     BM_LabTRIPLETS,
  163.     BM_G3CHTRIPLETS,
  164.     BM_5CHANNEL,
  165.     BM_6CHANNEL,
  166.     BM_7CHANNEL,
  167.     BM_8CHANNEL,
  168.     BM_GRAY,
  169.  
  170.     //
  171.     // 32bpp - 8 bits per channel. The most significant byte is ignored
  172.     // for the 3 channel colors.
  173.     //
  174.  
  175.     BM_xRGBQUADS    = 0x0008,
  176.     BM_xBGRQUADS    = 0x0010,
  177.     BM_xG3CHQUADS   = 0x0304,
  178.     BM_KYMCQUADS,
  179.     BM_CMYKQUADS    = 0x0020,
  180.  
  181.     //
  182.     // 32bpp - 10 bits per channel. The 2 most significant bits are ignored.
  183.     //
  184.  
  185.     BM_10b_RGB      = 0x0009,
  186.     BM_10b_XYZ      = 0x0401,
  187.     BM_10b_Yxy,
  188.     BM_10b_Lab,
  189.     BM_10b_G3CH,
  190.  
  191.     //
  192.     // 32bpp - named color indices (1-based)
  193.     //
  194.  
  195.     BM_NAMED_INDEX,
  196.  
  197.     //
  198.     // Packed 16 bits per channel => 16bpp for GRAY and
  199.     // 48bpp for the 3 channel colors.
  200.     //
  201.  
  202.     BM_16b_RGB      = 0x000A,
  203.     BM_16b_XYZ      = 0x0501,
  204.     BM_16b_Yxy,
  205.     BM_16b_Lab,
  206.     BM_16b_G3CH,
  207.     BM_16b_GRAY,
  208.  
  209.     //
  210.     // 16 bpp - 5 bits for Red & Blue, 6 bits for Green
  211.     //
  212.  
  213.     BM_565RGB       = 0x0001,
  214.  
  215. } BMFORMAT;
  216. typedef BMFORMAT *PBMFORMAT, *LPBMFORMAT;
  217.  
  218. //
  219. // Callback function definition
  220. //
  221.  
  222. typedef BOOL (WINAPI *PBMCALLBACKFN)(ULONG, ULONG, LPARAM);
  223. typedef PBMCALLBACKFN LPBMCALLBACKFN;
  224.  
  225. //
  226. // ICC profile header
  227. //
  228.  
  229. typedef struct tagPROFILEHEADER {
  230.     DWORD   phSize;             // profile size in bytes
  231.     DWORD   phCMMType;          // CMM for this profile
  232.     DWORD   phVersion;          // profile format version number
  233.     DWORD   phClass;            // type of profile
  234.     DWORD   phDataColorSpace;   // color space of data
  235.     DWORD   phConnectionSpace;  // PCS
  236.     DWORD   phDateTime[3];      // date profile was created
  237.     DWORD   phSignature;        // magic number
  238.     DWORD   phPlatform;         // primary platform
  239.     DWORD   phProfileFlags;     // various bit settings
  240.     DWORD   phManufacturer;     // device manufacturer
  241.     DWORD   phModel;            // device model number
  242.     DWORD   phAttributes[2];    // device attributes
  243.     DWORD   phRenderingIntent;  // rendering intent
  244.     CIEXYZ  phIlluminant;       // profile illuminant
  245.     DWORD   phCreator;          // profile creator
  246.     BYTE    phReserved[44];     // reserved for future use
  247. } PROFILEHEADER;
  248. typedef PROFILEHEADER *PPROFILEHEADER, *LPPROFILEHEADER;
  249.  
  250. //
  251. // Profile class values
  252. //
  253.  
  254. #define CLASS_MONITOR           'mntr'
  255. #define CLASS_PRINTER           'prtr'
  256. #define CLASS_SCANNER           'scnr'
  257. #define CLASS_LINK              'link'
  258. #define CLASS_ABSTRACT          'abst'
  259. #define CLASS_COLORSPACE        'spac'
  260. #define CLASS_NAMED             'nmcl'
  261.  
  262. //
  263. // Color space values
  264. //
  265.  
  266. #define SPACE_XYZ               'XYZ '
  267. #define SPACE_Lab               'Lab '
  268. #define SPACE_Luv               'Luv '
  269. #define SPACE_YCbCr             'YCbr'
  270. #define SPACE_Yxy               'Yxy '
  271. #define SPACE_RGB               'RGB '
  272. #define SPACE_GRAY              'GRAY'
  273. #define SPACE_HSV               'HSV '
  274. #define SPACE_HLS               'HLS '
  275. #define SPACE_CMYK              'CMYK'
  276. #define SPACE_CMY               'CMY '
  277. #define SPACE_2_CHANNEL         '2CLR'
  278. #define SPACE_3_CHANNEL         '3CLR'
  279. #define SPACE_4_CHANNEL         '4CLR'
  280. #define SPACE_5_CHANNEL         '5CLR'
  281. #define SPACE_6_CHANNEL         '6CLR'
  282. #define SPACE_7_CHANNEL         '7CLR'
  283. #define SPACE_8_CHANNEL         '8CLR'
  284.  
  285. //
  286. // Profile flag bitfield values
  287. //
  288.  
  289. #define FLAG_EMBEDDEDPROFILE    0x00000001
  290. #define FLAG_DEPENDENTONDATA    0x00000002
  291.  
  292. //
  293. // Profile attributes bitfield values
  294. //
  295.  
  296. #define ATTRIB_TRANSPARENCY     0x00000001
  297. #define ATTRIB_MATTE            0x00000002
  298.  
  299. //
  300. // Rendering Intents
  301. //
  302. // + INTENT_PERCEPTUAL            = LCS_GM_IMAGES for LOGCOLORSPACE
  303. //                                = DMICM_CONTRAST for DEVMODE
  304. //                                = "Pictures" for SetupColorMathing/Printer UI
  305. //
  306. // + INTENT_RELATIVE_COLORIMETRIC = LCS_GM_GRAPHICS for LOGCOLORSPACE
  307. //                                = DMICM_COLORIMETRIC for DEVMODE
  308. //                                = "Proof" for SetupColorMatching/Printer UI
  309. //
  310. // + INTENT_SATURATION            = LCS_GM_BUSINESS for LOGCOLORSPACE
  311. //                                = DMICM_SATURATE for DEVMODE
  312. //                                = "Graphics" for SetupColorMatching/Printer UI
  313. //
  314. // + INTENT_ABSOLUTE_COLORIMETRIC = LCS_GM_ABS_COLORIMETRIC for LOGCOLORSPACE
  315. //                                = DMICM_ABS_COLORIMETRIC for DEVMODE
  316. //                                = "Match" for SetupColorMatching/Printer UI
  317. //
  318.  
  319. #define INTENT_PERCEPTUAL               0
  320. #define INTENT_RELATIVE_COLORIMETRIC    1
  321. #define INTENT_SATURATION               2
  322. #define INTENT_ABSOLUTE_COLORIMETRIC    3
  323.  
  324. //
  325. // Profile data structure
  326. //
  327.  
  328. typedef struct tagPROFILE {
  329.     DWORD   dwType;             // profile type
  330.     PVOID   pProfileData;       // filename or buffer containing profile
  331.     DWORD   cbDataSize;         // size of profile data
  332. } PROFILE;
  333. typedef PROFILE *PPROFILE, *LPPROFILE;
  334.  
  335.  
  336. //
  337. // Profile types to be used in the PROFILE structure
  338. //
  339.  
  340. #define PROFILE_FILENAME    1   // profile data is NULL terminated filename
  341. #define PROFILE_MEMBUFFER   2   // profile data is a buffer containing
  342.                                 // the profile
  343. //
  344. // Desired access mode for opening profiles
  345. //
  346.  
  347. #define PROFILE_READ        1   // opened for read access
  348. #define PROFILE_READWRITE   2   // opened for read and write access
  349.  
  350. //
  351. // Handles returned to applications
  352. //
  353.  
  354. typedef HANDLE HPROFILE;        // handle to profile object
  355. typedef HPROFILE *PHPROFILE;
  356. typedef HANDLE HTRANSFORM;      // handle to color transform object
  357.  
  358. //
  359. // CMM selection for CreateMultiProfileTransform and SelectCMM.
  360. //
  361.  
  362. #define INDEX_DONT_CARE     0
  363.  
  364. #define CMM_FROM_PROFILE    INDEX_DONT_CARE // Use CMM specified in profile.
  365. #define CMM_WINDOWS_DEFAULT 'Win '          // Use Windows default CMM always.
  366.  
  367. //
  368. // Tags found in ICC profiles
  369. //
  370.  
  371. typedef DWORD      TAGTYPE;
  372. typedef TAGTYPE   *PTAGTYPE, *LPTAGTYPE;
  373.  
  374. //
  375. // Profile enumeration data structure
  376. //
  377.  
  378. #define ENUM_TYPE_VERSION    0x0300
  379.  
  380. typedef struct tagENUMTYPEA {
  381.     DWORD   dwSize;             // structure size
  382.     DWORD   dwVersion;          // structure version
  383.     DWORD   dwFields;           // bit fields
  384.     PCSTR   pDeviceName;        // device friendly name
  385.     DWORD   dwMediaType;        // media type
  386.     DWORD   dwDitheringMode;    // dithering mode
  387.     DWORD   dwResolution[2];    // x and y resolutions
  388.     DWORD   dwCMMType;          // cmm ID
  389.     DWORD   dwClass;            // profile class
  390.     DWORD   dwDataColorSpace;   // color space of data
  391.     DWORD   dwConnectionSpace;  // pcs
  392.     DWORD   dwSignature;        // magic number
  393.     DWORD   dwPlatform;         // primary platform
  394.     DWORD   dwProfileFlags;     // various bit settings in profile
  395.     DWORD   dwManufacturer;     // manufacturer ID
  396.     DWORD   dwModel;            // model ID
  397.     DWORD   dwAttributes[2];    // device attributes
  398.     DWORD   dwRenderingIntent;  // rendering intent
  399.     DWORD   dwCreator;          // profile creator
  400.     DWORD   dwDeviceClass;      // device class
  401. } ENUMTYPEA, *PENUMTYPEA, *LPENUMTYPEA;
  402.  
  403.  
  404. typedef struct tagENUMTYPEW {
  405.     DWORD   dwSize;             // structure size
  406.     DWORD   dwVersion;          // structure version
  407.     DWORD   dwFields;           // bit fields
  408.     PCWSTR  pDeviceName;        // device friendly name
  409.     DWORD   dwMediaType;        // media type
  410.     DWORD   dwDitheringMode;    // dithering mode
  411.     DWORD   dwResolution[2];    // x and y resolutions
  412.     DWORD   dwCMMType;          // cmm ID
  413.     DWORD   dwClass;            // profile class
  414.     DWORD   dwDataColorSpace;   // color space of data
  415.     DWORD   dwConnectionSpace;  // pcs
  416.     DWORD   dwSignature;        // magic number
  417.     DWORD   dwPlatform;         // primary platform
  418.     DWORD   dwProfileFlags;     // various bit settings in profile
  419.     DWORD   dwManufacturer;     // manufacturer ID
  420.     DWORD   dwModel;            // model ID
  421.     DWORD   dwAttributes[2];    // device attributes
  422.     DWORD   dwRenderingIntent;  // rendering intent
  423.     DWORD   dwCreator;          // profile creator
  424.     DWORD   dwDeviceClass;      // device class
  425. } ENUMTYPEW, *PENUMTYPEW, *LPENUMTYPEW;
  426.  
  427. //
  428. // Bitfields for enumeration record above
  429. //
  430.  
  431. #define ET_DEVICENAME           0x00000001
  432. #define ET_MEDIATYPE            0x00000002
  433. #define ET_DITHERMODE           0x00000004
  434. #define ET_RESOLUTION           0x00000008
  435. #define ET_CMMTYPE              0x00000010
  436. #define ET_CLASS                0x00000020
  437. #define ET_DATACOLORSPACE       0x00000040
  438. #define ET_CONNECTIONSPACE      0x00000080
  439. #define ET_SIGNATURE            0x00000100
  440. #define ET_PLATFORM             0x00000200
  441. #define ET_PROFILEFLAGS         0x00000400
  442. #define ET_MANUFACTURER         0x00000800
  443. #define ET_MODEL                0x00001000
  444. #define ET_ATTRIBUTES           0x00002000
  445. #define ET_RENDERINGINTENT      0x00004000
  446. #define ET_CREATOR              0x00008000
  447. #define ET_DEVICECLASS          0x00010000
  448.  
  449. //
  450. // Flags for creating color transforms
  451. //
  452.  
  453. #define PROOF_MODE                  0x00000001
  454. #define NORMAL_MODE                 0x00000002
  455. #define BEST_MODE                   0x00000003
  456. #define ENABLE_GAMUT_CHECKING       0x00010000
  457. #define USE_RELATIVE_COLORIMETRIC   0x00020000
  458. #define FAST_TRANSLATE              0x00040000
  459. #define RESERVED                    0x80000000
  460.  
  461. //
  462. // Paremeter for GetPS2ColorSpaceArray
  463. //
  464.  
  465. #define CSA_A                   1
  466. #define CSA_ABC                 2
  467. #define CSA_DEF                 3
  468. #define CSA_DEFG                4
  469. #define CSA_GRAY                5
  470. #define CSA_RGB                 6
  471. #define CSA_CMYK                7
  472. #define CSA_Lab                 8
  473.  
  474. //
  475. // Parameter for CMGetInfo()
  476. //
  477.  
  478. #define CMM_WIN_VERSION     0
  479. #define CMM_IDENT           1
  480. #define CMM_DRIVER_VERSION  2
  481. #define CMM_DLL_VERSION     3
  482. #define CMM_VERSION         4
  483. #define CMM_DESCRIPTION     5
  484. #define CMM_LOGOICON        6
  485.  
  486. //
  487. // Parameter for CMTranslateRGBs()
  488. //
  489.  
  490. #define CMS_FORWARD         0
  491. #define CMS_BACKWARD        1
  492.  
  493. //
  494. //  Constants for SetupColorMatching()
  495. //
  496.  
  497. #define COLOR_MATCH_VERSION  0x0200
  498.  
  499. //
  500. //  Constants for flags
  501. //
  502.  
  503. #define CMS_DISABLEICM          1     // Disable color matching
  504. #define CMS_ENABLEPROOFING      2     // Enable proofing
  505.  
  506. #define CMS_SETRENDERINTENT     4     // Use passed in value
  507. #define CMS_SETPROOFINTENT      8
  508. #define CMS_SETMONITORPROFILE   0x10  // Use passed in profile name initially
  509. #define CMS_SETPRINTERPROFILE   0x20
  510. #define CMS_SETTARGETPROFILE    0x40
  511.  
  512. #define CMS_USEHOOK             0x80  // Use hook procedure in lpfnHook
  513. #define CMS_USEAPPLYCALLBACK    0x100 // Use callback procedure when applied
  514. #define CMS_USEDESCRIPTION      0x200 // Use profile description in UI
  515.                                       //   (default is filename)
  516.  
  517. #define CMS_DISABLEINTENT       0x400 // Disable intent selection (render & proofing) always
  518. #define CMS_DISABLERENDERINTENT 0x800 // Disable rendering intent selection while in proofing mode
  519.                                       // Only proofing intent selection is enabled.
  520.  
  521. //
  522. //  Used to denote too-small buffers (output only)
  523. //
  524.  
  525. #define CMS_MONITOROVERFLOW     0x80000000L
  526. #define CMS_PRINTEROVERFLOW     0x40000000L
  527. #define CMS_TARGETOVERFLOW      0x20000000L
  528.  
  529. //
  530. //  Structures (both ANSI and Unicode)
  531. //
  532. struct _tagCOLORMATCHSETUPW;
  533. struct _tagCOLORMATCHSETUPA;
  534.  
  535. typedef BOOL (WINAPI *PCMSCALLBACKW)(struct _tagCOLORMATCHSETUPW *,LPARAM);
  536. typedef BOOL (WINAPI *PCMSCALLBACKA)(struct _tagCOLORMATCHSETUPA *,LPARAM);
  537.  
  538. typedef struct _tagCOLORMATCHSETUPW {
  539.  
  540.     DWORD   dwSize;                 //  Size of structure in bytes
  541.     DWORD   dwVersion;              //  Set to COLOR_MATCH_VERSION
  542.  
  543.     DWORD   dwFlags;                //  See constants listed previously
  544.     HWND    hwndOwner;              //  Window handle of owner
  545.  
  546.     PCWSTR  pSourceName;            //  Name of Image Source, defaults to "sRGB Color Space"
  547.     PCWSTR  pDisplayName;           //  If null, defaults to first enumerated monitor
  548.     PCWSTR  pPrinterName;           //  If null, defaults to default printer.
  549.  
  550.     DWORD   dwRenderIntent;         //  Rendering Intent
  551.     DWORD   dwProofingIntent;       //  Rendering Intent for Proofing
  552.  
  553.     PWSTR   pMonitorProfile;        //  Monitor profile name
  554.     DWORD   ccMonitorProfile;       //  Size of above in characters
  555.  
  556.     PWSTR   pPrinterProfile;        //  Printer profile name
  557.     DWORD   ccPrinterProfile;       //  Size of above in characters
  558.  
  559.     PWSTR   pTargetProfile;         //  Target profile name
  560.     DWORD   ccTargetProfile;        //  Size of above in characters
  561.  
  562.     DLGPROC lpfnHook;               //  Hook Procedure address
  563.     LPARAM  lParam;                 //  Given to hook procedure at WM_INITDIALOG
  564.  
  565.     PCMSCALLBACKW lpfnApplyCallback;   //  Callback Procedure address when apply is pushed
  566.     LPARAM        lParamApplyCallback; //  Given to callback Procedure for apply
  567.  
  568. }   COLORMATCHSETUPW, *PCOLORMATCHSETUPW, *LPCOLORMATCHSETUPW;
  569.  
  570. typedef struct _tagCOLORMATCHSETUPA {
  571.  
  572.     DWORD   dwSize;                 //  Size of structure in bytes
  573.     DWORD   dwVersion;              //  Set to COLOR_MATCH_VERSION
  574.  
  575.     DWORD   dwFlags;                //  See constants listed previously
  576.     HWND    hwndOwner;              //  Window handle of owner
  577.  
  578.     PCSTR   pSourceName;            //  Name of Image Source, defaults to  "This Document"
  579.     PCSTR   pDisplayName;           //  If null, defaults to first enumerated monitor
  580.     PCSTR   pPrinterName;           //  If null, defaults to default printer.
  581.  
  582.     DWORD   dwRenderIntent;         //  Rendering Intent
  583.     DWORD   dwProofingIntent;       //  Rendering Intent for Proofing
  584.  
  585.     PSTR    pMonitorProfile;        //  Monitor profile name
  586.     DWORD   ccMonitorProfile;       //  Size of above in characters
  587.  
  588.     PSTR    pPrinterProfile;        //  Printer profile name
  589.     DWORD   ccPrinterProfile;       //  Size of above in characters
  590.  
  591.     PSTR    pTargetProfile;         //  Target profile name
  592.     DWORD   ccTargetProfile;        //  Size of above in characters
  593.  
  594.     DLGPROC lpfnHook;               //  Hook Procedure address
  595.     LPARAM  lParam;                 //  Given to hook procedure at WM_INITDIALOG
  596.  
  597.     PCMSCALLBACKA lpfnApplyCallback;   //  Callback Procedure address when apply is pushed
  598.     LPARAM        lParamApplyCallback; //  Given to callback Procedure for apply
  599.  
  600. }   COLORMATCHSETUPA, *PCOLORMATCHSETUPA, *LPCOLORMATCHSETUPA;
  601.  
  602. //
  603. // Windows API definitions
  604. //
  605.  
  606. HPROFILE   WINAPI OpenColorProfileA(PPROFILE, DWORD, DWORD, DWORD);
  607. HPROFILE   WINAPI OpenColorProfileW(PPROFILE, DWORD, DWORD, DWORD);
  608. BOOL       WINAPI CloseColorProfile(HPROFILE);
  609. BOOL       WINAPI GetColorProfileFromHandle(HPROFILE, PBYTE, PDWORD);
  610. BOOL       WINAPI IsColorProfileValid(HPROFILE, PBOOL);
  611. BOOL       WINAPI CreateProfileFromLogColorSpaceA(LPLOGCOLORSPACEA, PBYTE*);
  612. BOOL       WINAPI CreateProfileFromLogColorSpaceW(LPLOGCOLORSPACEW, PBYTE*);
  613. BOOL       WINAPI GetCountColorProfileElements(HPROFILE, PDWORD);
  614. BOOL       WINAPI GetColorProfileHeader(HPROFILE, PPROFILEHEADER);
  615. BOOL       WINAPI GetColorProfileElementTag(HPROFILE, DWORD, PTAGTYPE);
  616. BOOL       WINAPI IsColorProfileTagPresent(HPROFILE, TAGTYPE, PBOOL);
  617. BOOL       WINAPI GetColorProfileElement(HPROFILE, TAGTYPE, DWORD, PDWORD, PVOID, PBOOL);
  618. BOOL       WINAPI SetColorProfileHeader(HPROFILE, PPROFILEHEADER);
  619. BOOL       WINAPI SetColorProfileElementSize(HPROFILE, TAGTYPE, DWORD);
  620. BOOL       WINAPI SetColorProfileElement(HPROFILE, TAGTYPE, DWORD, PDWORD, PVOID);
  621. BOOL       WINAPI SetColorProfileElementReference(HPROFILE, TAGTYPE, TAGTYPE);
  622. BOOL       WINAPI GetPS2ColorSpaceArray (HPROFILE, DWORD, DWORD, PBYTE, PDWORD, PBOOL);
  623. BOOL       WINAPI GetPS2ColorRenderingIntent(HPROFILE, DWORD, PBYTE, PDWORD);
  624. BOOL       WINAPI GetPS2ColorRenderingDictionary(HPROFILE, DWORD, PBYTE, PDWORD, PBOOL);
  625. BOOL       WINAPI GetNamedProfileInfo(HPROFILE, PNAMED_PROFILE_INFO);
  626. BOOL       WINAPI ConvertColorNameToIndex(HPROFILE, PCOLOR_NAME, PDWORD, DWORD);
  627. BOOL       WINAPI ConvertIndexToColorName(HPROFILE, PDWORD, PCOLOR_NAME, DWORD);
  628. BOOL       WINAPI CreateDeviceLinkProfile(PHPROFILE, DWORD, PDWORD, DWORD, DWORD, PBYTE*, DWORD);
  629. HTRANSFORM WINAPI CreateColorTransformA(LPLOGCOLORSPACEA, HPROFILE, HPROFILE, DWORD);
  630. HTRANSFORM WINAPI CreateColorTransformW(LPLOGCOLORSPACEW, HPROFILE, HPROFILE, DWORD);
  631. HTRANSFORM WINAPI CreateMultiProfileTransform(PHPROFILE, DWORD, PDWORD, DWORD, DWORD, DWORD);
  632. BOOL       WINAPI DeleteColorTransform(HTRANSFORM);
  633. BOOL       WINAPI TranslateBitmapBits(HTRANSFORM, PVOID, BMFORMAT, DWORD, DWORD, DWORD, PVOID, BMFORMAT, DWORD, PBMCALLBACKFN, LPARAM);
  634. BOOL       WINAPI CheckBitmapBits(HTRANSFORM , PVOID, BMFORMAT, DWORD, DWORD, DWORD, PBYTE, PBMCALLBACKFN, LPARAM);
  635. BOOL       WINAPI TranslateColors(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PCOLOR, COLORTYPE);
  636. BOOL       WINAPI CheckColors(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PBYTE);
  637. DWORD      WINAPI GetCMMInfo(HTRANSFORM, DWORD);
  638. BOOL       WINAPI RegisterCMMA(PCSTR, DWORD, PCSTR);
  639. BOOL       WINAPI RegisterCMMW(PCWSTR, DWORD, PCWSTR);
  640. BOOL       WINAPI UnregisterCMMA(PCSTR, DWORD);
  641. BOOL       WINAPI UnregisterCMMW(PCWSTR, DWORD);
  642. BOOL       WINAPI SelectCMM(DWORD);
  643. BOOL       WINAPI GetColorDirectoryA(PCSTR, PSTR, PDWORD);
  644. BOOL       WINAPI GetColorDirectoryW(PCWSTR, PWSTR, PDWORD);
  645. BOOL       WINAPI InstallColorProfileA(PCSTR, PCSTR);
  646. BOOL       WINAPI InstallColorProfileW(PCWSTR, PCWSTR);
  647. BOOL       WINAPI UninstallColorProfileA(PCSTR, PCSTR, BOOL);
  648. BOOL       WINAPI UninstallColorProfileW(PCWSTR, PCWSTR, BOOL);
  649. BOOL       WINAPI EnumColorProfilesA(PCSTR, PENUMTYPEA, PBYTE, PDWORD, PDWORD);
  650. BOOL       WINAPI EnumColorProfilesW(PCWSTR, PENUMTYPEW, PBYTE, PDWORD, PDWORD);
  651. BOOL       WINAPI SetStandardColorSpaceProfileA(PCSTR, DWORD, PCSTR);
  652. BOOL       WINAPI SetStandardColorSpaceProfileW(PCWSTR, DWORD, PCWSTR);
  653. BOOL       WINAPI GetStandardColorSpaceProfileA(PCSTR, DWORD, PSTR, PDWORD);
  654. BOOL       WINAPI GetStandardColorSpaceProfileW(PCWSTR, DWORD, PWSTR, PDWORD);
  655. BOOL       WINAPI AssociateColorProfileWithDeviceA(PCSTR, PCSTR, PCSTR);
  656. BOOL       WINAPI AssociateColorProfileWithDeviceW(PCWSTR, PCWSTR, PCWSTR);
  657. BOOL       WINAPI DisassociateColorProfileFromDeviceA(PCSTR, PCSTR, PCSTR);
  658. BOOL       WINAPI DisassociateColorProfileFromDeviceW(PCWSTR, PCWSTR, PCWSTR);
  659. BOOL       WINAPI SetupColorMatchingW(PCOLORMATCHSETUPW pcms);
  660. BOOL       WINAPI SetupColorMatchingA(PCOLORMATCHSETUPA pcms);
  661.  
  662. #ifdef UNICODE
  663.  
  664. #define ENUMTYPE                            ENUMTYPEW
  665. #define PENUMTYPE                           PENUMTYPEW
  666. #define COLORMATCHSETUP                     COLORMATCHSETUPW
  667. #define PCOLORMATCHSETUP                    PCOLORMATCHSETUPW
  668. #define LPCOLORMATCHSETUP                   LPCOLORMATCHSETUPW
  669. #define PCMSCALLBACK                        PCMSCALLBACKW
  670. #define CreateColorTransform                CreateColorTransformW
  671. #define OpenColorProfile                    OpenColorProfileW
  672. #define CreateProfileFromLogColorSpace      CreateProfileFromLogColorSpaceW
  673. #define RegisterCMM                         RegisterCMMW
  674. #define UnregisterCMM                       UnregisterCMMW
  675. #define GetColorDirectory                   GetColorDirectoryW
  676. #define InstallColorProfile                 InstallColorProfileW
  677. #define UninstallColorProfile               UninstallColorProfileW
  678. #define AssociateColorProfileWithDevice     AssociateColorProfileWithDeviceW
  679. #define DisassociateColorProfileFromDevice  DisassociateColorProfileFromDeviceW
  680. #define EnumColorProfiles                   EnumColorProfilesW
  681. #define SetStandardColorSpaceProfile        SetStandardColorSpaceProfileW
  682. #define GetStandardColorSpaceProfile        GetStandardColorSpaceProfileW
  683. #define SetupColorMatching                  SetupColorMatchingW
  684.  
  685. #else
  686.  
  687. #define ENUMTYPE                            ENUMTYPEA
  688. #define PENUMTYPE                           PENUMTYPEA
  689. #define COLORMATCHSETUP                     COLORMATCHSETUPA
  690. #define PCOLORMATCHSETUP                    PCOLORMATCHSETUPA
  691. #define LPCOLORMATCHSETUP                   LPCOLORMATCHSETUPA
  692. #define PCMSCALLBACK                        PCMSCALLBACKA
  693. #define CreateColorTransform                CreateColorTransformA
  694. #define OpenColorProfile                    OpenColorProfileA
  695. #define CreateProfileFromLogColorSpace      CreateProfileFromLogColorSpaceA
  696. #define RegisterCMM                         RegisterCMMA
  697. #define UnregisterCMM                       UnregisterCMMA
  698. #define GetColorDirectory                   GetColorDirectoryA
  699. #define InstallColorProfile                 InstallColorProfileA
  700. #define UninstallColorProfile               UninstallColorProfileA
  701. #define AssociateColorProfileWithDevice     AssociateColorProfileWithDeviceA
  702. #define DisassociateColorProfileFromDevice  DisassociateColorProfileFromDeviceA
  703. #define EnumColorProfiles                   EnumColorProfilesA
  704. #define SetStandardColorSpaceProfile        SetStandardColorSpaceProfileA
  705. #define GetStandardColorSpaceProfile        GetStandardColorSpaceProfileA
  706. #define SetupColorMatching                  SetupColorMatchingA
  707.  
  708. #endif  // !UNICODE
  709.  
  710. //
  711. // Transform returned by CMM
  712. //
  713.  
  714. typedef HANDLE  HCMTRANSFORM;
  715.  
  716. //
  717. // Pointer to ICC color profile data.
  718. //
  719.  
  720. typedef PVOID   LPDEVCHARACTER;
  721.  
  722. //
  723. // CMM API definition
  724. //
  725.  
  726. BOOL WINAPI CMCheckColors(
  727.     HCMTRANSFORM hcmTransform,  // transform handle
  728.     LPCOLOR lpaInputColors,     // array of COLORs
  729.     DWORD nColors,              // COLOR array size
  730.     COLORTYPE ctInput,          // input color type
  731.     LPBYTE lpaResult            // buffer for results
  732. );
  733.  
  734. BOOL WINAPI CMCheckColorsInGamut(
  735.     HCMTRANSFORM hcmTransform,  // transform handle
  736.     RGBTRIPLE *lpaRGBTriple,    // RGB triple array
  737.     LPBYTE lpaResult,           // buffer for results
  738.     UINT nCount                 // result buffer size
  739. );
  740.  
  741. BOOL WINAPI CMCheckRGBs(
  742.     HCMTRANSFORM hcmTransform,  // transform handle
  743.     LPVOID lpSrcBits,           // source bitmap bits
  744.     BMFORMAT bmInput,           // source bitmap format
  745.     DWORD dwWidth,              // source bitmap width
  746.     DWORD dwHeight,             // source bitmap hight
  747.     DWORD dwStride,             // source bitmap delta
  748.     LPBYTE lpaResult,           // buffer for results
  749.     PBMCALLBACKFN pfnCallback,  // pointer to callback function
  750.     LPARAM ulCallbackData       // caller-defined parameter to callback
  751. );
  752.  
  753. BOOL WINAPI CMConvertColorNameToIndex(
  754.     HPROFILE hProfile,
  755.     PCOLOR_NAME paColorName,
  756.     PDWORD paIndex,
  757.     DWORD dwCount
  758. );
  759.  
  760. BOOL WINAPI CMConvertIndexToColorName(
  761.     HPROFILE hProfile,
  762.     PDWORD paIndex,
  763.     PCOLOR_NAME paColorName,
  764.     DWORD dwCount
  765. );
  766.  
  767. BOOL WINAPI CMCreateDeviceLinkProfile(
  768.     PHPROFILE pahProfiles,    // array of profile handles
  769.     DWORD nProfiles,          // profile handle array size
  770.     PDWORD padwIntents,       // array of rendering intents
  771.     DWORD nIntents,           // intent array size
  772.     DWORD dwFlags,            // transform creation flags
  773.     LPBYTE *lpProfileData     // pointer to pointer to buffer
  774. );
  775.  
  776. HCMTRANSFORM WINAPI CMCreateMultiProfileTransform(
  777.     PHPROFILE pahProfiles,    // array of profile handles
  778.     DWORD nProfiles,          // profile handle array size
  779.     PDWORD padwIntents,       // array of rendering intents
  780.     DWORD nIntents,           // intent array size
  781.     DWORD dwFlags             // transform creation flags
  782. );
  783.  
  784. BOOL WINAPI CMCreateProfile(
  785.     LPLOGCOLORSPACEA lpColorSpace,  // pointer to a logical color space
  786.     LPDEVCHARACTER *lpProfileData   // pointer to pointer to buffer
  787. );
  788.  
  789. BOOL WINAPI CMCreateProfileW(
  790.     LPLOGCOLORSPACEW lpColorSpace,  // pointer to a logical color space
  791.     LPDEVCHARACTER *lpProfileData   // pointer to pointer to buffer
  792. );
  793.  
  794. HCMTRANSFORM WINAPI CMCreateTransform(
  795.     LPLOGCOLORSPACEA lpColorSpace,       // pointer to logical color space
  796.     LPDEVCHARACTER lpDevCharacter,       // profile data
  797.     LPDEVCHARACTER lpTargetDevCharacter  // target profile data
  798. );
  799.  
  800. HCMTRANSFORM WINAPI CMCreateTransformW(
  801.     LPLOGCOLORSPACEW lpColorSpace,       // pointer to logical color space
  802.     LPDEVCHARACTER lpDevCharacter,       // profile data
  803.     LPDEVCHARACTER lpTargetDevCharacter  // target profile data
  804. );
  805.  
  806. HCMTRANSFORM WINAPI CMCreateTransformExt(
  807.     LPLOGCOLORSPACEA lpColorSpace,        // pointer to logical color space
  808.     LPDEVCHARACTER lpDevCharacter,        // profile data
  809.     LPDEVCHARACTER lpTargetDevCharacter,  // target profile data
  810.     DWORD dwFlags                         // creation flags
  811. );
  812.  
  813. HCMTRANSFORM WINAPI CMCreateTransformExtW(
  814.     LPLOGCOLORSPACEW lpColorSpace,        // pointer to logical color space
  815.     LPDEVCHARACTER lpDevCharacter,        // profile data
  816.     LPDEVCHARACTER lpTargetDevCharacter,  // target profile data
  817.     DWORD dwFlags                         // creation flags
  818. );
  819.  
  820. BOOL WINAPI CMDeleteTransform(
  821.     HCMTRANSFORM hcmTransform             // transform handle to be deleted.
  822. );
  823.  
  824. DWORD WINAPI CMGetInfo(
  825.     DWORD dwInfo
  826. );
  827.  
  828. BOOL WINAPI CMGetNamedProfileInfo(
  829.     HPROFILE hProfile,                    // profile handle
  830.     PNAMED_PROFILE_INFO pNamedProfileInfo // pointer to named profile info
  831. );
  832.  
  833. BOOL WINAPI CMGetPS2ColorRenderingDictionary(
  834.     HPROFILE hProfile,
  835.     DWORD dwIntent,
  836.     LPBYTE lpBuffer,
  837.     LPDWORD lpcbSize,
  838.     LPBOOL lpbBinary
  839. );
  840.  
  841. BOOL WINAPI CMGetPS2ColorRenderingIntent(
  842.     HPROFILE hProfile,
  843.     DWORD dwIntent,
  844.     LPBYTE lpBuffer,
  845.     LPDWORD lpcbSize
  846. );
  847.  
  848. BOOL WINAPI CMGetPS2ColorSpaceArray(
  849.     HPROFILE hProfile,
  850.     DWORD dwIntent,
  851.     DWORD dwCSAType,
  852.     LPBYTE lpBuffer,
  853.     LPDWORD lpcbSize,
  854.     LPBOOL lpbBinary
  855. );
  856.  
  857. BOOL WINAPI CMIsProfileValid(
  858.     HPROFILE hProfile,                  // proflle handle
  859.     LPBOOL lpbValid                     // buffer for result.
  860. );
  861.  
  862. BOOL WINAPI CMTranslateColors(
  863.     HCMTRANSFORM hcmTransform,          // transform handle
  864.     LPCOLOR lpaInputColors,             // pointer to input color array
  865.     DWORD nColors,                      // number of color in color array
  866.     COLORTYPE ctInput,                  // input color type
  867.     LPCOLOR lpaOutputColors,            // pointer to output color array
  868.     COLORTYPE ctOutput                  // output color type
  869. );
  870.  
  871. BOOL WINAPI CMTranslateRGB(
  872.     HCMTRANSFORM hcmTransform,
  873.     COLORREF ColorRef,
  874.     LPCOLORREF lpColorRef,
  875.     DWORD dwFlags
  876. );
  877.  
  878. BOOL WINAPI CMTranslateRGBs(
  879.     HCMTRANSFORM hcmTransform,
  880.     LPVOID lpSrcBits,
  881.     BMFORMAT bmInput,
  882.     DWORD dwWidth,
  883.     DWORD dwHeight,
  884.     DWORD dwStride,
  885.     LPVOID lpDestBits,
  886.     BMFORMAT bmOutput,
  887.     DWORD dwTranslateDirection
  888. );
  889.  
  890. BOOL WINAPI CMTranslateRGBsExt(
  891.     HCMTRANSFORM hcmTransform,
  892.     LPVOID lpSrcBits,
  893.     BMFORMAT bmInput,
  894.     DWORD dwWidth,
  895.     DWORD dwHeight,
  896.     DWORD dwInputStride,
  897.     LPVOID lpDestBits,
  898.     BMFORMAT bmOutput,
  899.     DWORD dwOutputStride,
  900.     LPBMCALLBACKFN lpfnCallback,
  901.     LPARAM ulCallbackData
  902. );
  903.  
  904. #ifdef __cplusplus
  905. }
  906. #endif
  907.  
  908. #pragma option pop /*P_O_Pop*/
  909. #endif  // ifndef _ICM_H_
  910.  
  911.