/** * Create a new Separation color space. * @param res the resource context (may be null) * @param ncs the named color space to map to a separation color space * @return the newly created Separation color space */ public PDFSeparationColorSpace makeSeparationColorSpace(PDFResourceContext res, NamedColorSpace ncs) { String colorName = ncs.getColorName(); final Double zero = 0d; final Double one = 1d; List domain = Arrays.asList(new Double[] {zero, one}); List range = Arrays.asList(new Double[] {zero, one, zero, one, zero, one}); float[] cZero = new float[] {1f, 1f, 1f}; float[] cOne = ncs.getRGBColor().getColorComponents(null); PDFFunction tintFunction = makeFunction(domain, range, cZero, cOne, 1.0d); PDFSeparationColorSpace cs = new PDFSeparationColorSpace(colorName, tintFunction); getDocument().registerObject(cs); if (res != null) { res.getPDFResources().addColorSpace(cs); } else { getDocument().getResources().addColorSpace(cs); } return cs; }