Package com.jhlabs.image.svg
Class AnnotateFilter
- java.lang.Object
-
- com.jhlabs.image.AbstractBufferedImageOp
-
- com.jhlabs.image.svg.AnnotateFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
,java.lang.Cloneable
public class AnnotateFilter extends AbstractBufferedImageOp
An image filter that overlays SVG graphics. The graphic can be specified by invokingsetGraphic(String)
orsetGraphicURI(String)
. If both are invoked, then the graphic specified in the call tosetGraphic(String)
will be used. You can specify a scale factor for the graphic usingsetScale(double)
and a rotation usingsetRotation(double)
. The graphic can be offset from the default position (which places its origin at the upper left of the image) by callingsetXOffset(double)
andsetYOffset(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).
- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Constructor Summary
Constructors Constructor Description AnnotateFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB, stringToColor
-
-
-
-
Method Detail
-
filter
public 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.- Parameters:
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.- Returns:
- The filtered image.
-
getGraphic
public java.lang.String getGraphic()
Return the specified SVG for the graphic, or an empty string if none has been specified.- Returns:
- The specified SVG for the graphic.
- See Also:
setGraphic(String)
-
getGraphicURI
public java.lang.String getGraphicURI()
Get the specified URI for the graphic.- Returns:
- The specified URI for the graphic.
- See Also:
setGraphicURI(String)
-
getRotation
public double getRotation()
Get the rotation for the graphic in degrees, which defaults to 0.0.- Returns:
- The rotation for the graphic.
- See Also:
setRotation(double)
-
getScale
public double getScale()
Get the scale factor for the graphic, which defaults to 1.0.- Returns:
- The scale factor for the graphic.
- See Also:
setScale(double)
-
getXOffset
public double getXOffset()
Get the horizontal offset for the graphic, in pixels.- Returns:
- The horizontal offset for the graphic, in pixels.
- See Also:
setXOffset(double)
-
getYOffset
public double getYOffset()
Get the vertical offset for the graphic, in pixels.- Returns:
- The vertical offset for the graphic, in pixels.
- See Also:
setYOffset(double)
-
setGraphic
public void setGraphic(java.lang.String graphic)
Set the SVG for the graphic.- Parameters:
graphic
- An SVG specification for the graphic.- See Also:
getGraphic()
-
setGraphicURI
public void setGraphicURI(java.lang.String graphicURI)
Set the specified URI for the graphic to use if no graphic is specified using setGraphic().- Parameters:
graphicURI
- An SVG specification for the graphic.- See Also:
getGraphicURI()
,setGraphic(String)
-
setRotation
public void setRotation(double theta)
Set the rotation for the graphic in degrees.- Parameters:
theta
- The rotation.- See Also:
getRotation()
-
setScale
public void setScale(double scale)
Set the scale factor for the graphic.- Parameters:
scale
- The scale factor.- See Also:
getScale()
-
setXOffset
public void setXOffset(double x)
Set the horizontal offset for the graphic.- Parameters:
x
- The horizontal offset, in pixels.- See Also:
getXOffset()
-
setYOffset
public void setYOffset(double y)
Set the vertical location for the graphic.- Parameters:
y
- The vertical offset, in pixels.- See Also:
getYOffset()
-
toString
public java.lang.String toString()
Return a string description of the filter.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string "AnnotateFilter".
-
-