public int filterRGB ( int pX , int pY , int pARGB ) { // Get color components int r = pARGB >> 16 & 0xFF ; int g = pARGB >> 8 & 0xFF ; int b = pARGB & 0xFF ; // ITU standard: Gray scale=(222*Red+707*Green+71*Blue)/1000 int gray = ( 222 * r + 707 * g + 71 * b ) / 1000 ; //int gray = (int) ((float) (r + g + b) / 3.0f); if ( range != 1.0f ) { // Apply range gray = low + ( int ) ( gray * range ) ; } // Return ARGB pixel return ( pARGB & 0xFF000000 ) | ( gray << 16 ) | ( gray << 8 ) | gray ; }
Filters one pixel using ITU color - conversion .