/** * Merges the given region into this region. * <p> * * At present, this method doesn't bother about merging scan segments, * it just adds the other region's segments and updates the index * and bounds as necessary. * * @param other other region */ public void expand(FillResult other) { bounds = bounds.union(other.bounds); for (FloodFiller.ScanSegment otherSeg : other.segments) { segments.add(otherSeg); addToIndex(otherSeg, segments.size()-1); } numPixels += other.numPixels; }
addToIndex(segment, 0); addToIndex(segment, k++);