/** * Fills the region connected to the specified 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 {@code v} within the range * {@code start_pixel_value - tolerance <= v <= start_pixel_value + tolerance}. * * @param x start pixel x coordinate * * @param y start pixel y coordinate * * @param fillValue the value to write to the destination image for this region * * @return a new {@linkplain FillResult} */ public FillResult fill(int x, int y, int fillValue) { return fill(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand)); }
/** * Fills the region connected to the specified 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 {@code v} within the range * {@code refValue - tolerance <= v <= refValue + tolerance}. * * @param x start pixel x coordinate * * @param y start pixel y coordinate * * @param fillValue the value to write to the destination image for this region * * @param refValue the source image reference value for the region * * @return a new {@linkplain FillResult} */ public FillResult fill(int x, int y, int fillValue, double refValue) { return fillRadius(x, y, fillValue, refValue, Double.NaN); }
segmentsFilled = new ArrayList<ScanSegment>(); fillSegment(x, y, destIter); int xi = startX; while (xi <= endX) { newSegment = fillSegment(xi, segment.y - 1, destIter); xi = newSegment != null ? newSegment.endX+1 : xi+1; int xi = startX; while (xi <= endX) { newSegment = fillSegment(xi, segment.y + 1, destIter); xi = newSegment != null ? newSegment.endX+1 : xi+1;
if (checkPixel(xi, y)) { destIter.setSample(xi, y, destBand, fillValue); fill = true; if (checkPixel(xi, y)) { destIter.setSample(xi, y, destBand, fillValue); right = xi;
/** * Fills the region connected to the specified start pixel and lying within * {@code radius} pixels of the start pixel. * <p> * A pixel belongs to this region if there is a path between it and the starting * pixel which passes only through pixels of value {@code v} within the range * {@code start_pixel_value - tolerance <= v <= start_pixel_value + tolerance}. * * @param x start pixel x coordinate * * @param y start pixel y coordinate * * @param fillValue the value to write to the destination image for this region * * @param radius maximum distance (pixels) that a candidate pixel can be from * the start pixel * * @return a new {@linkplain FillResult} */ public FillResult fillRadius(int x, int y, int fillValue, double radius) { return fillRadius(x, y, fillValue, srcIter.getSampleDouble(x, y, srcBand), radius); }