Posting my solution here in case anyone runs into the same problem,.
You can set the alpha to 0xFF using the DST_ATOP mode. Here's my code
to extract the alpha and colors properly :

                // HACK : We need to force the alpha to 0xFF, or getPixels will
return us black for the RGB channels.
                // So we first retrieve the existing pixels, but will only look 
at
the alpha component. then, we make
                // a copy of the bitmap, on which we paint the alpha channel to
fully opaque, which will let us extract the
                // color components properly. We will then merge the two arrays
together.
                int[] arPixelsAlpha = new int[numPixels];
                int[] arPixelsColor = new int[numPixels];

                Bitmap bitmapCopy = Bitmap.createBitmap(width, height,
Bitmap.Config.ARGB_8888);
                Canvas canvasCopy = new Canvas(bitmapCopy);
                canvasCopy.drawBitmap(bitmap, new Matrix(), new Paint());
                canvasCopy.drawColor(0xFF000000, Mode.DST_ATOP);

                bitmap.getPixels(arPixelsAlpha, 0, width, 0, 0, width, height);
                bitmapCopy.getPixels(arPixelsColor, 0, width, 0, 0, width, 
height);

After that, for each pixel, grab the alpha value from (arPixelsAlpha
[i] & 0xFF000000), and the color component from (arPixelsColor[i] &
0x00FFFFFF)


--~--~---------~--~----~------------~-------~--~----~
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