@@ -12,44 +12,44 @@ private BoundaryFill() {
12
12
* Get the color at the given co-odrinates of a 2D image
13
13
*
14
14
* @param image The image to be filled
15
- * @param x_co_ordinate The x co-ordinate of which color is to be obtained
16
- * @param y_co_ordinate The y co-ordinate of which color is to be obtained
15
+ * @param xCoordinate The x co-ordinate of which color is to be obtained
16
+ * @param yCoordinate The y co-ordinate of which color is to be obtained
17
17
*/
18
- public static int getPixel (int [][] image , int x_co_ordinate , int y_co_ordinate ) {
19
- return image [x_co_ordinate ][ y_co_ordinate ];
18
+ public static int getPixel (int [][] image , int xCoordinate , int yCoordinate ) {
19
+ return image [xCoordinate ][ yCoordinate ];
20
20
}
21
21
22
22
/**
23
23
* Put the color at the given co-odrinates of a 2D image
24
24
*
25
25
* @param image The image to be filed
26
- * @param x_co_ordinate The x co-ordinate at which color is to be filled
27
- * @param y_co_ordinate The y co-ordinate at which color is to be filled
26
+ * @param xCoordinate The x co-ordinate at which color is to be filled
27
+ * @param yCoordinate The y co-ordinate at which color is to be filled
28
28
*/
29
- public static void putPixel (int [][] image , int x_co_ordinate , int y_co_ordinate , int new_color ) {
30
- image [x_co_ordinate ][ y_co_ordinate ] = new_color ;
29
+ public static void putPixel (int [][] image , int xCoordinate , int yCoordinate , int newColor ) {
30
+ image [xCoordinate ][ yCoordinate ] = newColor ;
31
31
}
32
32
33
33
/**
34
34
* Fill the 2D image with new color
35
35
*
36
36
* @param image The image to be filed
37
- * @param x_co_ordinate The x co-ordinate at which color is to be filled
38
- * @param y_co_ordinate The y co-ordinate at which color is to be filled
39
- * @param new_color The new color which to be filled in the image
40
- * @param boundary_color The old color which is to be replaced in the image
37
+ * @param xCoordinate The x co-ordinate at which color is to be filled
38
+ * @param yCoordinate The y co-ordinate at which color is to be filled
39
+ * @param newColor The new color which to be filled in the image
40
+ * @param boundaryColor The old color which is to be replaced in the image
41
41
*/
42
- public static void boundaryFill (int [][] image , int x_co_ordinate , int y_co_ordinate , int new_color , int boundary_color ) {
43
- if (x_co_ordinate >= 0 && y_co_ordinate >= 0 && getPixel (image , x_co_ordinate , y_co_ordinate ) != new_color && getPixel (image , x_co_ordinate , y_co_ordinate ) != boundary_color ) {
44
- putPixel (image , x_co_ordinate , y_co_ordinate , new_color );
45
- boundaryFill (image , x_co_ordinate + 1 , y_co_ordinate , new_color , boundary_color );
46
- boundaryFill (image , x_co_ordinate - 1 , y_co_ordinate , new_color , boundary_color );
47
- boundaryFill (image , x_co_ordinate , y_co_ordinate + 1 , new_color , boundary_color );
48
- boundaryFill (image , x_co_ordinate , y_co_ordinate - 1 , new_color , boundary_color );
49
- boundaryFill (image , x_co_ordinate + 1 , y_co_ordinate - 1 , new_color , boundary_color );
50
- boundaryFill (image , x_co_ordinate - 1 , y_co_ordinate + 1 , new_color , boundary_color );
51
- boundaryFill (image , x_co_ordinate + 1 , y_co_ordinate + 1 , new_color , boundary_color );
52
- boundaryFill (image , x_co_ordinate - 1 , y_co_ordinate - 1 , new_color , boundary_color );
42
+ public static void boundaryFill (int [][] image , int xCoordinate , int yCoordinate , int newColor , int boundaryColor ) {
43
+ if (xCoordinate >= 0 && yCoordinate >= 0 && getPixel (image , xCoordinate , yCoordinate ) != newColor && getPixel (image , xCoordinate , yCoordinate ) != boundaryColor ) {
44
+ putPixel (image , xCoordinate , yCoordinate , newColor );
45
+ boundaryFill (image , xCoordinate + 1 , yCoordinate , newColor , boundaryColor );
46
+ boundaryFill (image , xCoordinate - 1 , yCoordinate , newColor , boundaryColor );
47
+ boundaryFill (image , xCoordinate , yCoordinate + 1 , newColor , boundaryColor );
48
+ boundaryFill (image , xCoordinate , yCoordinate - 1 , newColor , boundaryColor );
49
+ boundaryFill (image , xCoordinate + 1 , yCoordinate - 1 , newColor , boundaryColor );
50
+ boundaryFill (image , xCoordinate - 1 , yCoordinate + 1 , newColor , boundaryColor );
51
+ boundaryFill (image , xCoordinate + 1 , yCoordinate + 1 , newColor , boundaryColor );
52
+ boundaryFill (image , xCoordinate - 1 , yCoordinate - 1 , newColor , boundaryColor );
53
53
}
54
54
}
55
55
0 commit comments