Class PDFDeviceColorSpace

  • All Implemented Interfaces:
    PDFColorSpace

    public class PDFDeviceColorSpace
    extends java.lang.Object
    implements PDFColorSpace
    Represents a device-specific color space. Used for mapping DeviceRGB, DeviceCMYK and DeviceGray.
    • Field Detail

      • numComponents

        private int numComponents
      • DEVICE_UNKNOWN

        public static final int DEVICE_UNKNOWN
        Unknown colorspace
        See Also:
        Constant Field Values
      • currentColorSpace

        protected int currentColorSpace
        Current color space value.
    • Constructor Detail

      • PDFDeviceColorSpace

        public PDFDeviceColorSpace​(int theColorSpace)
        Create a PDF colorspace object.
        Parameters:
        theColorSpace - the current colorspace
    • Method Detail

      • calculateNumComponents

        private int calculateNumComponents()
      • setColorSpace

        public void setColorSpace​(int theColorSpace)
        Set the current colorspace.
        Parameters:
        theColorSpace - the new color space value
      • getColorSpace

        public int getColorSpace()
        Get the colorspace value
        Returns:
        the colorspace value
      • getNumComponents

        public int getNumComponents()
        Get the number of color components for this colorspace
        Specified by:
        getNumComponents in interface PDFColorSpace
        Returns:
        the number of components
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface PDFColorSpace
        Returns:
        the name of the color space
      • isDeviceColorSpace

        public boolean isDeviceColorSpace()
        Specified by:
        isDeviceColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is a device-dependent color space (like DeviceRGB, DeviceCMYK and DeviceGray)
      • isRGBColorSpace

        public boolean isRGBColorSpace()
        Specified by:
        isRGBColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is an RGB color space
      • isCMYKColorSpace

        public boolean isCMYKColorSpace()
        Specified by:
        isCMYKColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is an CMYK color space
      • isGrayColorSpace

        public boolean isGrayColorSpace()
        Specified by:
        isGrayColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is an Gray color space
      • toPDFColorSpace

        public static PDFDeviceColorSpace toPDFColorSpace​(java.awt.color.ColorSpace cs)
        Returns a suitable PDFDeviceColorSpace object given a ColorSpace object.
        Parameters:
        cs - ColorSpace instance
        Returns:
        a PDF-based color space