org.apache.fop.pdf

## Class PDFICCBasedColorSpace

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFICCBasedColorSpace

- All Implemented Interfaces:
    PDFColorSpace, PDFWritable

      public class PDFICCBasedColorSpace
      extends PDFObject
      implements PDFColorSpace

  Represents an ICCBased color space in PDF.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.pdf.PDFObject

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFICCBasedColorSpace(PDFICCStream iccStream)` Constructs a the ICCBased color space.
    `PDFICCBasedColorSpace(java.lang.String explicitName, PDFICCStream iccStream)` Constructs a the ICCBased color space with an explicit name (ex.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `getChildren(java.util.Set<PDFObject> children)`
    `PDFICCStream` | `getICCStream()`
    `java.lang.String` | `getName()`
    `int` | `getNumComponents()` Get the number of color components for this colorspace
    `boolean` | `isCMYKColorSpace()`
    `boolean` | `isDeviceColorSpace()`
    `boolean` | `isGrayColorSpace()`
    `boolean` | `isRGBColorSpace()`
    `static PDFICCBasedColorSpace` | `setupsRGBAsDefaultRGBColorSpace(PDFDocument pdfDoc)` Sets sRGB as the DefaultRGB color space in the PDF document.
    `static PDFICCStream` | `setupsRGBColorProfile(PDFDocument pdfDoc)` Sets up the sRGB color profile in the PDF document.
    `static PDFICCBasedColorSpace` | `setupsRGBColorSpace(PDFDocument pdfDoc)` Installs the sRGB color space in the PDF document.
    `protected java.lang.String` | `toPDFString()` This method returns a String representation of the PDF object.

    - ### Methods inherited from class org.apache.fop.pdf.PDFObject

      `contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PDFICCBasedColorSpace

          public PDFICCBasedColorSpace(java.lang.String explicitName,
                                       PDFICCStream iccStream)

      Constructs a the ICCBased color space with an explicit name (ex. "DefaultRGB").
      Parameters:
        `explicitName` - an explicit name or null if a name should be generated
        `iccStream` - the ICC stream to associate with this color space

    - #### PDFICCBasedColorSpace

          public PDFICCBasedColorSpace(PDFICCStream iccStream)

      Constructs a the ICCBased color space.
      Parameters:
        `iccStream` - the ICC stream to associate with this color space

  - ### Method Detail

    - #### getICCStream

          public PDFICCStream getICCStream()

      Returns:
        the ICC stream associated with this color space

    - #### 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

    - #### toPDFString

          protected java.lang.String toPDFString()

      This method returns a String representation of the PDF object. The result is normally converted/encoded to a byte array by toPDF(). Only use this method to implement the serialization if the object can be fully represented as text. If the PDF representation of the object contains binary content use toPDF() or output(OutputStream) instead. This applies to any object potentially containing a string object because string object are encrypted and therefore need to be binary.
      Overrides:
        `toPDFString` in class `PDFObject`
      Returns:
        String the String representation

    - #### setupsRGBAsDefaultRGBColorSpace

          public static PDFICCBasedColorSpace setupsRGBAsDefaultRGBColorSpace(PDFDocument pdfDoc)

      Sets sRGB as the DefaultRGB color space in the PDF document.
      Parameters:
        `pdfDoc` - the PDF document
      Returns:
        the newly installed color space object

    - #### setupsRGBColorSpace

          public static PDFICCBasedColorSpace setupsRGBColorSpace(PDFDocument pdfDoc)

      Installs the sRGB color space in the PDF document.
      Parameters:
        `pdfDoc` - the PDF document
      Returns:
        the newly installed color space object

    - #### setupsRGBColorProfile

          public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc)

      Sets up the sRGB color profile in the PDF document. It does so by trying to install a very small ICC profile (~4KB) instead of the very big one (~140KB) the Sun JVM uses.
      Parameters:
        `pdfDoc` - the PDF document
      Returns:
        the ICC stream with the sRGB profile

    - #### getChildren

          public void getChildren(java.util.Set<PDFObject> children)

      Overrides:
        `getChildren` in class `PDFObject`

Copyright 1999-2020 The Apache Software Foundation. All Rights Reserved.