Package fr.iut.tetris.vues
Class Common
- java.lang.Object
-
- fr.iut.tetris.vues.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.BufferedImagedye(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 intgetStringHeight(java.lang.String str)Find the height in pixel of a given stringstatic java.awt.image.BufferedImagetoBufferedImage(java.awt.Image img)Convert a normal image of type Image to a BufferedImage to be used with graphics/dye
-
-
-
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 imagecolor- 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
-
-