net.sourceforge.vietocr
Class ImageHelper

java.lang.Object
  extended by net.sourceforge.vietocr.ImageHelper

public class ImageHelper
extends java.lang.Object


Constructor Summary
ImageHelper()
           
 
Method Summary
static java.awt.Image getClipboardImage()
          Gets an image from Clipboard.
static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage image, int targetWidth, int targetHeight)
          Convenience method that returns a scaled instance of the provided BufferedImage.
static java.awt.image.BufferedImage getSubImage(java.awt.image.BufferedImage image, int x, int y, int width, int height)
          A replacement for the standard BufferedImage.getSubimage method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 image,
                                                             int targetWidth,
                                                             int targetHeight)
Convenience method that returns a scaled instance of the provided BufferedImage.

Parameters:
image - the original image to be scaled
targetWidth - the desired width of the scaled instance, in pixels
targetHeight - the desired height of the scaled instance, in pixels
Returns:
a scaled version of the original BufferedImage

getSubImage

public static java.awt.image.BufferedImage getSubImage(java.awt.image.BufferedImage image,
                                                       int x,
                                                       int y,
                                                       int width,
                                                       int height)
A replacement for the standard BufferedImage.getSubimage method.

Parameters:
image -
x - the X coordinate of the upper-left corner of the specified rectangular region
y - the Y coordinate of the upper-left corner of the specified rectangular region
width - the width of the specified rectangular region
height - the height of the specified rectangular region
Returns:
a BufferedImage that is the subimage of image.

getClipboardImage

public static java.awt.Image getClipboardImage()
Gets an image from Clipboard.

Returns:
image