java - How do I "control" a pixel array in Android? (Blur) -


i'm trying create simple blur effect on bitmap , although know there algorithms out there already, i'd still understand how work. code have far, there's nothing in there resembles blur algorithm @ moment, wanted know how setpixels method works little better.

    public void blurtest(bitmap sentbm) {          bitmap blurredbitmap = sentbm;          int bmwidth = sentbm.getwidth();          int bmheight = sentbm.getheight();           int[] pixels = new int[bmwidth * bmheight];                      sentbm.getpixels(pixels, 0,bmwidth,0,0,bmwidth,bmheight);           (int = 0; < 200000; i++) {              pixels[i] = color.black;          }           blurredbitmap.setpixels(pixels, 0, bmwidth, 0, 0, bmwidth, bmheight); 

i've done research on how blur algorithms work , while understand theory behind them, don't know how apply each pixels. example, how pixel being blurred expressed using weight numbers. pixel 2 pixels away center has weight of 0.065 or example. makes sense how programmatically scan each pixel , add weights nearby pixels? need simplest possible algorithm there is, learn from.

or make things more simple - how add 25% pure blue pixels? confuses me most, how add , subtract value individual pixels.

any appreciated, thanks!


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -