TextureBitmapReader
@UnstableApi
class TextureBitmapReader : VideoFrameProcessorTestRunner.BitmapReader
Reads from an OpenGL texture. Only for use on physical devices.
For images with alpha, this method incorrectly marks the output Bitmap as premultiplied, even though OpenGL typically outputs only non-premultiplied alpha.
Summary
Public constructors |
|---|
Public functions |
|
|---|---|
Bitmap! |
Returns the output |
Bitmap! |
getBitmapAtPresentationTimeUs(presentationTimeUs: Long) |
(Mutable)Set<Long!>! |
Returns the timestamps in the order they were added. |
Surface? |
getSurface(Returns the |
Unit |
readBitmap(outputTexture: GlTextureInfo!, presentationTimeUs: Long)Reads the given |
Unit |
readBitmapUnpremultipliedAlpha(Reads the given |
Public constructors
Public functions
getBitmapAtPresentationTimeUs
fun getBitmapAtPresentationTimeUs(presentationTimeUs: Long): Bitmap!
| Throws | |
|---|---|
java.lang.IllegalStateException |
If no such bitmap is produced. |
getOutputTimestamps
fun getOutputTimestamps(): (Mutable)Set<Long!>!
Returns the timestamps in the order they were added.
getSurface
fun getSurface(
width: Int,
height: Int,
useHighPrecisionColorComponents: Boolean
): Surface?
Returns the VideoFrameProcessor output Surface, if one is needed.
readBitmap
fun readBitmap(outputTexture: GlTextureInfo!, presentationTimeUs: Long): Unit
Reads the given outputTexture.
The read result can be fetched by calling getBitmapAtPresentationTimeUs or getBitmap.
This implementation incorrectly marks the output Bitmap as premultiplied, even though OpenGL typically outputs only non-premultiplied alpha. Use readBitmapUnpremultipliedAlpha to properly handle alpha.
readBitmapUnpremultipliedAlpha
fun readBitmapUnpremultipliedAlpha(
outputTexture: GlTextureInfo!,
presentationTimeUs: Long
): Unit
Reads the given outputTexture as one with unpremultiplied alpha.
The read result can be fetched by calling getBitmapAtPresentationTimeUs or getBitmap.