TextureBitmapReader
@UnstableApi
public final class TextureBitmapReader implements 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 methods |
|
|---|---|
Bitmap |
Returns the output |
Bitmap |
getBitmapAtPresentationTimeUs(long presentationTimeUs) |
Set<Long> |
Returns the timestamps in the order they were added. |
@Nullable Surface |
getSurface(Returns the |
void |
readBitmap(GlTextureInfo outputTexture, long presentationTimeUs)Reads the given |
void |
readBitmapUnpremultipliedAlpha(Reads the given |
Public constructors
Public methods
getBitmapAtPresentationTimeUs
public Bitmap getBitmapAtPresentationTimeUs(long presentationTimeUs)
| Throws | |
|---|---|
java.lang.IllegalStateException |
If no such bitmap is produced. |
getOutputTimestamps
public Set<Long> getOutputTimestamps()
Returns the timestamps in the order they were added.
getSurface
public @Nullable Surface getSurface(
int width,
int height,
boolean useHighPrecisionColorComponents
)
Returns the VideoFrameProcessor output Surface, if one is needed.
readBitmap
public void readBitmap(GlTextureInfo outputTexture, long presentationTimeUs)
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
public void readBitmapUnpremultipliedAlpha(
GlTextureInfo outputTexture,
long presentationTimeUs
)
Reads the given outputTexture as one with unpremultiplied alpha.
The read result can be fetched by calling getBitmapAtPresentationTimeUs or getBitmap.