Color implements Serializable { public static DeviceCmyk convertRgbToCmyk(DeviceRgb rgbColor) { float redComp = rgbColor.getColorValue()[0]; float greenComp = rgbColor.getColorValue()[1]; float blueComp = rgbColor.getColorValue()[2]; float k = 1 - Math.max(Math.max(redComp, greenComp), blueComp); float c = (1 - redComp - k) / (1 - k); float m = (1 - greenComp - k) / (1 - k); float y = (1 - blueComp - k) / (1 - k); return new DeviceCmyk(c, m, y, k); } protected  Color(PdfColorSpace colorSpace, float[] colorValue); static Color makeColor(PdfColorSpace colorSpace); static Color makeColor(PdfColorSpace colorSpace, float[] colorValue); static DeviceRgb convertCmykToRgb(DeviceCmyk cmykColor); static DeviceCmyk convertRgbToCmyk(DeviceRgb rgbColor); int getNumberOfComponents(); PdfColorSpace getColorSpace(); float[] getColorValue(); void setColorValue(float[] value); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void convertRgbToCmykTest() { DeviceCmyk cmyk = new DeviceCmyk(0, 0, 0, 0); DeviceRgb rgb = new DeviceRgb(255, 255, 255); Assert.assertArrayEquals(cmyk.colorValue, Color.convertRgbToCmyk(rgb).colorValue, EPS); }