Android Question read a bitmap to the data array

Adam888

Member
Licensed User
Longtime User
Hi

If I want to read a bitmap to the data array, one pixel mapping to one byte.
How can I do?

I have tried to use the LIB "keylabDirectBuffer", but it can't work.
Code: Copy
    Dim buff As keylabDirectBuffer
    Dim rr(640*480*4)As Byte


    buff.get2(rr)
    For i = 0 To 640*480*4-1  Step 4
        rr(i)=255
    Next
 
    buff.putByteArray(rr)
    buff.rewind
    '----------------------------------
    ImageView1.Bitmap=buff.copyPixelsToBitmap(bm.Width,bm.Height,buff.Config_ARGB_8888)
    ImageView1.Invalidate


THANK YOU.
 
I'm calling the buff.get2(rr) for move the pixel to array, then I can do some pixel process.
seems flip is a better way. but how can I access the type of java.nio.buff ?
Code: Copy
for y=0 to 100
    for x=0 to 100
      rr(y*100+x) = (rr(y*100+x) +  rr(y*100+x+1)  ) /2
    next
next
 
Upvote 0
Back
Top