Color Space Suite

The Color Space suite provides callbacks related to color space management. More...

Data Structures

struct  CS_XYZColor
 Color values for the XYZ color space. More...
struct  PSColorSpaceSuite2
 The set of routines available in the Color Space suite. More...
struct  PSColorSpaceSuite1
 The set of routines available in the Color Space suite. More...

Defines

#define kPSColorSpaceSuite   "Photoshop ColorSpace Suite for Plug-ins"
 Unique identifier for the Color Space Suite.
#define kPSColorSpaceSuiteVersion2   2
 Color Space Suite, Version 2.
#define kPSColorSpaceSuiteVersion   kPSColorSpaceSuiteVersion2
 Latest version.
#define kPSColorSpaceSuiteVersion1   1
 Color Space Suite, Version 1.

Typedefs

typedef struct Color_T * ColorID
 Identifier for the Color Space.
typedef uint8 Color8 [4]
 Representation of 8-bit color.
typedef uint16 Color16 [4]
 Representation of 32-bit color.
typedef real32 Color32 [4]
typedef SPAPI SPErr(* ColorSpace_Make )(ColorID *id)
 Makes a new color space.
typedef SPAPI SPErr(* ColorSpace_Delete )(ColorID *id)
 Deletes a color space.
typedef SPAPI SPErr(* ColorSpace_StuffComponents )(ColorID id, int16 colorSpace, uint8 component0, uint8 component1, uint8 component2, uint8 component3)
 Puts four color components into a Color Space given a type of color space.
typedef SPAPI SPErr(* ColorSpace_ExtractComponents )(ColorID id, int16 colorSpace, uint8 *component0, uint8 *component1, uint8 *component2, uint8 *component3, Boolean *gamutFlag)
 Extracts four color components from a Color Space given a type of color space.
typedef SPAPI SPErr(* ColorSpace_StuffXYZ )(ColorID id, CS_XYZColor xyz)
 Puts XYZ color components into a Color Space.
typedef SPAPI SPErr(* ColorSpace_ExtractXYZ )(ColorID id, CS_XYZColor *xyz)
 Extracts XYZ color components from a Color Space.
typedef SPAPI SPErr(* ColorSpace_GetNativeSpace )(ColorID id, int16 *colorSpace)
 Gets the native type of color space from a Color Space.
typedef SPAPI SPErr(* ColorSpace_Convert8 )(int16 inputCSpace, int16 outputCSpace, Color8 *colorArray, int16 count)
 Converts between two color spaces, with 8-bit color.
typedef SPAPI SPErr(* ColorSpace_Convert16 )(int16 inputCSpace, int16 outputCSpace, Color16 *colorArray, int16 count)
 Converts between two color spaces, with 16-bit color.
typedef SPAPI SPErr(* ColorSpace_IsBookColor )(ColorID id, Boolean *isBookColor)
 Determines whether the color space associated with ColorID contains a book color.
typedef SPAPI SPErr(* ColorSpace_ExtractColorName )(ColorID id, ASZString *colorName)
 Extracts the name of the color in a color space.
typedef SPAPI SPErr(* ColorSpace_PickColor )(ColorID *id, ASZString promptString)
 Picks a color using the Color Picker.
typedef SPAPI SPErr(* ColorSpace_Convert8to16 )(uint8 *input_data, uint16 *output_data, int16 count)
 Converts 8- to 16-bit color.
typedef SPAPI SPErr(* ColorSpace_Convert16to8 )(uint16 *input_data, uint8 *output_data, int16 count)
 Converts 16- to 18-bit color.
typedef SPAPI SPErr(* ColorSpace_ConvertToMonitorRGB )(int16 inputCSpace, Color8 *input_data, Color8 *output_data, int16 count)
 Converts color from inputCSpace to main monitor RGB (does not handle multiple displays!) The data can be single or multiple channels, as long as the count includes all of it.
typedef SPAPI SPErr(* ColorSpace_Convert32to8 )(real32 *input_data, uint8 *output_data, int16 count)
 Converts 32- to 8-bit color.
