Windows Color System and API An Overview Outline

















































- Slides: 49
Windows Color System and API: An Overview
Outline A Brief Overview of the Windows Color System (WCS) in Windows codename “Longhorn” WCS XML-based color profiles ICM APIs: changed, unchanged, and new Using ICM APIs to access WCS functionality Profile/Device association and defaults Getting color profiles Constructing color transforms Applying color transforms to color data Call to Action
Goals An understanding of the structure of the Windows Color System (WCS) An understanding of its relationship to Windows ICM An understanding of how to use WCS via the ICM APIs An understanding of how to take best advantage of enhanced capabilities and opportunities for innovation enabled by the Windows Color System Knowledge of where to find more information about WCS An understanding of how best to provide feedback
Windows Color System and ICC workflows Seamless interoperability with ICC profile-based workflows (ICC: International Color Consortium) Any existing code that uses ICM 2 APIs will continue to work without any change required. ICM Gets ICC Version 4. x Support Addressing key recorded ICM 2 bugs Implement new functionality in current ICM 2 APIs Old applications work with new profiles New profile format is processed by current ICM 2 APIs
The Parts of the Windows Color System The WCS XML-based color profile formats The Color Infrastructure & Translation Engine (CITE) The Color Appearance Model (CAM) Based on CIECAM 02 The Baseline Device Model Set Extensible via Device Model Plug-ins The Baseline Gamut Map Model Set Extensible via Gamut Map Model Plug-ins And of course the existing ICM CMM, with ICC version 4 profile support added
WCS Pipeline Device A Device B Device Color Space Device Models Device Model Profile A Device Model Profile B Device Model B Device-Independent Color Space CIEXYZ Gamut Map Models Color Appearance Model CAMP for Device A Viewing Conditions GBD A Gamut Map Model C Profile GBD B Gamut Map Model C Color Appearance Space CIEJch Color Appearance Model CAMP for Device B Viewing Conditions
WCS Profile Formats Each Type has its own Schema Device Model Profile (DMP), file extension “. cdmp” Color Appearance Model Profile (CAMP), “. camp” Gamut Map Model Profile (GMMP), “. gmmp”
Device Model Profile Structure Profile. Name string optional Description string optional Author string optional Measurement. Condition. Type – there are defaults for each. . Device. Type below Color. Space Measurement. Space. Type White. Point. Value – white point name (eg. D 65), or CIEXYZ white point values Geometry – measurement geometry (eg. 0/45) Aperture. Size - measurement instrument aperture (eg. 10 mm)
Device Model Profile Structure Max. Colorant – maximum value allowed in any color channel Min. Colorant – minimum value allowed in any color channel A reference to the targeted baseline Device Model - these contain model-specific measurement data CRTDevice. Type LCDDevice. Type RGBProjector. Device. Type Scanner. Device Capture. Device. Type Camera. Device Capture. Device. Type RGBPrinter. Device. Type CMYKPrinter. Device. Type Plug. In. Device. Type (only if targeting a plug-in Device Model) optional Extension. Type - arbitrary third-party proprietary information
DMP Schema <xs: element name="Color. Device. Model"> <xs: complex. Type> <xs: sequence> <xs: element name="Profile. Name" type="xs: string"/> <xs: element name="Description" type="xs: string" min. Occurs="0"/> <xs: element name="Author" type="xs: string" min. Occurs="0"/> <xs: element name="Measurement. Conditions" type="cdm: Measurement. Conditions. Type" min. Occurs="0"/> <xs: element name="Max. Colorant" type="cdm: Non. Negative. Float. Type"/> <xs: element name="Min. Colorant" type="cdm: Non. Negative. Float. Type"/> <xs: choice> LCDDevice <xs: element name="CRTDevice"> RGBProjector. Device <xs: complex. Type> <xs: sequence> Scanner. Device <xs: element name="Measurement. Data" Camera. Device type="cdm: Display. Measurement. Type"/> </xs: sequence> RGBPrinter. Device </xs: complex. Type> CMYKPrinter. Device </xs: element>. . . [ rest of baseline devices]. . . </xs: choice> <xs: element name="Plug. In. Device. Model" min. Occurs="0">. . . </xs: sequence> </xs: complex. Type> </xs: element> </xs: schema>
CMYKDevice. Type <xs: element name="CMYKPrinter. Device"> <xs: complex. Type> <xs: sequence> <xs: element name="Measurement. Data" type="cdm: CMYKPrinter. Measurement. Type"/> </xs: sequence> </xs: complex. Type> </xs: element>
CMYKPrinter. Measurement. Type <xs: complex. Type name="CMYKPrinter. Measurement. Type"> <xs: sequence> <xs: element name="Color. Cube"> <xs: complex. Type> <xs: sequence> <xs: element name="Sample" type="cdm: CMYKSample. Type" max. Occurs="unbounded"/> </xs: sequence> </xs: complex. Type> </xs: element> </xs: sequence> <xs: attribute name="Time. Stamp" type="xs: date. Time" use="required"/> </xs: complex. Type>
Color Appearance Model Profile (CAMP) Contents Profile. Name string, optional Description string, optional Author string, Viewing. Condition. Type. -Parameters to the CIECAM 02 Color Appearance Model White. Point. Type Background CIEXYZ sub-element Surround. Type sub-element Luminance. Of. Adapting. Field float sub-element Degree. Of. Adaptation float sub-element
Gamut Map Model Profile Contents Profile. Name string, Default. Baseline. Gamut. Map. Model. Type Optional Description string Optional Author string optional Plug. In. Device Plug. In. Gamut. Map. Type optional extension Extension. Type
ICM-WCS APIs
Three categories of ICM-WCS APIs Existing ICM 2 APIs whose parameters and functions are completely unchanged. Existing ICM 2 APIs that now support WCS color profiles in addition to ICC color profiles New, WCS-specific APIs
Existing ICM 2 APIs That are Unchanged for Longhorn WCS All Device Context-based (HDC-based) ICM APIs are unchanged. These outside-DC ICM APIs are also unchanged: Create. Profile. From. Log. Color. Space Get. Count. Color. Profile. Elements Get. Color. Profile. Header Get. Color. Profile. Element. Tag Is. Color. Profile. Tag. Present Get. Color. Profile. Element Set. Color. Profile. Header Set. Color. Profile. Element. Size Set. Color. Profile. Element. Reference Get. Named. Profile. Info Convert. Color. Name. To. Index Convert. Index. To. Color. Name Get. PS 2 Color. Space. Array Get. PS 2 Color. Rendering. Intent Get. PS 2 Color. Rendering. Dictionary Create. Device. Link. Profile
Existing ICM 2 APIs With Added Support for WCS Profiles and Transforms Open. Color. Profile Close. Color. Profile Get. Color. Profile. From. Handle Is. Color. Profile. Valid Create. Color. Transform Create. Multi. Profile. Transform Translate. Bitmap. Bits Check. Bitmap. Bits Translate. Colors Check. Colors
Existing ICM 2 Profile Management APIs That Support WCS Profiles Install. Color. Profile Uninstall. Color. Profile Enum. Color. Profiles Set. Standard. Color. Space. Profile Get. Standard. Color. Space. Color. Profile Associate. Color. Profile. With. Device Disassociate. Color. Profile. From. Device
New WCS-Specific ICM APIs New APIs are all prefixed “Wcs…” Wcs. Open. Color. Profile Wcs. Translate. Colors Wcs. Check. Colors Wcs. Get. Default. Color. Profile. Size Wcs. Get. Default. Color. Profile Wcs. Set. Default. Color. Profile
Using the APIs Install/uninstall color profiles Associate/disassociate color profiles with devices Get/set default color profiles Now includes mapping ICC rendering intents to GMMPs Now includes get/set default CAMPs Get color profiles Construct color transforms Apply color transforms – translate color Check for out of gamut colors
Color Profile Installation These routines now work with DMPs, CAMPs, and GMMPs, as well as ICC profiles BOOL WINAPI Install. Color. Profile( PCTSTR p. Machine. Name, PCTSTR p. Profile. Name ); BOOL WINAPI Uninstall. Color. Profile( PCTSTR p. Machine. Name, PCTSTR p. Profile. Name, BOOL b. Delete );
Profile/Device Association These routines now work with DMPs, CAMPs, and GMMPs, as well as ICC profiles BOOL WINAPI Associate. Color. Profile. With. Device( PCTSTR p. Machine. Name, PCTSTR p. Profile. Name, PCTSTR p. Device. Name ); BOOL WINAPI Disassociate. Color. Profile. From. Device( PCTSTR p. Machine. Name, PCTSTR p. Profile. Name, PCTSTR p. Device. Name );
Get/Set System Default Profile BOOL WINAPI Set. Standard. Color. Space. Profile( PCTSTR p. Machine. Name, DWORD dw. Profile. ID, PCSTR p. Profilename // DMP or ICC profile ); BOOL WINAPI Get. Standard. Color. Space. Profile( PCTSTR p. Machine. Name, DWORD dw. Profile. ID, PTSTR p. Profile. Name, // DMP or ICC profile PDWORD pdw. Size );
Set Default Color Profiles (New API ) BOOL WINAPI Wcs. Set. Default. Color. Profile( PCTSTR p. Device. Name, //Null = system level default COLORPROFILETYPE cpt. Value, LPCWSTR p. Profilename ); enum { CPT_ALL = 0, Set/Get CPT_WINDOWS_COLOR_SPACE, Set/Get CPT_s. RGB, Set/Get CPT_ICC, Set/Get CPT_DMP, Set/Get CPT_CAMP, Set/Get CPT_GMMP_ABSOLUTE_COLORIMETRIC, CPT_GMMP_RELATIVE_COLORIMETRIC, CPT_GMMP_PERCEPTUAL, CPT_GMMP_SATURATION, } COLORPROFILETYPE; all default profiles for device System Standard color space System s. RGB profile default ICC profile for device, OS default DMP for device or OS default CAMP for device or OS Set/Get GMMP to map to Abs Col RI Set/Get GMMP to map to Rel Col RI Set/Get GMMP to map to Percep RI Set/Get GMMP to map to Sat RI
Get Default Color Profiles (New APIs) Get size of buffer required for p. Profile. Name BOOL WINAPI Wcs. Get. Default. Color. Profile. Size( PCTSTR p. Device. Name, COLORPROFILETYPE cpt. Value, PDWORD pdw. Size ); BOOL WINAPI Wcs. Get. Default. Color. Profile( PCTSTR p. Device. Name, COLORPROFILETYPE cpt. Value, DWORD dw. Size, LPWSTR p. Profile. Name );
Get Color Profiles Via: Get. Standard. Color. Space. Profile Wcs. Get. Default. Color. Profile Enum. Color. Profiles Print. Ticket/Print. Capabilities mechanism See DDC session Print. Ticket and Print. Capabilities. Overview of Communications Schema and API These get you profilenames Then use Open. Color. Profile or Wcs. Open. Color. Profile to obtain HPROFILEs
Enum. Color. Profiles BOOL WINAPI Enum. Color. Profiles( PCTSTR p. Machine. Name, PENUMTYPE p. Enum. Record, PBYTE p. Buffer, PDWORD pdw. Size, PDWORD pn. Profiles ); This API will support WCS profiles in addition to ICC profiles If p. Enum. Record->dw. Fields has ET_SIGNATURE set and p. Enum. Record> dw. Signature equals “cdmp” then all matching DMPs are enumerated. Similar functionality is implemented for dw. Signature of “camp” and dw. Signature of “gmmp”. WCS DMP profiles do not require the equivalent of ICC ‘devs’ tags and so, that legacy matching criterion is not supported when enumerating WCS DMPs
Get an HPROFILE: Open. Color. Profile HPROFILE WINAPI Open. Color. Profile( PPROFILE p. Profile, // ICC or DMP DWORD dw. Desired. Access, DWORD dw. Share. Mode, DWORD dw. Creation. Mode ); This API will support WCS DMPs, both by filename and as a DMP image in a membuffer Default CAMP and GMMP from Registry will be used with a DMP
Get an HPROFILE: Wcs. Open. Color. Profile (New) HPROFILE WINAPI Wcs. Open. Color. Profile( PPROFILE p. DMPProfile, // required – ICC or DMP PPROFILE p. CAMPProfile, // required with DMP (ignored // with ICC) PPROFILE p. GMMPProfile, // optional (ignored with ICC) DWORD dw. Desired. Access, DWORD dw. Share. Mode, DWORD dw. Creation. Mode ); p. GMMPProfile can be NULL. In the NULL case, the default GMMP will be used (configured with Wcs. Set. Default. Color. Profile). p. GMMPProfile may be set to DEFER_UNTIL_RUNTIME. In the DEFER_UNTIL_RUNTIME case GMMP usage will be determined by profile sequence in the color transform context
Open a Color Profile ICC or DMP filename DMP CAMP GMMP filename Open. Color. Profile() Wcs. Open. Color. Profile() Default Profiles in Registry HPROFILE
Construct Color Transforms Create. Color. Transform Create. Multi. Profile. Color. Transform
Create. Color. Transform HTRANSFORM WINAPI Create. Color. Transform( LPLOGCOLORSPACE p. Log. Color. Space, HPROFILE h. Dest. Profile, // ICC or WCS profile HPROFILE h. Target. Profile, // ICC or WCS profile DWORD dw. Flags // ignored if any WCS ); h. Dest. Profile and h. Target. Profile can be handles to ICC or WCS profiles If only ICC profiles are used to create a transform, then the legacy ICM CMM will be used for processing. If any WCS profiles are involved then the processing will occur through the WCS CITE h. Target. Profile will be NULL unless you’re creating a softproofing transform
Create. Multi. Profile. Transform HTRANSFORM WINAPI Create. Multi. Profile. Transform( PHPROFILE pah. Profiles, // ptr to array of HPROFILEs DWORD n. Profiles, // number of HPROFILEs (max 10) PDWORD padw. Intent, // ptr to array of intents DWORD n. Intents, // number of intents (max 10) DWORD dw. Flags, // ignored if any WCS profiles DWORD index. Preferred. CMM // ignored if any WCS profiles ); pah. Profiles - profile array can contain a mix of ICC and WCS profile handles If only ICC profiles are used, processing will be via the legacy ICM 2 CMM n. Intents must equal 1 or n. Profiles Intents corresponding to WCS HPROFILEs will result in the use of the corresponding default GMMB mapped to that intent. Intents specified in the padw. Intent array trump GMMBs in WCS HPROFILEs, unless… For WCS profiles, setting the corresponding intent to -1 will force use of GMMPs contained in WCS HPROFILEs (constructed with Wcs. Open. Color. Profile). ICC Device. Link, Abstract, and Named. Color profiles are not supported in combination with WCS profiles. More profile sequencing discussion on next slide
Profile Sequencing in Create. Multi. Profile. Transform Ideally one gamut mapping is performed between a source and destination device Achieved by setting one or the other GMMP to NULL when creating the HPROFILE in Wcs. Open. Color. Profile Gamut Boundary Descriptions (GBDs) are created from DMP+CAMP pairs. Subsequent GMMPs use the GBD immediately prior to them until there exists a GBD for DMP/CAMP next in the sequence If two adjacent GMMPs are identical, one of them will be removed
Transform Profile Sequence Example. Ignored padw. Intent INTENT_PECEPTUAL -1 INTENT_RELATIVE _COLORIMETRIC HPROFILE 1 HPROFILE 2 HPROFILE 3 DMP 1 DMP 2 DMP 3 CAMP 1 CAMP 2 CAMP 3 GMMP 1 GMMP 2 NULL DMP 1 +CAMP 1 GBD 1 Default Profiles in Registry DMP 3 +CAMP 3 DMP 2 +CAMP 2 GMMPPercept GBD 2 GMMP 2 GBD 3
Profile Sequencing Example Consider the profile sequence: [ DMP 1, CAMP 1, GMMP 2, GMMP 3, DMP 2, CAMP 2, GMMP 4, GMMP 5, CAMP 3, DMP 3 ] GMMP 1 and GMMP 2 use GBD 1 (from DMP 1+CAMP 1) as their source and destination GBD for gamut mapping GMMP 3 uses GBD 1 as its source GBD and GBD 2 (from DMP 2+CAMP 2) as its destination GBD for gamut mapping Then GMMP 4 uses GBD 2 as source and destination Finally GMMP 5 uses GBD 2 as source and GBD 3 as destination - assumes no adjacent GMMPs are identical Most real-world transforms will involve 2 or 3 DMPs & CAMPs, with 1 or 2 GMMPs When ICC profiles are involved the corresponding intent from the intent array will be used with that profile
Applying a Color Transform For legacy 16 bit per channel (bpc) and lower color data formats: Translate. Bitmap. Bits Check. Bitmap. Bits Translate. Colors Check. Colors For legacy plus new WCS 16 and 32 bpc floating point formats: Wcs. Translate. Colors Wcs. Check. Colors
Legacy Color Data Formats COLORTYPE Enumeration This enumeration has 64 bit typedef enum { COLOR_GRAY = 1, // WORD COLOR_RGB, // WORD COLOR_XYZ, // WORD COLOR_Yxy, // WORD COLOR_Lab, // WORD COLOR_3_CHANNEL, // WORD COLOR_CMYK, // WORD COLOR_5_CHANNEL, // BYTE COLOR_6_CHANNEL, // BYTE COLOR_7_CHANNEL, // BYTE COLOR_8_CHANNEL, // BYTE COLOR_NAMED } COLORTYPE; underlying structures. per per per channel channel channel
Bitmap (Raster) Color Data Formats typedef enum { BM_x 555 RGB = 0 x 0000, BM_x 555 XYZ = 0 x 0101, BM_x 555 Yxy, BM_x 555 Lab, BM_x 555 G 3 CH, BM_RGBTRIPLETS = 0 x 0002, BM_BGRTRIPLETS = 0 x 0004, BM_XYZTRIPLETS = 0 x 0201, BM_Yxy. TRIPLETS, BM_Lab. TRIPLETS, BM_G 3 CHTRIPLETS, BM_5 CHANNEL, BM_6 CHANNEL, BM_7 CHANNEL, BM_8 CHANNEL, BM_GRAY, BM_x. RGBQUADS = 0 x 0008, BM_x. BGRQUADS = 0 x 0010, BM_x. G 3 CHQUADS = 0 x 0304, BM_KYMCQUADS, BM_CMYKQUADS = 0 x 0020, BM_10 b_RGB = 0 x 0009, BM_10 b_XYZ = 0 x 0401, BM_10 b_Yxy, BM_10 b_Lab, BM_10 b_G 3 CH, BM_NAMED_INDEX, BM_16 b_RGB = 0 x 000 A, BM_16 b_XYZ = 0 x 0501, BM_16 b_Yxy, BM_16 b_Lab, BM_16 b_G 3 CH, BM_16 b_GRAY, BM_565 RGB = 0 x 0001, BM_32 b_sc. ARGB = 0 x 601, // NEW BM_16 b_sc. ARGB, BM_32 b_sc. RGB, BM_16 b_sc. RGB, } BMFORMAT; Only with WCS transforms
Translate. Colors, Check. Colors BOOL WINAPI Translate. Colors( HTRANSFORM h. Color. Transform, PCOLOR pa. Input. Colors, DWORD n. Colors, COLORTYPE ct. Input, PCOLOR pa. Output. Colors, COLORTYPE ct. Output ); BOOL WINAPI Check. Colors( HTRANSFORM h. Color. Transform, PCOLOR pa. Input. Colors, DWORD n. Colors, COLORTYPE ct. Input, PBYTE pa. Result ); // ICC or WCS transform // Legacy color formats
Translate. Bitmap. Bits, Check. Bitmap. Bits BOOL WINAPI Translate. Bitmap. Bits( HTRANSFORM h. Color. Transform, PVOID p. Src. Bits, BMFORMAT bm. Input, DWORD dw. Width, DWORD dw. Height, DWORD dw. Input. Stride, PVOID p. Dest. Bits, BMFORMAT bm. Output, DWORD dw. Output. Stride, PBMCALLBACKFN pfn. Callback, ULONG ul. Callback. Data ); BOOL WINAPI Check. Bitmap. Bits( HTRANSFORM h. Color. Transform, PVOID p. Src. Bits, BMFORMAT bm. Input, DWORD dw. Width, DWORD dw. Height, DWORD dw. Stride, PBYTE pa. Result, PBMCALLBACKFN pfn. Callback, LPARAM lp. Callback. Data ); // ICC or WCS transform // Legacy bitmap formats
New WCS Color Data Formats COLORDATATYPE enum typedef enum { COLOR_BYTE = 1, COLOR_WORD, COLOR_FLOAT, COLOR_S 2 DOT 13 FIXED, } COLORDATATYPE; // // BYTE per channel, 8 bits range 0 to 255 WORD per channel, 16 bits range 0 to 65535 FLOAT per channel, 32 bits range uses standard IEEE 32 bit floats // WORD per channel, fixed point ranging // from -4 to +4 using s 2. 13
Wcs. Translate. Colors, Wcs. Check. Colors BOOL WINAPI WCSTranslate. Colors( HTRANSFORM h. Color. Transform, DWORD n. Colors, DWORD n. Input. Channels, COLORDATATYPE cdt. Input, DWORD cb. Input, PVOID p. Input. Data, DWORD n. Output. Channels, COLORDATATYPE cdt. Output DWORD cb. Output, PVOID p. Output. Data, ); BOOL WINAPI WCSCheck. Colors( HTRANSFORM h. Color. Transform, DWORD n. Colors, DWORD n. Input. Channels, COLORDATATYPE cdt. Input, DWORD cb. Input, PVOID p. Input. Data, PBYTE p. Result, ); // WCS transforms only // Just new color data formats
Call To Action Understand the Windows Color System Read WCS use cases Submit your own scenarios Send us feedback Review the “Metro” v. 7 specification and provide feedback to prninfo @ microsoft. com http: //www. microsoft. com/whdc/device/print/metro. mspx Start implementation with Beta 1!
Additional Resources MSDN Developer Community Chats Printer Drivers -- Ask the Experts Online http: //msdn. microsoft. com/chats/windows_10240 2. asp Windows Drivers: Printer Drivers http: //msdn. microsoft. com/chats/windows_10160 2. asp Windows Drivers Printing and Networking http: //msdn. microsoft. com/chats/windows_02200 2. asp
Additional Resources WS-Devices Profile: http: //msdn. microsoft. com/webservices/understanding/specs/ default. aspx? pull=/library/en-us/dnglobspec/html/devprof. asp Printer Working Group http: //www. pwg. org WHDC Printing home page: http: //www. microsoft. com/whdc/device/print/default. mspx WHDC Still Imaging / WIA home page: http: //www. microsoft. com/whdc/device/stillimage/default. mspx WHDC Color home page: http: //www. microsoft. com/whdc/device/display/color/default. mspx Color Use Cases http: //www. microsoft. com/whdc/device/display/color/WCS_cases. mspx Writing Effective Use Cases, Alistair Cockburn, ISBN 0201702258
Additional Resources E-mail For developer print questions: prninfo @ microsoft. com For developer scan questions: wiainfo @ microsoft. com For developer color questions: mscolor @ microsoft. com
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.