org.jmage.filter.merge
Class BackgroundImageFilter

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

public class BackgroundImageFilter
extends TwinResourceImageFilter

Puts the image on a configured background image. The Resulting image will have the proportions of the background image. Note that background images must be higher *and* wider than the image that is supposed to overlay them. Specify the following imageProperties to change the appearance:

IMAGE_URI: the image to put as background.
OPACITY: [0-100] opacity percentage, where 0 is transparent and 100 is opaque.
ORIENTATION: [0-360] where values are in degrees. For convenience, use the constants defined, i.e "ORIENTATION_NORTH" (the default)
POSITION_X: horizontal overlay position on the background
POSITION_Y: vertical overlay position on the background


Field Summary
protected  java.awt.Graphics2D backgroundGraphics
           
protected  java.awt.image.BufferedImage backgroundImage
           
static java.lang.String DEFAULT_OPACITY
           
static java.lang.String DEFAULT_ORIENTATION
           
static java.lang.String DEFAULT_POSITION_X
           
static java.lang.String DEFAULT_POSITION_Y
           
protected static org.apache.log4j.Logger log
           
protected  float opacity
           
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
           
static java.lang.String POSITION_X
           
static java.lang.String POSITION_Y
           
protected  int px
           
protected  int py
           
protected  java.awt.RenderingHints renderingHints
           
 
Fields inherited from class org.jmage.filter.TwinResourceImageFilter
CHAIN_URI, IMAGE_URI, resourceImage
 
Fields inherited from class org.jmage.filter.ConfigurableImageFilter
filterProperties, INITIALIZED, NOT_INITIALIZED
 
Constructor Summary
BackgroundImageFilter()
           
 
Method Summary
 javax.media.jai.PlanarImage filter(javax.media.jai.PlanarImage image)
          Overlay image with another image
 void initialize(java.util.Properties filterProperties)
          Initialize the ImageFilter
 
Methods inherited from class org.jmage.filter.TwinResourceImageFilter
cloneImage, filter, mapInternalRequest
 
Methods inherited from class org.jmage.filter.ConfigurableImageFilter
getFilterProperties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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

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

POSITION_X

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

POSITION_Y

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

DEFAULT_POSITION_X

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

DEFAULT_POSITION_Y

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

backgroundImage

protected java.awt.image.BufferedImage backgroundImage

backgroundGraphics

protected java.awt.Graphics2D backgroundGraphics

px

protected int px

py

protected int py

renderingHints

protected java.awt.RenderingHints renderingHints

orientation

protected double orientation

opacity

protected float opacity

log

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

BackgroundImageFilter

public BackgroundImageFilter()
Method Detail

initialize

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

Overrides:
initialize in class TwinResourceImageFilter
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 another image

Specified by:
filter in interface ImageFilter
Overrides:
filter in class TwinResourceImageFilter
Parameters:
image - the image
Returns:
the filtered image
Throws:
FilterException - if an error occurs during filtering


Copyright © 2004-2008 Sourceforge. All Rights Reserved.