com.pixelmed.display
Class BufferedImageUtilities

java.lang.Object
  extended by com.pixelmed.display.BufferedImageUtilities

public class BufferedImageUtilities
extends Object


Field Summary
protected static String[] bufferTypeNames
          Indexes correspond to DataBuffer.TYPE_xxx values, except TYPE_UNDEFINED.
protected static String[] imageTypeNames
           
protected static String[] spaceTypeNames
          Indexes correspond to some ColorSpace.TYPE_xxx values.
 
Constructor Summary
BufferedImageUtilities()
           
 
Method Summary
static BufferedImage convertToMostFavorableImageType(BufferedImage srcImage)
           
static BufferedImage convertToMostFavorableImageTypeWithBandCombineOp(BufferedImage srcImage)
           
static BufferedImage convertToMostFavorableImageTypeWithDataBufferCopy(BufferedImage srcImage)
           
static BufferedImage convertToMostFavorableImageTypeWithGraphicsDraw(BufferedImage srcImage)
           
static BufferedImage convertToMostFavorableImageTypeWithPixelCopy(BufferedImage srcImage)
           
static BufferedImage convertToThreeChannelImageTypeIfFour(BufferedImage srcImage)
           
static BufferedImage convertYBRToRGB(BufferedImage srcImage)
           
static byte[] convertYBRToRGB(byte srcY, byte srcCb, byte srcCr, byte[] dst)
           
static void describeColorModel(ColorModel model, PrintStream out)
          Describe characteristics of ColorModel.
static void describeImage(BufferedImage image, PrintStream out)
          Describe characteristics of BufferedImage's Raster, SampleModel, ColorModel, etc.
static void describeRaster(Raster raster, PrintStream out)
          Describe characteristics of Raster.
static void flipHorizontally(BufferedImage srcImage)
           
static void flipVertically(BufferedImage srcImage)
           
static GraphicsConfiguration getDefaultGraphicsConfiguration()
           
static ColorModel getMostFavorableColorModel()
           
 BufferedImage resample(BufferedImage srcImage, int dstWidth, int dstHeight, boolean signed, int backgroundValue)
           
 BufferedImage resample(BufferedImage srcImage, int selectionWidth, int selectionHeight, int selectionXOffset, int selectionYOffset, int dstWidth, int dstHeight, boolean signed, int backgroundValue)
           
static BufferedImage resampleWithAffineTransformOp(BufferedImage srcImage, double sx, double sy)
           
static BufferedImage resampleWithAffineTransformOp(BufferedImage srcImage, int dstWidth, int dstHeight)
           
 BufferedImage resampleWithGraphicsDraw(BufferedImage srcImage, int selectionWidth, int selectionHeight, int selectionXOffset, int selectionYOffset, int dstWidth, int dstHeight)
           
static BufferedImage rotateAndFlipSwappingRowsAndColumns(BufferedImage srcImage)
           
static String transferTypeName(int bufferType)
           
static String typeName(ColorSpace space)
          Return name for its color-space type.
static String typeName(int imageType)
          Return name for given BufferedImage type.
static String typeName(int imageType, BufferedImage image)
          Return name for integer type and/or for BufferedImage's actual type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageTypeNames

protected static final String[] imageTypeNames

bufferTypeNames

protected static final String[] bufferTypeNames
Indexes correspond to DataBuffer.TYPE_xxx values, except TYPE_UNDEFINED.


spaceTypeNames

protected static final String[] spaceTypeNames
Indexes correspond to some ColorSpace.TYPE_xxx values.

Constructor Detail

BufferedImageUtilities

public BufferedImageUtilities()
Method Detail

typeName

public static String typeName(int imageType)
Return name for given BufferedImage type.


typeName

public static String typeName(int imageType,
                              BufferedImage image)

Return name for integer type and/or for BufferedImage's actual type.

If image is null, then name is for imageType alone.

If image is non-null, and its type matches imageType, then name is for imageType alone.

If image's type doesn't match imageType, then name is first for imageType, followed by image's actual type name in parentheses.

Parameters:
imageType -
image -
Returns:
String name

transferTypeName

public static String transferTypeName(int bufferType)

typeName

