private CloseableReference<Bitmap> createRainbowBitmap() {
    final int w = 256;
    final int h = 256;
    mOriginalBitmap = mPlatformBitmapFactory.createBitmap(w, h, Bitmap.Config.ARGB_8888);

    final int[] colors = new int[w * h];
    for (int i = 0; i < w; i++) {
      for (int j = 0; j < h; j++) {
        final float hue = 360f * j / (float) w;
        final float saturation = 2f * (h - i) / (float) h;
        final float value = 1;
        colors[i * h + j] = Color.HSVToColor(255, new float[]{hue, saturation, value});
      }
    }
    mOriginalBitmap.get().setPixels(colors, 0, w, 0, 0, w, h);

    return mOriginalBitmap;
  }
private CloseableReference < Bitmap > createRainbowBitmap ( ) { final int w = 256 ; final int h = 256 ; mOriginalBitmap = mPlatformBitmapFactory . createBitmap ( w , h , Bitmap . Config . ARGB_8888 ) ; final int [ ] colors = new int [ w * h ] ; for ( int i = 0 ; i < w ; i ++ ) { for ( int j = 0 ; j < h ; j ++ ) { final float hue = 360f * j / ( float ) w ; final float saturation = 2f * ( h - i ) / ( float ) h ; final float value = 1 ; colors [ i * h + j ] = Color . HSVToColor ( 255 , new float [ ] { hue , saturation , value } ) ; } } mOriginalBitmap . get ( ) . setPixels ( colors , 0 , w , 0 , 0 , w , h ) ; return mOriginalBitmap ; }
Creates a new bitmap with a HSV map at value=1