Code:
Package COM. color; import android. content. context; import android. graphics. bitmap; import android. graphics. bitmapfactory; import android. graphics. canvas; import android. graphics. color; import android. graphics. paint; import android. util. attributeset; import android. widget. imageview; public class colorview extends imageview {private paint mypaint = NULL; private Bitmap bitmap = NULL; private int width, height; private int [] oldpixels; private int [] newpixels; private int color, color2; private int pixelsr, pixelsg, pixelsb, pixelsa, pixelsr2, pixelsg2, pixelsb2; Public colorview (context, attributeset attrs) {super (context, attrs ); bitmap = bitmapfactory. decoderesource (context. getresources (), R. drawable. WW); width = bitmap. getwidth (); Height = bitmap. getheight (); oldpixels = new int [width * Height]; newpixels = new int [width * Height]; invalidate () ;}@ overrideprotected void ondraw (canvas) {super. ondraw (canvas); // obtain the pixel bitmap. getpixels (oldpixels, 0, width, 0, 0, width, height); For (INT I = 1; I