Color Space Suite


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.


Data Structures

struct  CS_XYZColor
 Color values for the XYZ color space. 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 kPSColorSpaceSuiteVersion1   1
 Color Space Suite, Version 1.

Typedefs

typedef Color_T * ColorID
 Identifier for the Color Space.
typedef unsigned char Color8 [4]
 Representation of 8-bit color. Representation of 16-bit color.
typedef unsigned short Color16 [4]
 Representation of 32-bit color.
typedef float 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, short colorSpace, unsigned char component0, unsigned char component1, unsigned char component2, unsigned char component3)
 Puts four color components into a Color Space given a type of color space.
typedef SPAPI SPErr(*) ColorSpace_ExtractComponents (ColorID id, short colorSpace, unsigned char *component0, unsigned char *component1, unsigned char *component2, unsigned char *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, short *colorSpace)
 Gets the native type of color space from a Color Space.
typedef SPAPI SPErr(*) ColorSpace_Convert8 (short inputCSpace, short outputCSpace, Color8 *colorArray, short count)
 Converts between two color spaces, with 8-bit color.
typedef SPAPI SPErr(*) ColorSpace_Convert16 (short inputCSpace, short outputCSpace, Color16 *colorArray, short 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 (unsigned char *input_data, unsigned short *output_data, short count)
 Converts 8- to 16-bit color.
typedef SPAPI SPErr(*) ColorSpace_Convert16to8 (unsigned short *input_data, unsigned char *output_data, short count)
 Converts 16- to 18-bit color.
typedef SPAPI SPErr(*) ColorSpace_ConvertToMonitorRGB (short inputCSpace, Color8 *input_data, Color8 *output_data, short count)
 Converts color from inputCSpace to monitor RGB.
typedef SPAPI SPErr(*) ColorSpace_Convert32to8 (float *input_data, unsigned char *output_data, short count)
 Converts 32- to 8-bit color.

Define Documentation

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

Unique identifier for the Color Space Suite.

#define kPSColorSpaceSuiteVersion1   1

Color Space Suite, Version 1.


Typedef Documentation

typedef struct Color_T* ColorID

Identifier for the Color Space.

typedef unsigned char Color8[4]

Representation of 8-bit color. 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. 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 unsigned short 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 float Color32[4]

typedef SPAPI SPErr(*) ColorSpace_Make(ColorID *id)

Makes a new color space.

Parameters:
ColorID ID of the color space.
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_Delete(ColorID *id)

Deletes a color space.

Parameters:
ColorID ID of the color space to delete.
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_StuffComponents(ColorID id, short colorSpace, unsigned char component0, unsigned char component1, unsigned char component2, unsigned char component3)

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

Parameters:
ColorID ID of the color space to stuff components into.
colorSpace The type of color space used. See Color Space for values.
component0 The value to stuff for component 0. The values depend on the type of color space.
component1 The value to stuff for component 1. The values depend on the type of color space.
component2 The value to stuff for component 2. The values depend on the type of color space.
component3 The 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, short colorSpace, unsigned char *component0, unsigned char *component1, unsigned char *component2, unsigned char *component3, Boolean *gamutFlag)

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

Parameters:
ColorID ID of the color space to extract components from.
colorSpace The 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:
ColorID ID of the color space to stuff color into.
xyz XYZ 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:
ColorID ID 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, short *colorSpace)

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

Parameters:
ColorID ID 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(short inputCSpace, short outputCSpace, Color8 *colorArray, short count)

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

Parameters:
inputCSpace Type of color space to convert from. See Color Space for values.
outputCSpace Type 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.
count How many items in the colorArray
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_Convert16(short inputCSpace, short outputCSpace, Color16 *colorArray, short count)

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

Parameters:
inputCSpace Type of color space to convert from. See Color Space for values.
outputCSpace Type 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.
count How 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:
ColorID ID 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:
ColorID ID 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.
promptString String used in the prompt for the color picker.
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_Convert8to16(unsigned char *input_data, unsigned short *output_data, short 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_data Block of data to convert from 8 bit color.
output_data [OUT] Block of data to receive the conversion into 16 bit color.
count How many items to convert
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_Convert16to8(unsigned short *input_data, unsigned char *output_data, short 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_data Block of data to convert from 16 bit color.
output_data [OUT] Block of data to receive the conversion into 18 bit color.
count How many to convert
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_ConvertToMonitorRGB(short inputCSpace, Color8 *input_data, Color8 *output_data, short count)

Converts color from inputCSpace to monitor RGB.

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

Parameters:
inputCSpace The color space to convert from. See Color Space for values.
input_data Block of data to convert from 8 bit color.
output_data [OUT] Block of data to receive the conversion into monitor RGB color.
count How many to convert
Returns:
Non-zero error if failure.

typedef SPAPI SPErr(*) ColorSpace_Convert32to8(float *input_data, unsigned char *output_data, short 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_data Block of data to convert from 32 bit color.
output_data [OUT] Block of data to receive the conversion into 8 bit color.
count How many items to convert
Returns:
Non-zero error if failure.