Bitmap generateGradient ( ) { int [ ] [ ] pixels = new int [ 1080 ] [ 1920 ] ; for ( int y = 0 ; y < 1080 ; y ++ ) { for ( int x = 0 ; x < 1920 ; x ++ ) { int r = ( int ) ( y / 1080f * 255 ) ; int g = ( int ) ( x / 1920f * 255 ) ; int b = ( int ) ( ( Math . hypot ( x , y ) / Math . hypot ( 1080 , 1920 ) ) * 255 ) ; pixels [ y ] [ x ] = r << 16 | g << 8 | b ; } } return new Bitmap ( pixels ) ; }
Returns a bitmap that lights up red subpixels at the bottom green subpixels on the right and blue subpixels in bottom - right .