org.apache.fop.render.pdf

## Class ImageRenderedAdapter

- java.lang.Object
- - org.apache.fop.render.pdf.AbstractImageAdapter
  - - org.apache.fop.render.pdf.ImageRenderedAdapter

- All Implemented Interfaces:
    PDFImage

      public class ImageRenderedAdapter
      extends AbstractImageAdapter

  PDFImage implementation for the PDF renderer which handles RenderedImages.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.render.pdf.AbstractImageAdapter

      `image`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageRenderedAdapter(org.apache.xmlgraphics.image.loader.impl.ImageRendered image, String key)` Creates a new PDFImage from an Image instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBitsPerComponent()` Get the bits per color component for this image.
    `PDFDeviceColorSpace` | `getColorSpace()` Get the color space for this image.
    `protected ICC_Profile` | `getEffectiveICCProfile()` Returns the effective ICC profile for the image.
    `String` | `getFilterHint()` Returns a hint in form of a String (Possible values from PDFFilterList) indicating which filter setup should be used to encode the object.
    `int` | `getHeight()` Get the image height in pixels.
    `org.apache.xmlgraphics.image.loader.impl.ImageRendered` | `getImage()` Returns the ImageRendered instance for this adapter.
    `protected ColorSpace` | `getImageColorSpace()` Returns the image's color space.
    `String` | `getMask()` Get the PDF reference for a bitmap mask.
    `PDFFilter` | `getPDFFilter()` Get the PDF Filter to be applied to the image.
    `PDFReference` | `getSoftMaskReference()` Get the PDF reference for a soft mask.
    `PDFColor` | `getTransparentColor()` Get the transparent color.
    `int` | `getWidth()` Get the image width in pixels.
    `boolean` | `isTransparent()` Check if this image has a transparent color transparency.
    `void` | `outputContents(OutputStream out)` Writes the raw, unencoded contents of the image to a given output stream.
    `void` | `populateXObjectDictionary(PDFDictionary dict)` Populates the XObject's dictionary with additional values.
    `void` | `setup(PDFDocument doc)` Setup the PDF image for the current document.

    - ### Methods inherited from class org.apache.fop.render.pdf.AbstractImageAdapter

      `disallowMultipleFilters, getICCStream, getKey, getSoftMask, isInverted, isPS, issRGB, multipleFiltersAllowed, populateXObjectDictionaryForIndexColorModel, toPDFColorSpace`

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

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

- - ### Constructor Detail

    - #### ImageRenderedAdapter

          public ImageRenderedAdapter(org.apache.xmlgraphics.image.loader.impl.ImageRendered image,
                                      String key)

      Creates a new PDFImage from an Image instance.
      Parameters:
        `image` - the image
        `key` - XObject key

  - ### Method Detail

    - #### getImage

          public org.apache.xmlgraphics.image.loader.impl.ImageRendered getImage()

      Returns the ImageRendered instance for this adapter.
      Returns:
        the ImageRendered instance

    - #### getWidth

          public int getWidth()

      Get the image width in pixels.
      Specified by:
        `getWidth` in interface `PDFImage`
      Overrides:
        `getWidth` in class `AbstractImageAdapter`
      Returns:
        the image width

    - #### getHeight

          public int getHeight()

      Get the image height in pixels.
      Specified by:
        `getHeight` in interface `PDFImage`
      Overrides:
        `getHeight` in class `AbstractImageAdapter`
      Returns:
        the image height

    - #### getImageColorSpace

          protected ColorSpace getImageColorSpace()

      Returns the image's color space.
      Overrides:
        `getImageColorSpace` in class `AbstractImageAdapter`
      Returns:
        the color space

    - #### getEffectiveICCProfile

          protected ICC_Profile getEffectiveICCProfile()

      Returns the effective ICC profile for the image.
      Overrides:
        `getEffectiveICCProfile` in class `AbstractImageAdapter`
      Returns:
        an ICC profile or null

    - #### setup

          public void setup(PDFDocument doc)

      Setup the PDF image for the current document. Some image formats may need to access the document (for example to add an ICC profile to the document).
      Specified by:
        `setup` in interface `PDFImage`
      Overrides:
        `setup` in class `AbstractImageAdapter`
      Parameters:
        `doc` - the PDF parent document (todo) Remove this and delegate to the XObject

    - #### getColorSpace

          public PDFDeviceColorSpace getColorSpace()

      Get the color space for this image. Possible results are: DeviceGray, DeviceRGB, or DeviceCMYK
      Returns:
        the color space

    - #### getBitsPerComponent

          public int getBitsPerComponent()

      Get the bits per color component for this image.
      Returns:
        the bits per component

    - #### isTransparent

          public boolean isTransparent()

      Check if this image has a transparent color transparency. Classes such as `PDFImageXObject` rely on this simple binary model of transparency (e.g. compare to `Transparency`) in order to render color key masking (see PDF Spec 1.7 Chapter 8.9.6.4). Therefore only return true if image has fully transparent colors.
      Specified by:
        `isTransparent` in interface `PDFImage`
      Overrides:
        `isTransparent` in class `AbstractImageAdapter`
      Returns:
        true if it has at least one fully transparent color

    - #### getTransparentColor

          public PDFColor getTransparentColor()

      Get the transparent color.
      Specified by:
        `getTransparentColor` in interface `PDFImage`
      Overrides:
        `getTransparentColor` in class `AbstractImageAdapter`
      Returns:
        the transparent color for this image

    - #### getMask

          public String getMask()

      Get the PDF reference for a bitmap mask.
      Specified by:
        `getMask` in interface `PDFImage`
      Overrides:
        `getMask` in class `AbstractImageAdapter`
      Returns:
        the PDF reference for the mask image

    - #### getSoftMaskReference

          public PDFReference getSoftMaskReference()

      Get the PDF reference for a soft mask.
      Specified by:
        `getSoftMaskReference` in interface `PDFImage`
      Overrides:
        `getSoftMaskReference` in class `AbstractImageAdapter`
      Returns:
        the PDF reference for a soft mask image (or null if there's no soft mask)

    - #### getPDFFilter

          public PDFFilter getPDFFilter()

      Get the PDF Filter to be applied to the image.
      Returns:
        the PDF Filter or null

    - #### outputContents

          public void outputContents(OutputStream out)
                              throws IOException

      Writes the raw, unencoded contents of the image to a given output stream.
      Parameters:
        `out` - OutputStream to write to
      Throws:
        `IOException` - if there creating stream

    - #### populateXObjectDictionary

          public void populateXObjectDictionary(PDFDictionary dict)

      Populates the XObject's dictionary with additional values. The values are added to the dictionary after all the values obtained from other methods from this interface have been put into the dictionary. That allows to override certain values.
      Specified by:
        `populateXObjectDictionary` in interface `PDFImage`
      Overrides:
        `populateXObjectDictionary` in class `AbstractImageAdapter`
      Parameters:
        `dict` - the dictionary to fill

    - #### getFilterHint

          public String getFilterHint()

      Returns a hint in form of a String (Possible values from PDFFilterList) indicating which filter setup should be used to encode the object.
      Returns:
        the filter setup hint

Copyright © 2023 Apache Software Foundation. All rights reserved.