Documentation of 'net.sourceforge.plantuml.swing.ImageHelper' Java class
ImageHelper
net.sourceforge.plantuml.swing

Class ImageHelper



  • public class ImageHelper
    extends java.lang.Object
    A collection of methods to help with processing images. A majority of this code was originally found online.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ImageHelper() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.awt.Dimension getScaledDimension(java.awt.Dimension imgSize, java.awt.Dimension boundary)
      Calculates the dimensions of a scaled image given the dimensions of an image and the area it is to be drawn in while preserving aspect ratio.
      static java.awt.Dimension getScaledDimension(java.awt.Dimension dim, double zoom) 
      static java.awt.Dimension getScaledDimensionWidthFit(java.awt.Dimension imgSize, java.awt.Dimension boundary) 
      static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, java.awt.Dimension targetDim, java.awt.RenderingHints hints, boolean higherQuality)
      Returns a scaled instance of a BufferedImage.
      static java.awt.image.BufferedImage toBufferedImage(java.awt.Image img)
      Converts an Image to a BufferedImage.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageHelper

        public ImageHelper()
    • Method Detail

      • getScaledInstance

        public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img,
                                                                     java.awt.Dimension targetDim,
                                                                     java.awt.RenderingHints hints,
                                                                     boolean higherQuality)
        Returns a scaled instance of a BufferedImage. Modified from: https://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html
        Parameters:
        img - the original image to be scaled
        targetDim - the desired dimensions of the scaled instance, in pixels
        hint - RenderingHints used when scaling the image
        higherQuality - if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, targetDim is smaller than the original dimensions, and generally only when the BILINEAR hint is specified)
        Returns:
        a scaled version of the original BufferedImage
      • toBufferedImage

        public static java.awt.image.BufferedImage toBufferedImage(java.awt.Image img)
        Converts an Image to a BufferedImage. From: http://stackoverflow.com/questions/13605248/java-converting-image-to-bufferedimage
      • getScaledDimension

        public static java.awt.Dimension getScaledDimension(java.awt.Dimension imgSize,
                                                            java.awt.Dimension boundary)
        Calculates the dimensions of a scaled image given the dimensions of an image and the area it is to be drawn in while preserving aspect ratio. From: http://stackoverflow.com/questions/10245220/java-image-resize-maintain-aspect-ratio
        Parameters:
        imgSize - dimensions of the original image.
        boundary - dimensions of the area the image is to be drawn in.
      • getScaledDimensionWidthFit

        public static java.awt.Dimension getScaledDimensionWidthFit(java.awt.Dimension imgSize,
                                                                    java.awt.Dimension boundary)
      • getScaledDimension

        public static java.awt.Dimension getScaledDimension(java.awt.Dimension dim,
                                                            double zoom)

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.