com.pixelmed.display

## Class BufferedImageUtilities

- java.lang.Object
- - com.pixelmed.display.BufferedImageUtilities

    public class BufferedImageUtilities
    extends java.lang.Object

### Field Summary

Fields
`protected static java.lang.String[]` `bufferTypeNames` Indexes correspond to DataBuffer.TYPE_xxx values, except TYPE_UNDEFINED.
`protected static java.lang.String[]` `imageTypeNames`
`protected static java.lang.String[]` `spaceTypeNames` Indexes correspond to some ColorSpace.TYPE_xxx values.

### Constructor Summary

Constructors
Constructor and Description
`BufferedImageUtilities()`

### Method Summary

Methods
`static java.awt.image.BufferedImage` `convertToMostFavorableImageType(java.awt.image.BufferedImage srcImage)`
`static java.awt.image.BufferedImage` `convertToMostFavorableImageTypeWithBandCombineOp(java.awt.image.BufferedImage srcImage)`
`static java.awt.image.BufferedImage` `convertToMostFavorableImageTypeWithDataBufferCopy(java.awt.image.BufferedImage srcImage)`
`static java.awt.image.BufferedImage` `convertToMostFavorableImageTypeWithGraphicsDraw(java.awt.image.BufferedImage srcImage)`
`static java.awt.image.BufferedImage` `convertToMostFavorableImageTypeWithPixelCopy(java.awt.image.BufferedImage srcImage)`
`static java.awt.image.BufferedImage` `convertToThreeChannelImageTypeIfFour(java.awt.image.BufferedImage srcImage)`
`static java.awt.image.BufferedImage` `convertYBRToRGB(java.awt.image.BufferedImage srcImage)`
`static byte[]` `convertYBRToRGB(byte srcY, byte srcCb, byte srcCr, byte[] dst)`
`static void` `describeColorModel(java.awt.image.ColorModel model, java.io.PrintStream out)` Describe characteristics of ColorModel.
`static void` `describeImage(java.awt.image.BufferedImage image, java.io.PrintStream out)` Describe characteristics of BufferedImage's Raster, SampleModel, ColorModel, etc.
`static void` `describeRaster(java.awt.image.Raster raster, java.io.PrintStream out)` Describe characteristics of Raster.
`static void` `flipHorizontally(java.awt.image.BufferedImage srcImage)`
`static void` `flipVertically(java.awt.image.BufferedImage srcImage)`
`static java.awt.GraphicsConfiguration` `getDefaultGraphicsConfiguration()`
`static java.awt.image.ColorModel` `getMostFavorableColorModel()`
`java.awt.image.BufferedImage` `resample(java.awt.image.BufferedImage srcImage, int dstWidth, int dstHeight, boolean signed, int backgroundValue)`
`java.awt.image.BufferedImage` `resample(java.awt.image.BufferedImage srcImage, int selectionWidth, int selectionHeight, int selectionXOffset, int selectionYOffset, int dstWidth, int dstHeight, boolean signed, int backgroundValue)`
`static java.awt.image.BufferedImage` `resampleWithAffineTransformOp(java.awt.image.BufferedImage srcImage, double sx, double sy)`
`static java.awt.image.BufferedImage` `resampleWithAffineTransformOp(java.awt.image.BufferedImage srcImage, int dstWidth, int dstHeight)`
`java.awt.image.BufferedImage` `resampleWithGraphicsDraw(java.awt.image.BufferedImage srcImage, int selectionWidth, int selectionHeight, int selectionXOffset, int selectionYOffset, int dstWidth, int dstHeight)`
`static java.awt.image.BufferedImage` `rotateAndFlipSwappingRowsAndColumns(java.awt.image.BufferedImage srcImage)`
`static java.lang.String` `transferTypeName(int bufferType)`
`static java.lang.String` `typeName(java.awt.color.ColorSpace space)` Return name for its color-space type.
`static java.lang.String` `typeName(int imageType)` Return name for given BufferedImage type.
`static java.lang.String` `typeName(int imageType, java.awt.image.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 java.lang.String[] imageTypeNames

#### bufferTypeNames

    protected static final java.lang.String[] bufferTypeNames

Indexes correspond to DataBuffer.TYPE_xxx values, except TYPE_UNDEFINED.

#### spaceTypeNames

    protected static final java.lang.String[] spaceTypeNames

Indexes correspond to some ColorSpace.TYPE_xxx values.

### Constructor Detail

#### BufferedImageUtilities

    public BufferedImageUtilities()

### Method Detail

#### typeName

    public static java.lang.String typeName(int imageType)

Return name for given BufferedImage type.

#### typeName

    public static java.lang.String typeName(int imageType,
                            java.awt.image.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 java.lang.String transferTypeName(int bufferType)

#### typeName

    public static java.lang.String typeName(java.awt.color.ColorSpace space)

Return name for its color-space type.

Parameters:
  `space` -
Returns:
  String name

#### describeImage

    public static void describeImage(java.awt.image.BufferedImage image,
                     java.io.PrintStream out)

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

Parameters:
  `image` -
  `out` -

#### describeRaster

    public static void describeRaster(java.awt.image.Raster raster,
                      java.io.PrintStream out)

Describe characteristics of Raster.

Parameters:
  `raster` -
  `out` -

#### describeColorModel

    public static void describeColorModel(java.awt.image.ColorModel model,
                          java.io.PrintStream out)

Describe characteristics of ColorModel.

Parameters:
  `model` -
  `out` -

#### getDefaultGraphicsConfiguration

    public static java.awt.GraphicsConfiguration getDefaultGraphicsConfiguration()

Returns:
  the GraphicsConfiguration that is likely to perform most efficiently on this host

#### getMostFavorableColorModel

    public static java.awt.image.ColorModel getMostFavorableColorModel()

Returns:
  the ColorModel that is likely to perform most efficiently on this host

#### convertToMostFavorableImageTypeWithPixelCopy

    public static final java.awt.image.BufferedImage convertToMostFavorableImageTypeWithPixelCopy(java.awt.image.BufferedImage srcImage)

Parameters:
  `srcImage` -

#### convertToMostFavorableImageTypeWithDataBufferCopy

    public static final java.awt.image.BufferedImage convertToMostFavorableImageTypeWithDataBufferCopy(java.awt.image.BufferedImage srcImage)

Parameters:
  `srcImage` -

#### convertToMostFavorableImageTypeWithBandCombineOp

    public static final java.awt.image.BufferedImage convertToMostFavorableImageTypeWithBandCombineOp(java.awt.image.BufferedImage srcImage)

Parameters:
  `srcImage` -

#### convertToMostFavorableImageTypeWithGraphicsDraw

    public static final java.awt.image.BufferedImage convertToMostFavorableImageTypeWithGraphicsDraw(java.awt.image.BufferedImage srcImage)

Parameters:
  `srcImage` -

#### convertToMostFavorableImageType

    public static final java.awt.image.BufferedImage convertToMostFavorableImageType(java.awt.image.BufferedImage srcImage)

Parameters:
  `srcImage` -

#### convertToThreeChannelImageTypeIfFour

    public static final java.awt.image.BufferedImage convertToThreeChannelImageTypeIfFour(java.awt.image.BufferedImage srcImage)

Parameters:
  `srcImage` -

#### resample

    public final java.awt.image.BufferedImage resample(java.awt.image.BufferedImage srcImage,
                                        int dstWidth,
                                        int dstHeight,
                                        boolean signed,
                                        int backgroundValue)

#### resample

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

#### resampleWithGraphicsDraw

    public final java.awt.image.BufferedImage resampleWithGraphicsDraw(java.awt.image.BufferedImage srcImage,
                                                        int selectionWidth,
                                                        int selectionHeight,
                                                        int selectionXOffset,
                                                        int selectionYOffset,
                                                        int dstWidth,
                                                        int dstHeight)

#### resampleWithAffineTransformOp

    public static final java.awt.image.BufferedImage resampleWithAffineTransformOp(java.awt.image.BufferedImage srcImage,
                                                             double sx,
                                                             double sy)

#### resampleWithAffineTransformOp

    public static final java.awt.image.BufferedImage resampleWithAffineTransformOp(java.awt.image.BufferedImage srcImage,
                                                             int dstWidth,
                                                             int dstHeight)

#### flipHorizontally

    public static void flipHorizontally(java.awt.image.BufferedImage srcImage)

#### flipVertically

    public static void flipVertically(java.awt.image.BufferedImage srcImage)

#### rotateAndFlipSwappingRowsAndColumns

    public static java.awt.image.BufferedImage rotateAndFlipSwappingRowsAndColumns(java.awt.image.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 java.awt.image.BufferedImage convertYBRToRGB(java.awt.image.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