This will address the image halo effect of image effects. The same as the front face is the pixel processing, the idea of this implementation can be found in the Android image processing series nine--image effects processing of the second-blur effect and Android image processing series 13--image effects processing of the six-light effect. The effect is that the pixels within the circle do not change, and the dots outside the circle are blurred. So the use of the blur effect and lighting effect is within the circle of the algorithm, can be said to be mentioned above the two effect of the combination.
See below:
Original:
:
Halo effect is not very obvious, fuzzy strength is not enough, but also can obviously see a circle in the picture, the inner circle area than the outside of the circle to see clearly a point (mm of the left and right face can see the effect). The processing effect is not very good, here can only initiate. Paste the following code:
/*** Halo effect *@paramBMP *@paramThe x -coordinate of the X-Halo center point in BMP *@paramY -coordinate of the Y-Halo center point in BMP *@paramradius of R halo *@return */ PublicBitmap Halo (Bitmap bmp,intXintYfloatr) {LongStart =System.currenttimemillis (); //Gaussian matrix int[] Gauss =New int[] {1, 2, 1, 2, 4, 2, 1, 2, 1 }; intwidth =bmp.getwidth (); intHeight =bmp.getheight (); Bitmap Bitmap=bitmap.createbitmap (width, height, Bitmap.Config.RGB_565); intPIXR = 0; intPIXG = 0; intPIXB = 0; intPixcolor = 0; intNEWR = 0; intNEWG = 0; intNewb = 0; intDelta = 18;//the smaller the value, the brighter the picture, and the darker the larger it becomes. intIDX = 0; int[] pixels =New int[Width *height]; Bmp.getpixels (Pixels,0, Width, 0, 0, width, height); for(inti = 1, length = height-1; i < length; i++) { for(intK = 1, len = width-1; K < Len; k++) {idx= 0; intDistance = (int) (Math.pow (K-x, 2) + Math.pow (i-y, 2)); //not the point of the central area to do fuzzy processing if(Distance > R *r) { for(intm =-1; M <= 1; m++) { for(intn =-1; n <= 1; n++) {Pixcolor= pixels[(i + m) * Width + k +N]; PIXR=color.red (Pixcolor); Pixg=Color.green (Pixcolor); PIXB=Color.Blue (Pixcolor); NEWR= NEWR + (int) (PIXR *Gauss[idx]); NEWG= NEWG + (int) (PIXG *Gauss[idx]); Newb= Newb + (int) (PIXB *Gauss[idx]); IDX++; }} NEWR/=Delta; NEWG/=Delta; Newb/=Delta; NEWR= Math.min (255, Math.max (0, NEWR)); NEWG= Math.min (255, Math.max (0, NEWG)); Newb= Math.min (255, Math.max (0, newb)); Pixels[i* Width + K] = Color.argb (255, NEWR, NEWG, newb); NEWR= 0; NEWG= 0; Newb= 0; }}} bitmap.setpixels (pixels,0, Width, 0, 0, width, height); LongEnd =System.currenttimemillis (); LOG.D ("May", "used time=" + (End-start)); returnbitmap; }