How to apply filter to images loaded by Android ImageLoader? -
i'm using android-universal-image-loader library load images , caching etc. i'm trying apply box blur filter it, using jh labs library. tried apply filter in onloadingcomplete event doesn't seem bitmap there in mutable. has had experience of applying filter bitmaps loaded android imageloader?
i've gotten work. right approach apply filter in onloadingcomplete event. however, since bitmap there inmutable, key pass in imageview , call setimagebitmap method again set filtered bitmap imageview:
public void displayimageblurred(string imageuri, final imageview imageview) { this.displayimage(imageuri, imageview, true, 0, new simpleimageloadinglistener() { @override public void onloadingcomplete(bitmap loadedimage) { int width = loadedimage.getwidth(); int height = loadedimage.getheight(); boxblurfilter filter = new boxblurfilter(); filter.setradius(8.5f); int[] src = androidutils.bitmaptointarray(loadedimage); src = filter.filter(src, width, height); loadedimage = bitmap.createbitmap(src, width, height, config.argb_8888); imageview.setimagebitmap(loadedimage); } }); } public void displayimage(string imageuri, final imageview imageview, boolean callbackifcached, long starttime, imageloadinglistener listener) { imageloader imageloader = imageloader.getinstance(); imageloader.displayimage(imageuri, imageview, defaultoptions, listener); }
Comments
Post a Comment