Class ProfileRed

java.lang.Object
org.apache.batik.ext.awt.image.rendered.AbstractRed
org.apache.batik.ext.awt.image.rendered.ProfileRed
All Implemented Interfaces:
RenderedImage, CachableRed

public class ProfileRed extends AbstractRed
This implementation of rendered image forces a color profile on its source
Version:
$Id: ProfileRed.java 1808888 2017-09-19 14:22:11Z ssteiner $
  • Field Details

    • sRGBCS

      private static final ColorSpace sRGBCS
    • sRGBCM

      private static final ColorModel sRGBCM
    • colorSpace

      private org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent colorSpace
  • Constructor Details

    • ProfileRed

      public ProfileRed(CachableRed src, org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent colorSpace)
      Parameters:
      src - Images on which the input ColorSpace should be forced
      colorSpace - colorSpace that should be forced on the source
  • Method Details

    • getSource

      public CachableRed getSource()
    • copyData

      public WritableRaster copyData(WritableRaster argbWR)
      This method will turn the input image in an sRGB image as follows. If there is no colorSpace defined, then the input image is simply converted to singlePixelPacked sRGB if needed. If there is a colorSpace defined, the the image data is 'interpreted' as being in that space, instead of that of the image's colorSpace. Here is how the input image is processed: a. It is converted to using a ComponentColorModel b. Its data is extracted, ignoring it's ColorSpace c. A new ComponentColorModel is built for the replacing colorSpace Note that if the number of components in the input image and the number of components in the replacing ColorSpace do not match, it is not possible to apply the conversion. d. A new BufferedImage is built, using the new ComponentColorModel and the data from the original image converted to the ComponentColorModel built in a. The alpha channel is excluded from that new BufferedImage. e. The BufferedImage created in d. is converted to sRGB using ColorConvertOp f. The alpha channel information is integrated back into the image. IMPORTANT NOTE: The code uses a BandedSampleModel in c.) and d.) and discard the alpha channel during the color conversions (it is restored in f.)), because of bugs in the interleaved model with alpha. The BandedSampleModel did not cause any bug as of JDK 1.3.