private int findDestColor(int color){
  int sourceR=color >> 16 & 0xff;
  int sourceG=color >> 8 & 0xff;
  int sourceB=color & 0xff;
  if (sourceR > 128 && sourceG > 128 && sourceB > 128) {
    sourceR=Math.max(sourceR >> 1,0);
    sourceG=Math.max(sourceG >> 1,0);
    sourceB=Math.max(sourceB >> 1,0);
  }
 else {
    if (color == 0) {
      return 0x222222;
    }
    sourceR=Math.min(sourceR << 1,0xff);
    sourceG=Math.min(sourceG << 1,0xff);
    sourceB=Math.min(sourceB << 1,0xff);
  }
  return ((sourceR << 16) & 0xff0000) | ((sourceG << 8) & 0xff00) | (sourceB & 0xff);
}

private int findDestColor ( int color ) { int sourceR = color > > 16 & 0xff ; int sourceG = color > > 8 & 0xff ; int sourceB = color & 0xff ; if ( sourceR > 128 && sourceG > 128 && sourceB > 128 ) { sourceR = Math . max ( sourceR > > 1 , 0 ) ; sourceG = Math . max ( sourceG > > 1 , 0 ) ; sourceB = Math . max ( sourceB > > 1 , 0 ) ; } else { if ( color == 0 ) { return 0x222222 ; } sourceR = Math . min ( sourceR << 1 , 0xff ) ; sourceG = Math . min ( sourceG << 1 , 0xff ) ; sourceB = Math . min ( sourceB << 1 , 0xff ) ; } return ( ( sourceR << 16 ) & 0xff0000 ) | ( ( sourceG << 8 ) & 0xff00 ) | ( sourceB & 0xff ) ; }
finds a suitable destination color for gradient values
