Package de.swa.fuh.qrefinement.qrm
Class Tools
java.lang.Object
de.swa.fuh.qrefinement.qrm.Tools
public class Tools
extends java.lang.Object
Class containing implementation of algorithms that are used by objects of different classes.
- Author:
- Nicolas Boch
-
Constructor Summary
Constructors Constructor Description Tools() -
Method Summary
Modifier and Type Method Description static voiddrawRect(java.awt.Graphics2D g, int x, int y, int width, int height, java.awt.Color color, int thickness)draw a rectangle in a Graphics2D objectstatic java.awt.ImagedrawRectsOnImage(java.awt.Image srcImg, java.util.Vector<Rectangle> rectangles)draws colored rectangles in an Imagestatic java.lang.StringgetFileExtension(java.io.File f)returns the file extension / file type of a file using Apache Commons IO APIstatic javax.swing.text.DefaultHighlighter.DefaultHighlightPaintergetHighlighter(java.awt.Color c)returns a HighlightPainter for the painting of text highlights in the desired colorstatic booleanisImageFile(java.io.File f)returns whether a File is considered to be an image file or notstatic java.awt.image.BufferedImagetoBufferedImage(java.awt.Image img)converting an Image to an BufferedImage by redrawing the Image to an new object.
-
Constructor Details
-
Tools
public Tools()
-
-
Method Details
-
getHighlighter
public static javax.swing.text.DefaultHighlighter.DefaultHighlightPainter getHighlighter(java.awt.Color c)returns a HighlightPainter for the painting of text highlights in the desired color- Parameters:
c- color in which text highlights shall be painted. Supports red and green color.
-
drawRectsOnImage
public static java.awt.Image drawRectsOnImage(java.awt.Image srcImg, java.util.Vector<Rectangle> rectangles)draws colored rectangles in an Image- Parameters:
srcImg- the image in which rectangles are to be paintedrectangles- a vector with references to the rectangles that are to be painted- Returns:
- Image containing the painted rectangles
-
toBufferedImage
public static java.awt.image.BufferedImage toBufferedImage(java.awt.Image img)converting an Image to an BufferedImage by redrawing the Image to an new object.- Parameters:
img- Image object to be converted
-
drawRect
public static void drawRect(java.awt.Graphics2D g, int x, int y, int width, int height, java.awt.Color color, int thickness)draw a rectangle in a Graphics2D object- Parameters:
g- the Graphics2D object in that the rectangle is to be drawnx- the x position of the starting edge of the rectangley- the y position of the starting edge of the rectanglewidth- the width of the rectangleheight- the height of the rectanglecolor- the color of the rectanglethickness- the thickness of the rectangles border
-
isImageFile
public static boolean isImageFile(java.io.File f)returns whether a File is considered to be an image file or not- Parameters:
f- the file for which it is to be desided whether it is an image file
-
getFileExtension
public static java.lang.String getFileExtension(java.io.File f)returns the file extension / file type of a file using Apache Commons IO API- Parameters:
f- the file for which the extension is to be determined- Returns:
- a String containing the file extension
-