开发者

How To Fill Bitmap Data in ARGB Format in Android LabelView

开发者 https://www.devze.com 2023-03-07 12:49 出处:网络
I\'m working with Android and I really need a fast way to get a 开发者_开发知识库bitmap of format BGRA to be filled in ARGB.

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


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


The fastest way I think would be to do it in native code using the NDK. I've been considering to use it for image processing for some time but didn't get the chance yet. So I don't know much about it (i.e. how you would access your byte buffer) but you could start from the Plasma sample for bitmap processing in JNI.

0

精彩评论

暂无评论...
验证码 换一张
取 消