5

Is is possible to read byte array from surface view?

Like in Camera API we have callback from setPreviewCallback() here in onPreviewFrame(byte[])

we have access of byte array. So same like can we have something directly from SurfaceView?

4

1 回答 1

0

或许答案稍后会来。

PixelCopy可以byte[]Surface

以下是一些示例:

mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

PixelCopy.request(mSurface, // which you wanna get byte[]
     mBitmap, // the byte[] in Bitmap
     mCallback,
     mHandler // which Callback will be invoke
);

Callback你可以得到 byte[] from Bitmap,就像Bitmap.copyPixelsToBuffer(...)

于 2021-02-23T13:02:08.130 回答