Class BufferedImageUtilities

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

public class BufferedImageUtilities extends Object
  • Field Details

    • 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 Details

    • BufferedImageUtilities

      public BufferedImageUtilities()
  • Method Details

    • 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 -
    • describeImage

      public static String describeImage(BufferedImage image)

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

      Parameters:
      image - return description
    • describeRaster

      public static void describeRaster(Raster raster, PrintStream out)

      Describe characteristics of Raster.

      Parameters:
      raster -
      out -
    • describeRaster

      public static String describeRaster(Raster raster)

      Describe characteristics of Raster.

      Parameters:
      raster - return description
    • describeColorModel

      public static void describeColorModel(ColorModel model, PrintStream out)

      Describe characteristics of ColorModel.

      Parameters:
      model -
      out -
    • describeColorModel

      public static String describeColorModel(ColorModel model)

      Describe characteristics of ColorModel.

      Parameters:
      model - return description
    • 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
    • createEmptyBufferedImageOfSameTypeAndSize

      public static final BufferedImage createEmptyBufferedImageOfSameTypeAndSize(BufferedImage srcImage)
      Parameters:
      srcImage -
    • clipToRectangleWithGraphicsDraw

      public static final BufferedImage clipToRectangleWithGraphicsDraw(BufferedImage srcImage, Rectangle clipRect, Color clipBackgroundColor)
      Parameters:
      srcImage -
      clipRect -
      clipBackgroundColor -