Further investigation seems to indicate that the Apple Core Graphics API does not natively support the Separation color space (as defined by Adobe) but it does support DeviceN color spaces - or Color Models. DeviceN color spaces support Spot colors so this seems like an option for us to use. However it is still unclear how one would create such a DeviceN color space.
[% Define the color space to be DeviceN
/DeviceN
[/Ruby /Emerald /Sapphire /Turquoise
/Amethyst /Citrine]
/DeviceRGB
{%define new values and clip to 1.0
6 -1 roll 1 index add 2 index add
6 -1 roll 2 index add 4 index add
6 3 roll add add 4 -1 roll pop
3 -1 roll dup 1 gt {pop 1} if
3 -1 roll dup 1 gt {pop 1} if
3 -1 roll dup 1 gt {pop 1} if
}
] setcolorspace
I did find this pseudo code for C# which seems to shed some light on it.
> Spot color can be represented in PDF using 'Separation' or 'DeviceN'
> color spaces.
>
> A separation color space can be treated similarly to grayscale color
> space. For details on separation color space, please refer to section
> 4.5.5 'Special Color Spaces' in PDF Reference Manual
> (http://www.pdftron.com/downloads/PDFReference16.pdf).
>
> The following C# pseudocode can be used to create a separation color
> space based on a PostScript function:
>
> static ColorSpace CreateSpotColorSpace(PDFDoc doc)
> {
> Obj sep_cs = doc.CreateIndirectArray();
>
> sep_cs.PushBackName("Separation");
> sep_cs.PushBackName("LogoGreen"); // The name of the colorant
> sep_cs.PushBackName("DeviceCMYK"); // Alternate color space
>
> // Create tint function (using PostScript calculator function).
> // Tint function is used to transform a tint value into color
> // component values in the alternate color space.
> string ps_funct = "{ dup 0.84 mul exch 0.00 exch dup 0.44 mul exch
> 0.21 mul }";
> Obj tint_funct = doc.CreateIndirectStream(new
> System.Text.UTF8Encoding().GetBytes(ps_funct));
> tint_funct.PutNumber("FunctionType", 4);
>
> Obj tint_domain = tint_funct.PutArray("Domain");
> tint_domain.PushBackNumber(0); // Gray
> tint_domain.PushBackNumber(1);
>
> Obj tint_range = tint_funct.PutArray("Range");
> tint_range.PushBackNumber(0); // C
> tint_range.PushBackNumber(1);
> tint_range.PushBackNumber(0); // M
> tint_range.PushBackNumber(1);
> tint_range.PushBackNumber(0); // Y
> tint_range.PushBackNumber(1);
> tint_range.PushBackNumber(0); // K
> tint_range.PushBackNumber(1);
>
> sep_cs.PushBack(tint_funct);
> return new ColorSpace(sep_cs);
>
> }
So how would one define such a DeviceN color space using the Core Graphics API ?
I am assuming that one should be able to define this using a CFPropertyList and then use the CGColorSpace(propertyListPlist: CFPropertyList) API to do so.
Any help would be appreciated.