Example usage for com.itextpdf.kernel.colors Color getColorSpace

List of usage examples for com.itextpdf.kernel.colors Color getColorSpace

Introduction

In this page you can find the example usage for com.itextpdf.kernel.colors Color getColorSpace.

Prototype

public PdfColorSpace getColorSpace() 

Source Link

Document

Returns the com.itextpdf.kernel.pdf.colorspace.PdfColorSpace color space to which the color is related.

Usage

From source file:org.reactome.server.tools.diagram.exporter.raster.itext.awt.PdfGraphics2D.java

License:Open Source License

private static com.itextpdf.kernel.colors.Color prepareColor(Color color) {
    if (color.getColorSpace().getType() == ColorSpace.TYPE_CMYK) {
        float[] comp = color.getColorComponents(null);
        return new DeviceCmyk(comp[0], comp[1], comp[2], comp[3]);
    } else {/*from w  ww .j a v a 2s. co m*/
        return new DeviceRgb(color.getRed(), color.getGreen(), color.getBlue());

    }
}