org.jmage.filter.merge
Class TextOverlayFilter

java.lang.Object
  extended by org.jmage.filter.ConfigurableImageFilter
      extended by org.jmage.filter.merge.TextOverlayFilter
All Implemented Interfaces:
ImageFilter

public class TextOverlayFilter
extends ConfigurableImageFilter

Overlays the image with a String. Specify the following imageProperties to change the appearance:

TEXT: the string to overlay the image with.
COLOR: [RRGGBB] hex color code, i.e. "000000" for black (the default).
OPACITY: [0-100] opacity percentage of the color, where 0 is transparent and 100 is opaque.
ANTIALIASING: ['true" | "false"] turns antialiasing on/off. default is off.
FONT_URI: A URI pointing to the location of your truetype font resource, i.e. "file:///myfont.ttf"
FONT_SIZE: font size, i.e "12" (the default).
FONT_STYLE: [plain | italic | bold]
ORIENTATION: [0-360] where values are degrees. For convenience, use the constants defined, i.e "ORIENTATION_NORTH" (the default)
POSITION: [1-9] aligns the text following a numeric keypad layout. Default is [9] POSITION_BOTTOM_RIGHT
BORDEROFFSET: a numeric value indicating how many pixels to offset the text from it's nearest border


Field Summary
protected  int alpha
           
protected  boolean antiAliasing
           
static java.lang.String ANTIALIASING
           
static java.lang.String BORDEROFFSET
           
static java.lang.String COLOR
           
static java.lang.String DEFAULT_ANTIALIASING
           
static java.lang.String DEFAULT_BORDEROFFSET
           
static java.lang.String DEFAULT_COLOR
           
static java.lang.String DEFAULT_FONT
           
static java.lang.String DEFAULT_FONT_SIZE
           
static java.lang.String DEFAULT_FONT_STYLE
           
static java.lang.String DEFAULT_OPACITY
           
static java.lang.String DEFAULT_ORIENTATION
           
static java.lang.String DEFAULT_TEXT
           
protected  java.awt.Font font
           
static java.lang.String FONT_SIZE
           
static java.lang.String FONT_STYLE
           
static java.lang.String FONT_URI
           
protected  float fontSize
           
static java.lang.String FONTSTYLE_BOLD
           
static java.lang.String FONTSTYLE_ITALIC
           
static java.lang.String FONTSTYLE_PLAIN
           
protected static org.apache.log4j.Logger log
           
static java.lang.String OPACITY
           
protected  double orientation
           
static java.lang.String ORIENTATION
           
static java.lang.String ORIENTATION_EAST
           
static java.lang.String ORIENTATION_NORTH
           
static java.lang.String ORIENTATION_NORTHEAST
           
static java.lang.String ORIENTATION_NORTHWEST
           
static java.lang.String ORIENTATION_SOUTH
           
static java.lang.String ORIENTATION_SOUTHEAST
           
static java.lang.String ORIENTATION_SOUTHWEST
           
static java.lang.String ORIENTATION_WEST
           
protected  java.lang.String position
           
static java.lang.String POSITION
           
static java.lang.String POSITION_BOTTOM_CENTER
           
static java.lang.String POSITION_BOTTOM_LEFT
           
static java.lang.String POSITION_BOTTOM_RIGHT
           
static java.lang.String POSITION_CENTER
           
static java.lang.String POSITION_CENTER_LEFT
           
static java.lang.String POSITION_CENTER_RIGHT
           
static java.lang.String POSITION_TOP_CENTER
           
static java.lang.String POSITION_TOP_LEFT
           
static java.lang.String POSITION_TOP_RIGHT
           
protected  java.awt.RenderingHints renderingHints
           
protected  java.lang.String text
           
static java.lang.String TEXT
           
protected  java.awt.Color textColor
           
protected  int xyO
           
 
Fields inherited from class org.jmage.filter.ConfigurableImageFilter
filterProperties, INITIALIZED, NOT_INITIALIZED
 
Constructor Summary
TextOverlayFilter()
           
 
Method Summary
 javax.media.jai.PlanarImage filter(javax.media.jai.PlanarImage image)
          Overlay image with a String text.
 void initialize(java.util.Properties filterProperties)
          Initialize the ImageFilter
 
Methods inherited from class org.jmage.filter.ConfigurableImageFilter
filter, getFilterProperties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT

public static final java.lang.String TEXT
See Also:
Constant Field Values

DEFAULT_TEXT

public static final java.lang.String DEFAULT_TEXT
See Also:
Constant Field Values

COLOR

public static final java.lang.String COLOR
See Also:
Constant Field Values

DEFAULT_COLOR

public static final java.lang.String DEFAULT_COLOR
See Also:
Constant Field Values

OPACITY

public static final java.lang.String OPACITY
See Also:
Constant Field Values

DEFAULT_OPACITY

public static final java.lang.String DEFAULT_OPACITY
See Also:
Constant Field Values

ANTIALIASING

public static final java.lang.String ANTIALIASING
See Also:
Constant Field Values

DEFAULT_ANTIALIASING

public static final java.lang.String DEFAULT_ANTIALIASING
See Also:
Constant Field Values

ORIENTATION

public static final java.lang.String ORIENTATION
See Also:
Constant Field Values

ORIENTATION_NORTH

public static final java.lang.String ORIENTATION_NORTH
See Also:
Constant Field Values

ORIENTATION_NORTHEAST

public static final java.lang.String ORIENTATION_NORTHEAST
See Also:
Constant Field Values

ORIENTATION_EAST

public static final java.lang.String ORIENTATION_EAST
See Also:
Constant Field Values

ORIENTATION_SOUTHEAST

public static final java.lang.String ORIENTATION_SOUTHEAST
See Also:
Constant Field Values

ORIENTATION_SOUTH

public static final java.lang.String ORIENTATION_SOUTH
See Also:
Constant Field Values

ORIENTATION_SOUTHWEST

public static final java.lang.String ORIENTATION_SOUTHWEST
See Also:
Constant Field Values

ORIENTATION_WEST

public static final java.lang.String ORIENTATION_WEST
See Also:
Constant Field Values

ORIENTATION_NORTHWEST

public static final java.lang.String ORIENTATION_NORTHWEST
See Also:
Constant Field Values

DEFAULT_ORIENTATION

public static final java.lang.String DEFAULT_ORIENTATION
See Also:
Constant Field Values

FONT_URI

public static final java.lang.String FONT_URI
See Also:
Constant Field Values

DEFAULT_FONT

public static final java.lang.String DEFAULT_FONT
See Also:
Constant Field Values

FONT_SIZE

public static final java.lang.String FONT_SIZE
See Also:
Constant Field Values

DEFAULT_FONT_SIZE

public static final java.lang.String DEFAULT_FONT_SIZE
See Also:
Constant Field Values

FONT_STYLE

public static final java.lang.String FONT_STYLE
See Also:
Constant Field Values

FONTSTYLE_PLAIN

public static final java.lang.String FONTSTYLE_PLAIN
See Also:
Constant Field Values

FONTSTYLE_BOLD

public static final java.lang.String FONTSTYLE_BOLD
See Also:
Constant Field Values

FONTSTYLE_ITALIC

public static final java.lang.String FONTSTYLE_ITALIC
See Also:
Constant Field Values

DEFAULT_FONT_STYLE

public static final java.lang.String DEFAULT_FONT_STYLE
See Also:
Constant Field Values

POSITION

public static final java.lang.String POSITION
See Also:
Constant Field Values

POSITION_TOP_LEFT

public static final java.lang.String POSITION_TOP_LEFT
See Also:
Constant Field Values

POSITION_TOP_CENTER

public static final java.lang.String POSITION_TOP_CENTER
See Also:
Constant Field Values

POSITION_TOP_RIGHT

public static final java.lang.String POSITION_TOP_RIGHT
See Also:
Constant Field Values

POSITION_CENTER_LEFT

public static final java.lang.String POSITION_CENTER_LEFT
See Also:
Constant Field Values

POSITION_CENTER

public static final java.lang.String POSITION_CENTER
See Also:
Constant Field Values

POSITION_CENTER_RIGHT

public static final java.lang.String POSITION_CENTER_RIGHT
See Also:
Constant Field Values

POSITION_BOTTOM_LEFT

public static final java.lang.String POSITION_BOTTOM_LEFT
See Also:
Constant Field Values

POSITION_BOTTOM_CENTER

public static final java.lang.String POSITION_BOTTOM_CENTER
See Also:
Constant Field Values

POSITION_BOTTOM_RIGHT

public static final java.lang.String POSITION_BOTTOM_RIGHT
See Also:
Constant Field Values

BORDEROFFSET

public static final java.lang.String BORDEROFFSET
See Also:
Constant Field Values

DEFAULT_BORDEROFFSET

public static final java.lang.String DEFAULT_BORDEROFFSET
See Also:
Constant Field Values

textColor

protected java.awt.Color textColor

font

protected java.awt.Font font

fontSize

protected float fontSize

text

protected java.lang.String text

position

protected java.lang.String position

xyO

protected int xyO

renderingHints

protected java.awt.RenderingHints renderingHints

antiAliasing

protected boolean antiAliasing

orientation

protected double orientation

alpha

protected int alpha

log

protected static org.apache.log4j.Logger log
Constructor Detail

TextOverlayFilter

public TextOverlayFilter()
Method Detail

initialize

public void initialize(java.util.Properties filterProperties)
                throws FilterException
Initialize the ImageFilter

Specified by:
initialize in class ConfigurableImageFilter
Throws:
FilterException - if the filter can't handle the properties.

filter

public javax.media.jai.PlanarImage filter(javax.media.jai.PlanarImage image)
                                   throws FilterException
Overlay image with a String text.

Parameters:
image - the image
Returns:
the filtered image
Throws:
FilterException - if an error occurs during filtering


Copyright © 2004-2008 Sourceforge. All Rights Reserved.