public final class PixelCopy extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
PixelCopy.CopyResultStatus |
static interface |
PixelCopy.OnPixelCopyFinishedListener
Listener for observing the completion of a PixelCopy request.
|
Modifier and Type | Field and Description |
---|---|
static int |
ERROR_DESTINATION_INVALID
The destination isn't a valid copy target.
|
static int |
ERROR_SOURCE_INVALID
It is not possible to copy from the source.
|
static int |
ERROR_SOURCE_NO_DATA
The source has nothing to copy from.
|
static int |
ERROR_TIMEOUT
A timeout occurred while trying to acquire a buffer from the source to
copy from.
|
static int |
ERROR_UNKNOWN
The pixel copy request failed with an unknown error.
|
static int |
SUCCESS
The pixel copy request succeeded
|
Modifier and Type | Method and Description |
---|---|
static void |
request(Surface source,
Bitmap dest,
PixelCopy.OnPixelCopyFinishedListener listener,
Handler listenerThread)
|
static void |
request(SurfaceView source,
Bitmap dest,
PixelCopy.OnPixelCopyFinishedListener listener,
Handler listenerThread)
Requests for the display content of a
SurfaceView to be copied
into a provided Bitmap . |
public static final int SUCCESS
public static final int ERROR_UNKNOWN
public static final int ERROR_TIMEOUT
public static final int ERROR_SOURCE_NO_DATA
Surface
this means that no buffers have been queued yet. Wait for the source
to produce a frame and try again.public static final int ERROR_SOURCE_INVALID
public static final int ERROR_DESTINATION_INVALID
public static void request(SurfaceView source, Bitmap dest, PixelCopy.OnPixelCopyFinishedListener listener, Handler listenerThread)
SurfaceView
to be copied
into a provided Bitmap
.
The contents of the source will be scaled to fit exactly inside the bitmap.
The pixel format of the source buffer will be converted, as part of the copy,
to fit the the bitmap's Bitmap.Config
. The most recently queued buffer
in the SurfaceView's Surface will be used as the source of the copy.source
- The source from which to copydest
- The destination of the copy. The source will be scaled to
match the width, height, and format of this bitmap.listener
- Callback for when the pixel copy request completeslistenerThread
- The callback will be invoked on this Handler when
the copy is finished.public static void request(Surface source, Bitmap dest, PixelCopy.OnPixelCopyFinishedListener listener, Handler listenerThread)
Surface
to be copied into
a provided Bitmap
.
The contents of the source will be scaled to fit exactly inside the bitmap.
The pixel format of the source buffer will be converted, as part of the copy,
to fit the the bitmap's Bitmap.Config
. The most recently queued buffer
in the Surface will be used as the source of the copy.source
- The source from which to copydest
- The destination of the copy. The source will be scaled to
match the width, height, and format of this bitmap.listener
- Callback for when the pixel copy request completeslistenerThread
- The callback will be invoked on this Handler when
the copy is finished.