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
?
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
?
或许答案稍后会来。
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(...)