typedef SPAPI SPErr(* ColorSpace_ConvertForDisplay )(PSPixelMap *source_data, Color8 *output_data, int32 output_rowBytes, const VRect *display_area)
 Converts color to monitor RGB for a given display area (whichever display covers most of it)
typedef SPAPI SPErr(* ColorSpace_GetDisplayProfile )(const VRect *display_area, Handle *profile_data)
 Get the ICC profile for a given display area (whichever display covers most of it)

Detailed Description

The Color Space suite provides callbacks related to color space management.

Accessing the Suite

The Color Space suite is referred to as:

  #define kPSColorSpaceSuite    "Photoshop ColorSpace Suite for Plug-ins"

The current version of the Color Space suite:

  #define kPSColorSpaceSuiteVersion1        1

The suite is acquired as follows:

  PSColorSpaceSuite1 *sPSColorSpace;
  error = sSPBasic->AcquireSuite(kPSColorSpaceSuite,
                                 kPSColorSpaceSuiteVersion1,      
                                 &sPSColorSpace);
  if (error) goto . . . //handle error

For PICA errors, see SPErrorCodes.h.


Define Documentation

#define kPSColorSpaceSuite   "Photoshop ColorSpace Suite for Plug-ins"

Unique identifier for the Color Space Suite.

Color Space Suite, Version 2.

Color Space Suite, Version 1.


Typedef Documentation

typedef struct Color_T* ColorID

Identifier for the Color Space.

typedef uint8 Color8[4]

Representation of 8-bit color.

For each of the color spaces, the values are formatted as follows for the 0,1,2,3 array indices: 0RGB, CMYK, 0LAB, 0XYZ, 0HSB, 0HSL, 000Gray. Representation of 16-bit color. For each of the color spaces, the values are formatted as follows for the 0,1,2,3 array indices: 0RGB, CMYK, 0LAB, 0XYZ, 0HSB, 0HSL, 000Gray.

typedef uint16 Color16[4]

Representation of 32-bit color.

For each of the color spaces, the values are formatted as follows for the 0,1,2,3 array indices: 0RGB, CMYK, 0LAB, 0XYZ, 0HSB, 0HSL, 000Gray.

typedef real32 Color32[4]
typedef SPAPI SPErr(* ColorSpace_Make)(ColorID *id)

Makes a new color space.

Parameters:
ColorIDID of the color space.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_Delete)(ColorID *id)

Deletes a color space.

Parameters:
ColorIDID of the color space to delete.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_StuffComponents)(ColorID id, int16 colorSpace, uint8 component0, uint8 component1, uint8 component2, uint8 component3)

Puts four color components into a Color Space given a type of color space.

Parameters:
ColorIDID of the color space to stuff components into.
colorSpaceThe type of color space used. See Color Space for values.
component0The value to stuff for component 0. The values depend on the type of color space.
component1The value to stuff for component 1. The values depend on the type of color space.
component2The value to stuff for component 2. The values depend on the type of color space.
component3The value to stuff for component 3. The values depend on the type of color space.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_ExtractComponents)(ColorID id, int16 colorSpace, uint8 *component0, uint8 *component1, uint8 *component2, uint8 *component3, Boolean *gamutFlag)

Extracts four color components from a Color Space given a type of color space.

Parameters:
ColorIDID of the color space to extract components from.
colorSpaceThe type of color space used. See Color Space for values.
component0[OUT] The value extracted for component 0. The values depend on the type of color space.
component1[OUT] The value extracted for component 1. The values depend on the type of color space.
component2[OUT] The value extracted for component 2. The values depend on the type of color space.
component3[OUT] The value extracted for component 3. The values depend on the type of color space.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_StuffXYZ)(ColorID id, CS_XYZColor xyz)

Puts XYZ color components into a Color Space.

Parameters:
ColorIDID of the color space to stuff color into.
xyzXYZ color to put into the color space.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_ExtractXYZ)(ColorID id, CS_XYZColor *xyz)

Extracts XYZ color components from a Color Space.

Parameters:
ColorIDID of the color space to extract color from.
xyz[OUT] XYZ color extracted from the color space.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_GetNativeSpace)(ColorID id, int16 *colorSpace)

Gets the native type of color space from a Color Space.

