@Test public void testFill() { boolean diagonal; int fillValue; FloodFiller filler = null; FillResult fill = null; SampleModel sm = new ComponentSampleModel( DataBuffer.TYPE_BYTE, TILE_WIDTH, TILE_WIDTH, 1, TILE_WIDTH, new int[]{0}); ColorModel cm = PlanarImage.createColorModel(sm); DiskMemImage image = new DiskMemImage( IMAGE_WIDTH, IMAGE_WIDTH, sm, cm ); Graphics2D gr = image.createGraphics(); gr.setBackground(Color.WHITE); gr.clearRect(0, 0, IMAGE_WIDTH, IMAGE_WIDTH); gr.setColor(Color.BLACK); gr.fillRect(TILE_WIDTH/2, TILE_WIDTH/2, TILE_WIDTH/2, TILE_WIDTH/2); gr.fillRect(TILE_WIDTH, TILE_WIDTH, TILE_WIDTH/2, TILE_WIDTH/2); diagonal = true; fillValue = 64; filler = new FloodFiller(image, 0, image, 0, 0, diagonal); fill = filler.fill(TILE_WIDTH / 2, TILE_WIDTH / 2, fillValue); assertTrue(fill.getNumPixels() == 2 * (TILE_WIDTH/2) * (TILE_WIDTH/2)); diagonal = false; fillValue = 128; filler = new FloodFiller(image, 0, image, 0, 0, diagonal); fill = filler.fill(TILE_WIDTH / 2, TILE_WIDTH / 2, fillValue); assertTrue(fill.getNumPixels() == (TILE_WIDTH/2) * (TILE_WIDTH/2)); diagonal = false; fillValue = 192; filler = new FloodFiller(image, 0, image, 0, 0, diagonal); fill = filler.fillRadius(TILE_WIDTH/2, TILE_WIDTH/2, fillValue, TILE_WIDTH/2); assertTrue(fill.getBounds().width == TILE_WIDTH / 2); assertTrue(fill.getBounds().height == TILE_WIDTH / 2); }
public FillResult fill(int x, int y, int fillValue) { return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand)); }
FloodFiller { public FillResult fill(int x, int y, int fillValue) { return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand)); } }
FloodFiller { public FillResult fill(int x, int y, int fillValue) { return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand)); } FloodFiller(
            RenderedImage sourceImage, int sourceBand,
            WritableRenderedImage destImage, int destBand,
            double tolerance, boolean diagonal); }
FloodFiller { public FillResult fill(int x, int y, int fillValue) { return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand)); } FloodFiller(
            RenderedImage sourceImage, int sourceBand,
            WritableRenderedImage destImage, int destBand,
            double tolerance, boolean diagonal); FillResult fill(int x, int y, int fillValue); FillResult fillRadius(int x, int y, int fillValue, double radius); FillResult fill(int x, int y, int fillValue, double refValue); FillResult fillRadius(int x, int y, int fillValue, double refValue, double radius); }
FloodFiller { public FillResult fill(int x, int y, int fillValue) { return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand)); } FloodFiller(
            RenderedImage sourceImage, int sourceBand,
            WritableRenderedImage destImage, int destBand,
            double tolerance, boolean diagonal); FillResult fill(int x, int y, int fillValue); FillResult fillRadius(int x, int y, int fillValue, double radius); FillResult fill(int x, int y, int fillValue, double refValue); FillResult fillRadius(int x, int y, int fillValue, double refValue, double radius);  }