Saturday, August 20, 2011

[android-developers] Re: ALPHA_8 bitmaps and getPixel.

Noone?
On Aug 11, 11:21 am, Matyas <matyas.b...@gmail.com> wrote:
> Hi,
>
> The following is giving me a serious headache.
>
> Bitmap mTestMap = Bitmap.createBitmap(20, 20, Config.ALPHA_8);
> mTestMap.setPixel(10,10, Color.WHITE);
> Log.d("Test", "HasAlpha=" + mTestMap.hasAlpha() + ", IsMutable=" +
> mTestMap.isMutable() +
>                 ", PixelColor=" + mTestMap.getPixel(10,10));
>
> The output is:
> 08-11 10:56:23.490: DEBUG/Test(11211): HasAlpha=true, IsMutable=true,
> PixelColor=0
>
> The question is, why does getPixel return 0? And if it was meant to
> return 0, what is the correct way to retrieve pixel color information
> (or alpha channel information) from an ALPHA_8 bitmap? I am trying to
> use this kind of bitmap for hit-testing in a game. RGB_565 works fine,
> but I am trying to reduce the memory.

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

No comments:

Post a Comment