Just guessing here, but several stuff to verify.
- you probably should set the Filter flag, after adding a MaskFilter,
and not before.
(just to be sure, although not state anywhere).
- Are your shure that your originalBitmap has a Alpha channel ?
Verify!
- If there is an Alpha channel on originalBitmap, is it filled with
something relevant, or is it filled with the same value ? What value
is that ?
- Have you tried the other BlurMaskFilter.Blur.* Constants ?
- Have you tried drawing the originalBitmap, with the blurPaint,
directly to the canvas that is passed to a view onDraw method ?
The MaskFilter Blur process, probably requires the target Canvas to
have an Alpha channel !
Hope some of this may help.
On Apr 18, 8:36 pm, qvark <[EMAIL PROTECTED]> wrote:
> Anybody?
>
> On 13 abr, 12:03, qvark <[EMAIL PROTECTED]> wrote:
>
> > Hello all, I have tobluran image and I have implemented my ownblur
> > algorithm (gaussian), but it is too slow (I guess it is due to the
> > emulator and the interpreted nature of the Dalvik VM).
>
> > I have found the class android.graphics.BlurMaskFilter but I haven't
> > been able to apply it successfully to an image (Bitmap).
>
> > If I try something like:
>
> > Paint blurPaint = new Paint();
> > blurPaint.setFilterBitmap(true);
> > blurPaint.setMaskFilter(new BlurMaskFilter(radius,
> > BlurMaskFilter.Blur.NORMAL));
>
> > Bitmap blurred = Bitmap.createBitmap(800, 600,
> > Bitmap.Config.RGB_565);
> > Canvas c = new Canvas(blurred);
> > c.drawBitmap(originalBitmap, 0, 0, blurPaint);
>
> > nothing happens (well, the borders of the image appear with shade,
> > with seems normal, according to "Note: if the paint contains a
> > maskfilter that generates a mask which extends beyond the bitmap's
> > original width/height (e.g. BlurMaskFilter), then the bitmap will be
> > drawn as if it were in a Shader with CLAMP mode. "
>
> > But the image is not blurred!!
>
> > I have tried a different approach passing the image to grey scale, the
> > grey to the alpha channel (because there is only a extractAlpha()
> > method that takes a Paint) and then:
>
> > Bitmap blurredBitmap = bm.extractAlpha(blurPaint, new int[] {0, 0});
>
> > But it makes the VM crash!! (seems like a bug inside the
> > extractAlpha() method, because extractAlpha() without params also
> > crash). It crashes when I use Bitmap.Config.ARGB_8888 or
> > Bitmap.Config.ARGB_4444, but not if I use Bitmap.Config.RGB_565, but
> > then obviously I lose the alpha information and the resulting bitmap
> > is all black.
>
> > Could anybody please provide a working example of blurring an image?
>
> > Thanks in advance,
>
> > Jose Luis.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---