public static String typeName(ColorSpace space)

Return name for its color-space type.

Parameters:
space -
Returns:
String name

describeImage

public static void describeImage(BufferedImage image,
                                 PrintStream out)

Describe characteristics of BufferedImage's Raster, SampleModel, ColorModel, etc.

Parameters:
image -
out -

describeRaster

public static void describeRaster(Raster raster,
                                  PrintStream out)

Describe characteristics of Raster.

Parameters:
raster -
out -

describeColorModel

public static void describeColorModel(ColorModel model,
                                      PrintStream out)

Describe characteristics of ColorModel.

Parameters:
model -
out -

getDefaultGraphicsConfiguration

public static GraphicsConfiguration getDefaultGraphicsConfiguration()
Returns:
the GraphicsConfiguration that is likely to perform most efficiently on this host

getMostFavorableColorModel

public static ColorModel getMostFavorableColorModel()
Returns:
the ColorModel that is likely to perform most efficiently on this host

convertToMostFavorableImageTypeWithPixelCopy

public static final BufferedImage convertToMostFavorableImageTypeWithPixelCopy(BufferedImage srcImage)
Parameters:
srcImage -

convertToMostFavorableImageTypeWithDataBufferCopy

public static final BufferedImage convertToMostFavorableImageTypeWithDataBufferCopy(BufferedImage srcImage)
Parameters:
srcImage -

convertToMostFavorableImageTypeWithBandCombineOp

public static final BufferedImage convertToMostFavorableImageTypeWithBandCombineOp(BufferedImage srcImage)
Parameters:
srcImage -

convertToMostFavorableImageTypeWithGraphicsDraw

public static final BufferedImage convertToMostFavorableImageTypeWithGraphicsDraw(BufferedImage srcImage)
Parameters:
srcImage -

convertToMostFavorableImageType

public static final BufferedImage convertToMostFavorableImageType(BufferedImage srcImage)
Parameters:
srcImage -

convertToThreeChannelImageTypeIfFour

public static final BufferedImage convertToThreeChannelImageTypeIfFour(BufferedImage srcImage)
Parameters:
srcImage -

resample

public final BufferedImage resample(BufferedImage srcImage,
                                    int dstWidth,
                                    int dstHeight,
                                    boolean signed,
                                    int backgroundValue)

resample

public final BufferedImage resample(BufferedImage srcImage,
                                    int selectionWidth,
                                    int selectionHeight,
                                    int selectionXOffset,
                                    int selectionYOffset,
                                    int dstWidth,
                                    int dstHeight,
                                    boolean signed,
                                    int backgroundValue)

resampleWithGraphicsDraw

public final BufferedImage resampleWithGraphicsDraw(BufferedImage srcImage,
                                                    int selectionWidth,
                                                    int selectionHeight,
                                                    int selectionXOffset,
                                                    int selectionYOffset,
                                                    int dstWidth,
                                                    int dstHeight)

resampleWithAffineTransformOp

public static final BufferedImage resampleWithAffineTransformOp(BufferedImage srcImage,
                                                                double sx,
                                                                double sy)

resampleWithAffineTransformOp

public static final BufferedImage resampleWithAffineTransformOp(BufferedImage srcImage,
                                                                int dstWidth,
                                                                int dstHeight)

flipHorizontally

public static void flipHorizontally(BufferedImage srcImage)

flipVertically

public static void flipVertically(BufferedImage srcImage)

rotateAndFlipSwappingRowsAndColumns

public static BufferedImage rotateAndFlipSwappingRowsAndColumns(BufferedImage srcImage)

convertYBRToRGB

public static byte[] convertYBRToRGB(byte srcY,
                                     byte srcCb,
                                     byte srcCr,
                                     byte[] dst)
Parameters:
srcY - YBR Y value
srcCb - YBR Cb value
srcCr - YBR Cr value
dst - an array of length three in which to return the RGB values, in that order
Returns:
the supplied destination array

convertYBRToRGB

public static final BufferedImage convertYBRToRGB(BufferedImage srcImage)
Parameters:
srcImage - a BufferedImage pretending to be an RGB ColorModel but really YBR
Returns:
a BufferedImage with pixel values that really are RGB