Parameters:
ColorIDID of the color space check.
colorSpace[OUT] The type of color space, returned. See Color Space for values.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_Convert8)(int16 inputCSpace, int16 outputCSpace, Color8 *colorArray, int16 count)

Converts between two color spaces, with 8-bit color.

Parameters:
inputCSpaceType of color space to convert from. See Color Space for values.
outputCSpaceType of color space to convert into. See Color Space for values.
colorArray[IN/OUT] The color array to convert from. Also holds the output of the conversion to the new color space.
countHow many items in the colorArray
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_Convert16)(int16 inputCSpace, int16 outputCSpace, Color16 *colorArray, int16 count)

Converts between two color spaces, with 16-bit color.

Parameters:
inputCSpaceType of color space to convert from. See Color Space for values.
outputCSpaceType of color space to convert into. See Color Space for values.
colorArray[IN/OUT] The color array to convert from. Also holds the output of the conversion to the new color space.
countHow many items in the colorArray
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_IsBookColor)(ColorID id, Boolean *isBookColor)

Determines whether the color space associated with ColorID contains a book color.

Parameters:
ColorIDID of the color space to check.
isBookColor[OUT] Indicates whether the color space contains a book color, TRUE if so.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_ExtractColorName)(ColorID id, ASZString *colorName)

Extracts the name of the color in a color space.

Parameters:
ColorIDID of the color space.
colorName[OUT] Name of the color in the color space.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_PickColor)(ColorID *id, ASZString promptString)

Picks a color using the Color Picker.

Parameters:
ColorID[OUT] ID of the color space with the color returned in it.
promptStringString used in the prompt for the color picker.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_Convert8to16)(uint8 *input_data, uint16 *output_data, int16 count)

Converts 8- to 16-bit color.

Uses the Photoshop internal 16 bit range of [0..32768] The data can be single or multiple channels, as long as the count includes all of it.

Parameters:
input_dataBlock of data to convert from 8 bit color.
output_data[OUT] Block of data to receive the conversion into 16 bit color.
countHow many items to convert
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_Convert16to8)(uint16 *input_data, uint8 *output_data, int16 count)

Converts 16- to 18-bit color.

Uses the Photoshop internal 16 bit range of [0..32768] The data can be single or multiple channels, as long as the count includes all of it.

Parameters:
input_dataBlock of data to convert from 16 bit color.
output_data[OUT] Block of data to receive the conversion into 18 bit color.
countHow many to convert
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_ConvertToMonitorRGB)(int16 inputCSpace, Color8 *input_data, Color8 *output_data, int16 count)

Converts color from inputCSpace to main monitor RGB (does not handle multiple displays!) The data can be single or multiple channels, as long as the count includes all of it.

Parameters:
inputCSpaceThe color space to convert from. See Color Space for values.
input_dataBlock of data to convert from 8 bit color.
output_data[OUT] Block of data to receive the conversion into monitor RGB color.
countHow many to convert
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_Convert32to8)(real32 *input_data, uint8 *output_data, int16 count)

Converts 32- to 8-bit color.

The data can be single or multiple channels, as long as the count includes all of it.

Parameters:
input_dataBlock of data to convert from 32 bit color.
output_data[OUT] Block of data to receive the conversion into 8 bit color.
countHow many items to convert
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_ConvertForDisplay)(PSPixelMap *source_data, Color8 *output_data, int32 output_rowBytes, const VRect *display_area)

Converts color to monitor RGB for a given display area (whichever display covers most of it)

Parameters:
source_dataThe input data to be converted.
output_data[OUT] Block of data to receive the conversion into 8 bit monitor RGB color.
output_rowBytesrowbytes for output_data.
display_areadisplay rectangle that this data will be displayed in.
Returns:
Non-zero error if failure.
typedef SPAPI SPErr(* ColorSpace_GetDisplayProfile)(const VRect *display_area, Handle *profile_data)

Get the ICC profile for a given display area (whichever display covers most of it)

Parameters:
display_areadisplay rectangle that this data will be displayed in.
profile_data[OUT] HandleSuite handle with ICC profile in it. Caller is responsible for disposing of data.
Returns:
Non-zero error if failure.