Class Common


  • public class Common
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Common()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage dye​(java.awt.image.BufferedImage image, java.awt.Color color)
      Colorize an image based on a specified color (Took from: https://stackoverflow.com/a/21385150/8165282)
      static int getStringHeight​(java.lang.String str)
      Find the height in pixel of a given string
      static java.awt.image.BufferedImage toBufferedImage​(java.awt.Image img)
      Convert a normal image of type Image to a BufferedImage to be used with graphics/dye
      • Methods inherited from class java.lang.Object

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

      • Common

        public Common()
    • Method Detail

      • getStringHeight

        public static int getStringHeight​(java.lang.String str)
        Find the height in pixel of a given string
        Parameters:
        str - a string
        Returns:
        the height in pixel
      • dye

        public static java.awt.image.BufferedImage dye​(java.awt.image.BufferedImage image,
                                                       java.awt.Color color)
        Colorize an image based on a specified color (Took from: https://stackoverflow.com/a/21385150/8165282)
        Parameters:
        image - the base image
        color - the color you want to adjust to
        Returns:
        the colorized image
      • toBufferedImage

        public static java.awt.image.BufferedImage toBufferedImage​(java.awt.Image img)
        Convert a normal image of type Image to a BufferedImage to be used with graphics/dye
        Parameters:
        img - the raw image
        Returns:
        the buffer image