|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jaitools.imageutils.FloodFiller
public class FloodFiller
A flood-filling algorithm to use with rasters.
The code is adapted from an algorithm published in C# by J. Dunlap at:
http://www.codeproject.com/KB/GDI-plus/queuelinearfloodfill.aspxwhich was subsequently ported to Java by Owen Kaluza. The JAI-tools implementation is substantially different and any bugs should not be blamed on the above authors.
This version works with a source RenderedImage
and a destination WritableRenderedImage
, both of which are accessed using JAI iterators.
Nested Class Summary | |
---|---|
static class |
FloodFiller.ScanSegment Records a segment of contiguous pixels in a single row that will become part of a filled region. |
Constructor Summary | |
---|---|
FloodFiller(java.awt.image.RenderedImage sourceImage, int sourceBand, java.awt.image.WritableRenderedImage destImage, int destBand, double tolerance, boolean diagonal) Create a FloodFiller to work with the given source image |
Method Summary | |
---|---|
FillResult |
fill(int x, int y, int fillValue) Fills the region connected to the specified start pixel. |
FillResult |
fill(int x, int y, int fillValue, double refValue) Fills the region connected to the specified start pixel. |
FillResult |
fillRadius(int x, int y, int fillValue, double radius) Fills the region connected to the specified start pixel and lying within radius pixels of the start pixel. |
FillResult |
fillRadius(int x, int y, int fillValue, double refValue, double radius) Fills the region connected to the specified start pixel and lying within radius pixels of the start pixel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FloodFiller(java.awt.image.RenderedImage sourceImage, int sourceBand, java.awt.image.WritableRenderedImage destImage, int destBand, double tolerance, boolean diagonal)
sourceImage
- the source imagedestImage
- the destination imagesourceBand
- the source image band to be processeddestBand
- the destination image band to write totolerance
- the maximum absolute difference in value for a pixel to be included in the regiondiagonal
- set to true to include sub-regions that are only connected diagonally; set to false to require orthogonal connectionsMethod Detail |
---|
public FillResult fill(int x, int y, int fillValue)
v
within the range start_pixel_value - tolerance .
x
- start pixel x coordinatey
- start pixel y coordinatefillValue
- the value to write to the destination image for this regionpublic FillResult fillRadius(int x, int y, int fillValue, double radius)
radius
pixels of the start pixel.
A pixel belongs to this region if there is a path between it and the starting pixel which passes only through pixels of value v
within the range start_pixel_value - tolerance .
x
- start pixel x coordinatey
- start pixel y coordinatefillValue
- the value to write to the destination image for this regionradius
- maximum distance (pixels) that a candidate pixel can be from the start pixelpublic FillResult fill(int x, int y, int fillValue, double refValue)
v
within the range refValue - tolerance .
x
- start pixel x coordinatey
- start pixel y coordinatefillValue
- the value to write to the destination image for this regionrefValue
- the source image reference value for the regionpublic FillResult fillRadius(int x, int y, int fillValue, double refValue, double radius)
radius
pixels of the start pixel.
A pixel belongs to this region if there is a path between it and the starting pixel which passes only through pixels of value v
within the range refValue - tolerance .
x
- start pixel x coordinatey
- start pixel y coordinatefillValue
- the value to write to the destination image for this regionrefValue
- the source image reference value for the regionradius
- maximum distance (pixels) that a candidate pixel can be from the start pixel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |