Interface OutputProfiler.ColorAction

  • All Known Implementing Classes:
    OutputProfiler.ProcessColorAction
    Enclosing class:
    OutputProfiler

    public static interface OutputProfiler.ColorAction
    An action that can be set on an OutputProfiler to replace Colors. Note some methods were added to this interface in 2.26
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int TYPE_ANNOTATION
      If this bit is set, the color being converted is in an annotation rather than on the page directly
      static int TYPE_BITMAP
      If this bit is set, the color being converted is part of a bitmap image Test with type & (1<<TYPE_SHADING)
      static int TYPE_CALIBRATED
      If this bit is set, the ColorSpace is considered to be device-independent, either directly (if a process ColorSpace) or indirectly (if a separation ColorSpace that references a device-indepdendent ColorSpace).
      static int TYPE_INDEXED
      If this bit is set, the color being converted is in an indexed color-space built on the supplied color-space
      static int TYPE_INLINE  
      static int TYPE_PROCESS
      If this bit is set, the color is a process ColorSpace - either RGB, CMYK or Grayscale.
      static int TYPE_SEPARATION
      If this bit is set, the color is a separation ColorSpace - a DeviceN or Spot color.
      static int TYPE_SHADING
      If this bit is set, the color being converted is part of a shading pattern Test with type & (1<<TYPE_SHADING)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.awt.color.ColorSpace changeColor​(OutputProfiler profiler, java.awt.color.ColorSpace cs, float[] src, float[] dst, boolean fill, int type)
      Optionally converts a Color from one ColorSpace to another.
      java.awt.color.ColorSpace getDefaultBlendingColorSpace()
      Return the ColorSpace that should be used for blending operations, or null if unknown
      java.awt.color.ColorSpace getDeviceCMYK()
      Return the CMYK ColorSpace that should be used as the "DeviceCMYK" space, or null if none is set.
      java.awt.color.ColorSpace getDeviceGray()
      Return the Gray ColorSpace that should be used as the "DeviceGray" space, or null if none is set.
      java.awt.color.ColorSpace getDeviceRGB()
      Return the RGB ColorSpace that should be used as the "DeviceRGB" space, or null if none is set.
      java.awt.color.ColorSpace getUsedIntentColorSpace()
      Return the ColorSpace that's considered to be the ColorSpace of the OutputIntent.
    • Field Detail

      • TYPE_CALIBRATED

        static final int TYPE_CALIBRATED
        If this bit is set, the ColorSpace is considered to be device-independent, either directly (if a process ColorSpace) or indirectly (if a separation ColorSpace that references a device-indepdendent ColorSpace). Colors of this type do not normally need conversion to be acceptable in PDF/A or PDF/X Test with type & (1<<TYPE_CALIBRATED)
        See Also:
        Constant Field Values
      • TYPE_SEPARATION

        static final int TYPE_SEPARATION
        If this bit is set, the color is a separation ColorSpace - a DeviceN or Spot color. Test with type & (1<<TYPE_SEPARATION)
        See Also:
        Constant Field Values
      • TYPE_PROCESS

        static final int TYPE_PROCESS
        If this bit is set, the color is a process ColorSpace - either RGB, CMYK or Grayscale. Test with type & (1<<TYPE_PROCESS)
        See Also:
        Constant Field Values
      • TYPE_SHADING

        static final int TYPE_SHADING
        If this bit is set, the color being converted is part of a shading pattern Test with type & (1<<TYPE_SHADING)
        Since:
        2.24.2
        See Also:
        Constant Field Values
      • TYPE_BITMAP

        static final int TYPE_BITMAP
        If this bit is set, the color being converted is part of a bitmap image Test with type & (1<<TYPE_SHADING)
        Since:
        2.24.2
        See Also:
        Constant Field Values
      • TYPE_ANNOTATION

        static final int TYPE_ANNOTATION
        If this bit is set, the color being converted is in an annotation rather than on the page directly
        See Also:
        Constant Field Values
      • TYPE_INDEXED

        static final int TYPE_INDEXED
        If this bit is set, the color being converted is in an indexed color-space built on the supplied color-space
        Since:
        2.28.4
        See Also:
        Constant Field Values
    • Method Detail

      • changeColor

        java.awt.color.ColorSpace changeColor​(OutputProfiler profiler,
                                              java.awt.color.ColorSpace cs,
                                              float[] src,
                                              float[] dst,
                                              boolean fill,
                                              int type)

        Optionally converts a Color from one ColorSpace to another.

        If the source Color is to be converted, this method should return the ColorSpace it will be converted to, and populate the dst array with the new color components if dst is not null. If dst is null, it is sufficient to just return the target ColorSpace (which may be the same as the source ColorSpace, for example if the Colors are simply being retinted).

        If no change is to be made, this method should return null. If "dst" is not null and this method returns null, subsequent calls to changeColor will be skipped. This optimization can be used when the ColorSpace of an image has been changed, but the components remain identical.

        This method must be consistent and return the same output for the same input parameters. It must also be quick, as it may be called millions of times during preflighting (as it must be called once for each pixel).

        Parameters:
        profiler - the OutputProfiler this action is being run on
        cs - the source ColorSpace
        src - the source Color components
        dst - if not null, should be updated with the target Color components
        fill - true if the Color will be used for filling, false if for stroking
        type - the type of ColorSpace, which will be a bitmask possibly including one or more of #TYPE_PROCESS, #TYPE_CALIBRATED, #TYPE_SEPARATION, #TYPE_SHADING or #TYPE_BITMAP
        Returns:
        the target ColorSpace or null for no change.
      • getDeviceRGB

        java.awt.color.ColorSpace getDeviceRGB()
        Return the RGB ColorSpace that should be used as the "DeviceRGB" space, or null if none is set.
        Since:
        2.26
      • getDeviceCMYK

        java.awt.color.ColorSpace getDeviceCMYK()
        Return the CMYK ColorSpace that should be used as the "DeviceCMYK" space, or null if none is set.
        Since:
        2.26
      • getDeviceGray

        java.awt.color.ColorSpace getDeviceGray()
        Return the Gray ColorSpace that should be used as the "DeviceGray" space, or null if none is set.
        Since:
        2.26
      • getDefaultBlendingColorSpace

        java.awt.color.ColorSpace getDefaultBlendingColorSpace()
        Return the ColorSpace that should be used for blending operations, or null if unknown
        Since:
        2.26
      • getUsedIntentColorSpace

        java.awt.color.ColorSpace getUsedIntentColorSpace()
        Return the ColorSpace that's considered to be the ColorSpace of the OutputIntent. This is typically the first ColorSpace from any OutputIntents on the OutputProfile supplied to the constructor. Returns null if none is set
        Since:
        2.26