def floodfill(self, color, xy): tmp = self.get_layer().image.data.copy() if self.mode == "erase": #make sure we're filling with a different color from the initial pixel color = 255 - tmp.getpixel(xy) mask = floodfill(tmp, xy, color) if mask is not None: bbox = mask.getbbox() if bbox is not None: self.scratch.image.paint(color, mask=mask) return bbox return None
def floodfill(self, color, xy): return floodfill(self.data, xy, color)