-
public class SnapshotGlPictureRecorder extends SnapshotPictureRecorder
API 19. Records a picture snapshots from the RendererCameraPreview. It works as follows: - We register a one time RendererFrameCallback on the preview - We get the textureId and the frame callback on the RendererThread - [Optional: we construct another textureId for overlays] - We take a handle of the EGL context from the RendererThread - We move to another thread, and create a new EGL surface for that EGL context. - We make this new surface current, and re-draw the textureId on it - [Optional: fill the overlayTextureId and draw it on the same surface] - We use glReadPixels (through toByteArray) and save to file. We create a new EGL surface and redraw the frame because: 1. We want to go off the renderer thread as soon as possible 2. We have overlays to be drawn - we don't want to draw them on the preview surface, not even for a frame.
-
-
Constructor Summary
Constructors Constructor Description SnapshotGlPictureRecorder(PictureResult.Stub stub, PictureRecorder.PictureResultListener listener, RendererCameraPreview preview, AspectRatio outputRatio, Overlay overlay)
-
Method Summary
Modifier and Type Method Description voidtake()Takes a picture. -
-
Constructor Detail
-
SnapshotGlPictureRecorder
SnapshotGlPictureRecorder(PictureResult.Stub stub, PictureRecorder.PictureResultListener listener, RendererCameraPreview preview, AspectRatio outputRatio, Overlay overlay)
-
-
Method Detail
-
take
void take()
Takes a picture.
-
-
-
-