Class MorphologyOp
java.lang.Object
org.apache.batik.ext.awt.image.rendered.MorphologyOp
- All Implemented Interfaces:
BufferedImageOp
,RasterOp
This class provides an implementation for the SVG
feMorphology filter, as defined in Chapter 15, section 20
of the SVG specification.
- Version:
- $Id: MorphologyOp.java 1733416 2016-03-03 07:07:13Z gadams $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final ColorSpace
private int
The radius of the operation on X axisprivate int
The radius of the operation on Y axisprivate final int
private final int
private final ColorSpace
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
checkCompatible
(ColorModel colorModel, SampleModel sampleModel) private void
checkCompatible
(SampleModel model) createCompatibleDestImage
(BufferedImage src, ColorModel destCM) filter
(BufferedImage src, BufferedImage dest) This implementation of filter does the morphology operation on a premultiplied alpha image.filter
(Raster src, WritableRaster dest) Filters src and writes result into dest.getBounds2D
(BufferedImage src) getBounds2D
(Raster src) getPoint2D
(Point2D srcPt, Point2D destPt) (package private) static final boolean
isBetter
(int v1, int v2, boolean doDilation) private boolean
isCompatible
(ColorModel colorModel, SampleModel sampleModel) private void
specialProcessColumn
(Raster src, WritableRaster dest) private void
specialProcessRow
(Raster src, WritableRaster dest)
-
Field Details
-
radiusX
private int radiusXThe radius of the operation on X axis -
radiusY
private int radiusYThe radius of the operation on Y axis -
doDilation
private boolean doDilation -
rangeX
private final int rangeX -
rangeY
private final int rangeY -
sRGB
-
lRGB
-
-
Constructor Details
-
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 Details
-
getBounds2D
- Specified by:
getBounds2D
in interfaceRasterOp
-
getBounds2D
- Specified by:
getBounds2D
in interfaceBufferedImageOp
-
getPoint2D
- Specified by:
getPoint2D
in interfaceBufferedImageOp
- Specified by:
getPoint2D
in interfaceRasterOp
-
checkCompatible
-
isCompatible
-
checkCompatible
-
getRenderingHints
- Specified by:
getRenderingHints
in interfaceBufferedImageOp
- Specified by:
getRenderingHints
in interfaceRasterOp
-
createCompatibleDestRaster
- Specified by:
createCompatibleDestRaster
in interfaceRasterOp
-
createCompatibleDestImage
- Specified by:
createCompatibleDestImage
in interfaceBufferedImageOp
-
isBetter
static final boolean isBetter(int v1, int v2, boolean doDilation) -
specialProcessRow
-
specialProcessColumn
-
filter
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
-
filter
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.- Specified by:
filter
in interfaceBufferedImageOp
-