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 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
    static java.awt.Image drawRectsOnImage​(java.awt.Image srcImg, java.util.Vector<Rectangle> rectangles)
    draws colored rectangles in an Image
    static java.lang.String getFileExtension​(java.io.File f)
    returns the file extension / file type of a file using Apache Commons IO API
    static javax.swing.text.DefaultHighlighter.DefaultHighlightPainter getHighlighter​(java.awt.Color c)
    returns a HighlightPainter for the painting of text highlights in the desired color
    static boolean isImageFile​(java.io.File f)
    returns whether a File is considered to be an image file or not
    static java.awt.image.BufferedImage toBufferedImage​(java.awt.Image img)
    converting an Image to an BufferedImage by redrawing the Image to an new object.

    Methods inherited from class java.lang.Object

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

  • 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 painted
      rectangles - 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 drawn
      x - the x position of the starting edge of the rectangle
      y - the y position of the starting edge of the rectangle
      width - the width of the rectangle
      height - the height of the rectangle
      color - the color of the rectangle
      thickness - 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