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.

Bitmap!
getBitmapAtPresentationTimeUs(presentationTimeUs: Long)
(Mutable)Set<Long!>!

Returns the timestamps in the order they were added.

Surface?
getSurface(
    width: Int,
    height: Int,
    useHighPrecisionColorComponents: Boolean
)

Returns the VideoFrameProcessor output Surface, if one is needed.

Unit
readBitmap(outputTexture: GlTextureInfo!, presentationTimeUs: Long)

Reads the given outputTexture.

Unit
readBitmapUnpremultipliedAlpha(
    outputTexture: GlTextureInfo!,
    presentationTimeUs: Long
)

Reads the given outputTexture as one with unpremultiplied alpha.

Public constructors

TextureBitmapReader

TextureBitmapReader()

Public functions

getBitmap

fun getBitmap(): Bitmap!

Returns the output Bitmap.

getBitmapAtPresentationTimeUs

fun getBitmapAtPresentationTimeUs(presentationTimeUs: Long): Bitmap!
Returns
Bitmap!

The output Bitmap at a given presentationTimeUs.

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.