public class AnnotateFilter extends AbstractBufferedImageOp
setGraphic(String)
or
setGraphicURI(String)
.
If both are invoked, then the graphic specified in the call to
setGraphic(String)
will be used.
You can specify a scale factor for the graphic using
setScale(double)
and a rotation using
setRotation(double)
.
The graphic can be offset from the default position (which places
its origin at the upper left of the image) by calling
setXOffset(double)
and setYOffset(double)
.
The offset will be applied after the scaling and rotation.
This filter uses SVG Salamander, by Mark McKay, for rendering SVG. SVG Salamander is available under LGPL and BSD licenses. See https://java.net/projects/svgsalamander.
The filter architecture follows the pattern defined by Jerry Huxtable in the JH Labs Java Image Processing library, available from: http://www.jhlabs.com/ip/filters and licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).
Constructor and Description |
---|
AnnotateFilter() |
Modifier and Type | Method and Description |
---|---|
java.awt.image.BufferedImage |
filter(java.awt.image.BufferedImage source,
java.awt.image.BufferedImage destination)
Filter the source image, overlaying graphics that has been specified
by setGraphicURI.
|
java.lang.String |
getGraphic()
Return the specified SVG for the graphic, or an empty string
if none has been specified.
|
java.lang.String |
getGraphicURI()
Get the specified URI for the graphic.
|
double |
getRotation()
Get the rotation for the graphic in degrees, which defaults to 0.0.
|
double |
getScale()
Get the scale factor for the graphic, which defaults to 1.0.
|
double |
getXOffset()
Get the horizontal offset for the graphic, in pixels.
|
double |
getYOffset()
Get the vertical offset for the graphic, in pixels.
|
void |
setGraphic(java.lang.String graphic)
Set the SVG for the graphic.
|
void |
setGraphicURI(java.lang.String graphicURI)
Set the specified URI for the graphic to use if no
graphic is specified using setGraphic().
|
void |
setRotation(double theta)
Set the rotation for the graphic in degrees.
|
void |
setScale(double scale)
Set the scale factor for the graphic.
|
void |
setXOffset(double x)
Set the horizontal offset for the graphic.
|
void |
setYOffset(double y)
Set the vertical location for the graphic.
|
java.lang.String |
toString()
Return a string description of the filter.
|
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB, stringToColor
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage source, java.awt.image.BufferedImage destination)
source
- The source image, on which motion is detected.destination
- The destination image, on which the graphic is added,
or null to specify to add the graphic to the source image.public java.lang.String getGraphic()
setGraphic(String)
public java.lang.String getGraphicURI()
setGraphicURI(String)
public double getRotation()
setRotation(double)
public double getScale()
setScale(double)
public double getXOffset()
setXOffset(double)
public double getYOffset()
setYOffset(double)
public void setGraphic(java.lang.String graphic)
graphic
- An SVG specification for the graphic.getGraphic()
public void setGraphicURI(java.lang.String graphicURI)
graphicURI
- An SVG specification for the graphic.getGraphicURI()
,
setGraphic(String)
public void setRotation(double theta)
theta
- The rotation.getRotation()
public void setScale(double scale)
scale
- The scale factor.getScale()
public void setXOffset(double x)
x
- The horizontal offset, in pixels.getXOffset()
public void setYOffset(double y)
y
- The vertical offset, in pixels.getYOffset()
public java.lang.String toString()
toString
in class java.lang.Object