androidbitmapdata

How To Fill Bitmap Data in ARGB Format in Android LabelView


I'm working with Android and I really need a fast way to get a bitmap of format BGRA to be filled in ARGB.

One thing I aslo want to let u know that The Data comes in byte[] format and I have to convert in int[] format also.

Can AnyOne Tell me How to do this ... Thanks in Advance


Solution

  • If you want to load a Bitmap by bytestream, you can use Bitmap.decodeStream. You could then use getPixel(s?) to get the int array. This is one way I know how to do this, probably not the fastest though. A faster way would be to convert bytes to int, if your byte array is nothing but pixeldata this won't be too hard.

    BGRA to ARGB can be done with bitshifting quite fast.

    A nice source you would probably like: https://web.archive.org/web/20141229164101/http://bobpowell.net/lockingbits.aspx