I am trying to create a custom CGColorSpace in Swift on macOS but am not sure I really understand the concepts.
I want to use a custom color space called Spot1 and if I extract the spot color from a PDF I get the following:
"ColorSpace<Dictionary>" = {
"Cs2<Array>" = (
Separation,
Spot1,
DeviceCMYK,
{
"BitsPerSample<Integer>" = 8;
"Domain<Array>" = (
0,
1
);
"Filter<Name>" = FlateDecode;
"FunctionType<Integer>" = 0;
"Length<Integer>" = 526;
"Range<Array>" = (
0,
1,
0,
1,
0,
1,
0,
1
);
"Size<Array>" = (
1024
);
}
);
};
How can I create this same color space using the CGColorSpace(propertyListPlist: CFPropertyList)
API
func createSpot1() -> CGColorSpace? {
let dict0 : NSDictionary = [
"BitsPerSample": 8,
"Domain" : [0,1],
"Filter" : "FlateDecode",
"FunctionType" : 0,
"Length" : 526,
"Range" : [0,1,0,1,0,1,0,1],
"Size" : [1024]]
let dict : NSDictionary = [
"Cs2" : ["Separation","Spot1", "DeviceCMYK", dict0]
]
let space = CGColorSpace(propertyListPlist: dict as CFPropertyList)
if space == nil {
DebugLog("Spot1 color space is nil!")
}
return space
}