It's monday and I'm not fully awake but if it's for display, just blit
you bitmap twice with transparency the second blit being offseted by
1,1. you can do it once more fith a -1,1 offset.
Maybe the result might suit your need.
If the result is fine for you do the same kind of thing in a Bitmap/
Canvas setup and save the resulting bitmap.
At leat you blur a bitmap without expenssive per pixel computation on
the VM side.
Z.


On Apr 21, 12:45 am, "Nick Jenkin" <[EMAIL PROTECTED]> wrote:
> Hi
> If you are unable to get the native blur apis working you can use a
> simple blur convolution/kernel matrix like:
>
> 0 0 0 0 0
> 0 1 1 1 0
> 0 1 1 1 0
> 0 1 1 1 0
> 0 0 0 0 0
>
> (This is much like the convolution matrix you get with a gaussian blur
> so I assume you have some code thats able to apply these to images)
> -Nick
>
>
>
> On Mon, Apr 21, 2008 at 6:48 AM, Rui Martins <[EMAIL PROTECTED]> wrote:
>
> >  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.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to