org.faceless.pdf2

## Class OutputProfiler.ProcessColorAction

- java.lang.Object
- - org.faceless.pdf2.OutputProfiler.ProcessColorAction

- All Implemented Interfaces:
    OutputProfiler.ColorAction
  Enclosing class:
    OutputProfiler

      public static class OutputProfiler.ProcessColorAction
      extends Object
      implements OutputProfiler.ColorAction

  The `ProcessColorAction` class is an implementation of `OutputProfiler.ColorAction` which will convert any process colors into the specified ColorSpace. This may optionally include Calibrated colors. Seperation colors (i.e. those from a `SpotColorSpace` or `DeviceNColorSpace`) will be replaced with an identical color, but with their `fallback` ColorSpace mapped to the new ColorSpace if required.

- - ### Field Summary

    - ### Fields inherited from interface org.faceless.pdf2.OutputProfiler.ColorAction

      `TYPE_CALIBRATED, TYPE_PROCESS, TYPE_SEPARATION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProcessColorAction(ColorSpace process)` Create a new `ProcessColorAction`
    `ProcessColorAction(ColorSpace process, boolean calibrated)` Create a new `ProcessColorAction` and call `setAllowCalibrated(boolean)`
    `ProcessColorAction(OutputProfile target)` Create a new `ProcessColorAction` that will convert process colors to the ColorSpace specified in the supplied OutputProfile's Output Intent.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ColorSpace` | `changeColor(OutputProfiler profiler, ColorSpace cs, float[] src, float[] dst, boolean fill, int type)` Optionally converts a Color from one ColorSpace to another.
    `void` | `setAllowCalibrated(boolean allow)` Determines how process colors in a calibrated ColorSpace are modified.
    `void` | `setRenderingIntent(OutputProfiler.RenderingIntent intent)` Set the rendering intent, to control how out-of-gamut colors are converted.

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

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

- - ### Constructor Detail

    - #### ProcessColorAction

          public ProcessColorAction(ColorSpace process)

      Create a new `ProcessColorAction`
      Parameters:
        `process` - the process ColorSpace to convert colors to

    - #### ProcessColorAction

          public ProcessColorAction(ColorSpace process,
                                    boolean calibrated)

      Create a new `ProcessColorAction` and call `setAllowCalibrated(boolean)`
      Parameters:
        `process` - the process ColorSpace to convert colors to
        `calibrated` - the value to pass into `setAllowCalibrated(boolean)`

    - #### ProcessColorAction

          public ProcessColorAction(OutputProfile target)

      Create a new `ProcessColorAction` that will convert process colors to the ColorSpace specified in the supplied OutputProfile's Output Intent. This is the intended display condition for the PDF, and is a required part of the OutputProfile for PDF/A and PDF/X.

      Here's an example showing how to use this constructor to simplify conversion of a PDF to a PDF/A document with all uncalibrated colors converted to the Output Intent specifed in the profile.

           OutputProfiler profiler = new OutputProfiler(new PDFParser(pdf));
           OutputProfile profile = profiler.getProfile();

           ICC_Profile icc = ICC_Profile.getInstance("US_Web_Coated_SWOP.icm");
           OutputProfile target = new OutputProfile(OutputProfile.PDFA1b_2005, "http://www.color.org", null, icc);
           profiler.setColorAction(new OutputProfiler.ProcessColorAction(target));
           profiler.apply(target);

      Parameters:
        `target` - the OutputProfile to retrieve the Output Intent from. This should be a PDF/X or PDF/A OutputProfile, and must have an Output Intent profile set on it.
      See Also:
        `OutputProfile.setOutputIntent(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.awt.color.ICC_Profile)`, `OutputProfile.getOutputIntentDestinationProfile(java.lang.String)`

  - ### Method Detail

    - #### setAllowCalibrated

          public void setAllowCalibrated(boolean allow)

      Determines how process colors in a calibrated ColorSpace are modified. If true, calibrated colors are allowed and will remain unchanged, but device-dependent colors will be changed to the specified process ColorSpace (appropriate for PDF/A and PDF/X-3). If false, calibrated colors are disallowed and will be converted as well (appropriate for PDF/X-1). The default is true.
      Parameters:
        `allow` - whether calibrated process colors should remain unchanged

    - #### setRenderingIntent

          public void setRenderingIntent(OutputProfiler.RenderingIntent intent)

      Set the rendering intent, to control how out-of-gamut colors are converted. The default is `Perceptual`, and other values may not be supported depending on the ColorSpace. If not, the process will fall back to Perceptual
      Parameters:
        `intent` - the rendering intent for color conversion

    - #### changeColor

          public ColorSpace changeColor(OutputProfiler profiler,
                                        ColorSpace cs,
                                        float[] src,
                                        float[] dst,
                                        boolean fill,
                                        int type)

      Description copied from interface: `OutputProfiler.ColorAction`

      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`.

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

      Specified by:
        `changeColor` in interface `OutputProfiler.ColorAction`
      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 or #TYPE_SEPARATION
      Returns:
        the target ColorSpace or `null` for no change.

Copyright © 2001-2015 Big Faceless Organization