Class Java2DUtils


  • public class Java2DUtils
    extends java.lang.Object
    Author:
    Fabrizio Giudici
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Float ZERO  
    • Constructor Summary

      Constructors 
      Constructor Description
      Java2DUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage convertToSinglePixelPackedSampleModel​(java.awt.image.BufferedImage image)
      It seems that SinglePixelPackedSampleModel is the only fast mode when a color profile is converted.
      static java.awt.image.BufferedImage createOptimizedImage​(int width, int height)  
      static java.awt.image.BufferedImage createOptimizedImage​(java.awt.image.BufferedImage bufferedImage, double xScale, double yScale, Quality quality)  
      static java.awt.image.BufferedImage createSimilarImage​(java.awt.image.BufferedImage bufferedImage, int newWidth, int newHeight)  
      static int findAffineTransformInterpolation​(Quality quality)  
      static java.lang.Object findRenderingHintsInterpolation​(Quality quality)  
      static java.awt.image.Kernel getAveragingKernel​(int n)  
      static java.awt.GraphicsConfiguration getGraphicsConfiguration()  
      static java.lang.String getICCProfileName​(java.awt.image.RenderedImage image)  
      static java.util.Properties getProperties​(java.awt.image.BufferedImage image)  
      static void logImage​(org.slf4j.Logger log, java.lang.String prefix, java.awt.image.RenderedImage image)  
      static java.awt.image.BufferedImage rotateWithDrawImage​(java.awt.image.BufferedImage bufferedImage, double degrees, Quality quality)  
      static java.awt.image.BufferedImage scaleWithAffineTransform​(java.awt.image.BufferedImage bufferedImage, double xScale, double yScale, Quality quality)
      Scales a BufferedImage by filtering with an AffineTransform.
      static java.awt.image.BufferedImage scaleWithDrawImage​(java.awt.image.BufferedImage bufferedImage, double xScale, double yScale, Quality quality)
      Scales a BufferedImage by redrawing it on a new bitmap.
      protected static java.lang.String toString​(int[] array, int radix)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ZERO

        public static final java.lang.Float ZERO
    • Constructor Detail

      • Java2DUtils

        public Java2DUtils()
    • Method Detail

      • getProperties

        public static java.util.Properties getProperties​(java.awt.image.BufferedImage image)
      • createOptimizedImage

        public static java.awt.image.BufferedImage createOptimizedImage​(int width,
                                                                        int height)
        Parameters:
        width -
        height -
        Returns:
      • getGraphicsConfiguration

        public static java.awt.GraphicsConfiguration getGraphicsConfiguration()
      • createSimilarImage

        public static java.awt.image.BufferedImage createSimilarImage​(java.awt.image.BufferedImage bufferedImage,
                                                                      int newWidth,
                                                                      int newHeight)
      • getICCProfileName

        public static java.lang.String getICCProfileName​(java.awt.image.RenderedImage image)
      • convertToSinglePixelPackedSampleModel

        public static java.awt.image.BufferedImage convertToSinglePixelPackedSampleModel​(java.awt.image.BufferedImage image)
        It seems that SinglePixelPackedSampleModel is the only fast mode when a color profile is converted. This is probably a bug (that has nothing to do with bugs 4886071 and 4705399). Note that grayscale images (TYPE_GRAY) are not converted.
      • scaleWithAffineTransform

        public static java.awt.image.BufferedImage scaleWithAffineTransform​(java.awt.image.BufferedImage bufferedImage,
                                                                            double xScale,
                                                                            double yScale,
                                                                            Quality quality)
                                                                     throws java.lang.IllegalArgumentException
        Scales a BufferedImage by filtering with an AffineTransform.
        Parameters:
        bufferedImage - the image to scale
        xScale - the horizontal scale
        yScale - the vertical scale
        quality - the quality
        Throws:
        java.lang.IllegalArgumentException
      • scaleWithDrawImage

        public static java.awt.image.BufferedImage scaleWithDrawImage​(java.awt.image.BufferedImage bufferedImage,
                                                                      double xScale,
                                                                      double yScale,
                                                                      Quality quality)
                                                               throws java.lang.IllegalArgumentException
        Scales a BufferedImage by redrawing it on a new bitmap.
        Parameters:
        bufferedImage - the image to scale
        xScale - the horizontal scale
        yScale - the vertical scale
        quality - the quality
        Throws:
        java.lang.IllegalArgumentException
      • rotateWithDrawImage

        public static java.awt.image.BufferedImage rotateWithDrawImage​(java.awt.image.BufferedImage bufferedImage,
                                                                       double degrees,
                                                                       Quality quality)
      • toString

        protected static java.lang.String toString​(int[] array,
                                                   int radix)
      • logImage

        public static void logImage​(org.slf4j.Logger log,
                                    java.lang.String prefix,
                                    java.awt.image.RenderedImage image)
      • createOptimizedImage

        public static java.awt.image.BufferedImage createOptimizedImage​(java.awt.image.BufferedImage bufferedImage,
                                                                        double xScale,
                                                                        double yScale,
                                                                        Quality quality)
        Parameters:
        xScale -
        yScale -
        quality -
        Returns:
      • findRenderingHintsInterpolation

        public static java.lang.Object findRenderingHintsInterpolation​(Quality quality)
                                                                throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • findAffineTransformInterpolation

        public static int findAffineTransformInterpolation​(Quality quality)
                                                    throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • getAveragingKernel

        public static java.awt.image.Kernel getAveragingKernel​(int n)
        Parameters:
        n -
        Returns: