733.图像渲染
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/cfa4c9767901c6f9a26adb73e02b368a.png)
public int[][] floodFill(int[][] image, int sr, int sc, int newColor) {
if (sr < 0 || sc < 0 || sr >= image.length || sc >= image[0].length || image[sr][sc] == newColor) return image;
int ori = image[sr][sc];
image[sr][sc] = newColor;
if( sr+1 < image.length && image[sr+1][sc] == ori)
floodFill(image,sr+1,sc,newColor);
if(sr-1 >= 0 && image[sr-1][sc] == ori)
floodFill(image,sr-1,sc,newColor);
if(sc+1 < image[0].length && image[sr][sc+1] == ori)
floodFill(image,sr,sc+1,newColor);
if(sc-1 >= 0 && image[sr][sc-1] == ori)
floodFill(image,sr,sc-1,newColor);
return image;
}