public static void fillRectangle ( InterleavedS32 img , int value , int x0 , int y0 , int width , int height ) { int x1 = x0 + width ; int y1 = y0 + height ; if ( x0 < 0 ) x0 = 0 ; if ( x1 > img . width ) x1 = img . width ; if ( y0 < 0 ) y0 = 0 ; if ( y1 > img . height ) y1 = img . height ; int length = ( x1 - x0 ) * img . numBands ; for ( int y = y0 ; y < y1 ; y ++ ) { int index = img . startIndex + y * img . stride + x0 * img . numBands ; int indexEnd = index + length ; while ( index < indexEnd ) { img . data [ index ++ ] = value ; } } }
Draws a filled rectangle that is aligned along the image axis inside the image . All bands are filled with the same value .