The first code snippet you included won't compile:

BitmapDrawable bmd = new BitmapDrawable(canvas);


BitmapDrawable can't take a canvas in its constructor.

You don't need a drawable if this is all you want to do, instead use the
canvas directly, something like:

Bitmap ob =
BitmapFactory.decodeResource(resources,R.drawable.mydaysminipic_td);
Bitmap obm = Bitmap.createBitmap(ob.getWidth(), ob.getHeight(),
ob.getConfig());
Canvas canvas = new Canvas(obm);
Paint paint = new Paint();
paint.setColorFilter(new PorterDuffColorFilter(0xff00ffff,Mode.SRC_ATOP))
canvas.drawBitmap(ob, 0f, 0f, paint);

obm should now contain the modified image. Note though that SRC_ATOP in this
context will result in a blank image; I think you probably want SRC instead
which will be more efficient too.

Tom.

2009/5/26 guruk <[email protected]>

>
> Hi Tom, thanks for your help
>
> do you mean something like that: (till now i did not worked)
>
>        Bitmap ob = BitmapFactory.decodeResource
> (resources,R.drawable.mydaysminipic_td);
>                                                 Bitmap obm =
> Bitmap.createScaledBitmap(ob, 18, 18,false);
>                                                Canvas canvas = new
> Canvas(obm);
>                                                BitmapDrawable bmd = new
> BitmapDrawable(canvas);
>
>  bmd.setColorFilter(0xff00ffff,Mode.SRC_ATOP);
>                                                bmd.draw(canvas);
>                                                Bitmap newbit;
>                                                newbit=bmd.getBitmap();
>
> Really I came crazy with that. Finaly I just need the Solution for:
>
> I have a Drawable and I like that all set pixels in it get another
> Color and
> finaly to update my widget ... for that I have to options:
>
> updateViews.setImageViewBitmap(draws2[i + 10], newbit);  //thats what
> I try now with above code
>
> or i make it simple:  (but i miss a link)
> --
> Drawable dx = resources.getDrawable(R.drawable.mydaysminipic_ov);
> dx.setColorFilter(0xff00ff00, Mode.SRC_ATOP);
> updateViews.setImageViewResource(draws2[i + 10],
> R.drawable.mydaysminipic_pe);
> --
> but that does not work, because WHAT is the ID (int) of my created
> dx??
>
> Any Ideas to solve that. would be really great
>
> Thanks
> Chris
> >
>

--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to