JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org

org.jpedal.io
Class ColorSpaceConvertor

java.lang.Object
  extended by org.jpedal.io.ColorSpaceConvertor

public class ColorSpaceConvertor
extends java.lang.Object

set of static methods to save/load objects to convert images between different colorspaces - Several methods are very similar and I should recode my code to use a common method for the RGB conversion LogWriter is JPedal logging class


Field Summary
static boolean isUsingARGB
          Flag to trigger raster printing
 
Constructor Summary
ColorSpaceConvertor()
           
 
Method Summary
static java.awt.image.BufferedImage algorithmicConvertCMYKImageToRGB(byte[] buffer, int w, int h)
          save raw CMYK data by converting to RGB using algorithm method - pdfsages supplied the C source and I have converted - This works very well on most colours but not dark shades which are all rolled into black This is what xpdf seems to use - Note we store the output data in our input queue to reduce memory usage - we have seen raw 2000 * 2000 images and having input and output buffers is a LOT of memory - I have kept the doubles in as I just rewrote Leonard's code - I haven't really looked at optimisation beyond memory issues
static java.awt.image.BufferedImage algorithmicConvertYCbCrToRGB(byte[] buffer, int w, int h)
          convert YCbCr to RGB using formula
static java.awt.image.BufferedImage convertColorspace(java.awt.image.BufferedImage image, int newType)
          convert a BufferedImage to RGB colourspace
static java.awt.image.BufferedImage convertFromICCCMYK(int width, int height, byte[] data)
          slightly contrived but very effective way to convert to RGB
static java.awt.image.BufferedImage convertIndexedToFlat(int d, int w, int h, byte[] data, byte[] index, boolean isARGB, boolean isDownsampled)
           
static java.awt.image.BufferedImage convertToARGB(java.awt.image.BufferedImage image)
          convert a BufferedImage to RGB colourspace (used when I clip the image)
static java.awt.image.BufferedImage convertToRGB(java.awt.image.BufferedImage image)
          convert any BufferedImage to RGB colourspace
static java.awt.image.WritableRaster createCompatibleWritableRaaster(java.awt.image.ColorModel colorModel, int w, int h)
           
static java.awt.image.Raster createInterleavedRaster(byte[] data, int w, int h)
           
static void drawImage(java.awt.Graphics2D g2, java.awt.image.BufferedImage tileImg, java.awt.geom.AffineTransform tileAff, java.awt.image.ImageObserver observer)
           
static java.awt.image.BufferedImage iccConvertCMYKImageToRGB(byte[] buffer, int w, int h)
          convert YCC to CMY via formula and the CMYK to sRGB via profiles
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isUsingARGB

public static boolean isUsingARGB
Flag to trigger raster printing

Constructor Detail

ColorSpaceConvertor

public ColorSpaceConvertor()
Method Detail

convertFromICCCMYK

public static java.awt.image.BufferedImage convertFromICCCMYK(int width,
                                                              int height,
                                                              byte[] data)
slightly contrived but very effective way to convert to RGB


convertToRGB

public static java.awt.image.BufferedImage convertToRGB(java.awt.image.BufferedImage image)
convert any BufferedImage to RGB colourspace


convertToARGB

public static java.awt.image.BufferedImage convertToARGB(java.awt.image.BufferedImage image)
convert a BufferedImage to RGB colourspace (used when I clip the image)


algorithmicConvertCMYKImageToRGB

public static java.awt.image.BufferedImage algorithmicConvertCMYKImageToRGB(byte[] buffer,
                                                                            int w,
                                                                            int h)
save raw CMYK data by converting to RGB using algorithm method - pdfsages supplied the C source and I have converted - This works very well on most colours but not dark shades which are all rolled into black This is what xpdf seems to use - Note we store the output data in our input queue to reduce memory usage - we have seen raw 2000 * 2000 images and having input and output buffers is a LOT of memory - I have kept the doubles in as I just rewrote Leonard's code - I haven't really looked at optimisation beyond memory issues


algorithmicConvertYCbCrToRGB

public static java.awt.image.BufferedImage algorithmicConvertYCbCrToRGB(byte[] buffer,
                                                                        int w,
                                                                        int h)
convert YCbCr to RGB using formula


convertIndexedToFlat

public static java.awt.image.BufferedImage convertIndexedToFlat(int d,
                                                                int w,
                                                                int h,
                                                                byte[] data,
                                                                byte[] index,
                                                                boolean isARGB,
                                                                boolean isDownsampled)

iccConvertCMYKImageToRGB

public static java.awt.image.BufferedImage iccConvertCMYKImageToRGB(byte[] buffer,
                                                                    int w,
                                                                    int h)
                                                             throws java.io.IOException
convert YCC to CMY via formula and the CMYK to sRGB via profiles

Throws:
java.io.IOException

convertColorspace

public static java.awt.image.BufferedImage convertColorspace(java.awt.image.BufferedImage image,
                                                             int newType)
convert a BufferedImage to RGB colourspace


createCompatibleWritableRaaster

public static java.awt.image.WritableRaster createCompatibleWritableRaaster(java.awt.image.ColorModel colorModel,
                                                                            int w,
                                                                            int h)

createInterleavedRaster

public static java.awt.image.Raster createInterleavedRaster(byte[] data,
                                                            int w,
                                                            int h)

drawImage

public static void drawImage(java.awt.Graphics2D g2,
                             java.awt.image.BufferedImage tileImg,
                             java.awt.geom.AffineTransform tileAff,
                             java.awt.image.ImageObserver observer)

JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org

JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org