org.apache.batik.ext.awt.image.rendered

Class MorphologyOp

public class MorphologyOp extends Object implements BufferedImageOp, RasterOp

This class provides an implementation for the SVG feMorphology filter, as defined in Chapter 15, section 20 of the SVG specification.
Constructor Summary
MorphologyOp(int radiusX, int radiusY, boolean doDilation)
Method Summary
BufferedImagecreateCompatibleDestImage(BufferedImage src, ColorModel destCM)
WritableRastercreateCompatibleDestRaster(Raster src)
WritableRasterfilter(Raster src, WritableRaster dest)
Filters src and writes result into dest.
BufferedImagefilter(BufferedImage src, BufferedImage dest)
This implementation of filter does the morphology operation on a premultiplied alpha image.
Rectangle2DgetBounds2D(Raster src)
Rectangle2DgetBounds2D(BufferedImage src)
Point2DgetPoint2D(Point2D srcPt, Point2D destPt)
RenderingHintsgetRenderingHints()

Constructor Detail

MorphologyOp

public MorphologyOp(int radiusX, int radiusY, boolean doDilation)

Parameters: radiusX defines the radius of filter operation on X-axis. Should not be negative. A value of zero will disable the effect of the operation on X-axis, as described in the SVG specification. radiusY defines the radius of filter operation on Y-axis. Should not be negative. A value of zero will disable the effect of the operation on Y-axis, as described in the SVG specification. doDilation defines whether to do dilation or erosion operation. Will do dilation when the value is true, erosion when false.

Method Detail

createCompatibleDestImage

public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM)

createCompatibleDestRaster

public WritableRaster createCompatibleDestRaster(Raster src)

filter

public WritableRaster filter(Raster src, WritableRaster dest)
Filters src and writes result into dest. If dest if null, then a Raster is created. If dest and src refer to the same object, then the source is modified.

The filtering kernel(the operation range for each pixel) is a rectangle of width 2*radiusX+1 and height radiusY+1

Parameters: src the Raster to be filtered dest stores the filtered image. If null, a destination will be created. src and dest can refer to the same Raster, in which situation the src will be modified.

filter

public BufferedImage filter(BufferedImage src, BufferedImage dest)
This implementation of filter does the morphology operation on a premultiplied alpha image. This tends to muddy the colors. so something that is supposed to be a mostly transparent bright red may well become a muddy opaque red. Where as I think it should become a bright opaque red. Which is the result you would get if you were using unpremult data.

getBounds2D

public Rectangle2D getBounds2D(Raster src)

getBounds2D

public Rectangle2D getBounds2D(BufferedImage src)

getPoint2D

public Point2D getPoint2D(Point2D srcPt, Point2D destPt)

getRenderingHints

public RenderingHints getRenderingHints()
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.