Handle onto a raw buffer that is being managed by the screen compositor.
Surface是一个句柄,该句柄是指向由屏幕合成器管理的原始缓冲。
A Surface is generally created by or from a consumer of image buffers (such as a
Surface通常被图像缓冲区的消费者创建或来自于其。
{@link android.graphics.SurfaceTexture}, {@link android.media.MediaRecorder}, or
{@link android.renderscript.Allocation}), and is handed to some kind of producer (such as
然后交给生产者在其原生缓冲区中绘画,最终显示。
{@link android.opengl.EGL14#eglCreateWindowSurface(android.opengl.EGLDisplay,android.opengl.EGLConfig,java.lang.Object,int[],int) OpenGL},
{@link android.media.MediaPlayer#setSurface MediaPlayer}, or
{@link android.hardware.camera2.CameraDevice#createCaptureSession CameraDevice}) to draw into.
Note:A Surface acts like a
{@link java.lang.ref.WeakReference weak reference} to the consumer it is associated with. By
itself it will not keep its parent consumer from being reclaimed.
注意:Surface是一个弱引用到与之管理的消费者,就其本身而言,它不会阻止父类消费者被回收。
47 /**
48 * Handle onto a raw buffer that is being managed by the screen compositor.
49 *
50 * <p>A Surface is generally created by or from a consumer of image buffers (such as a
51 * {@link android.graphics.SurfaceTexture}, {@link android.media.MediaRecorder}, or
52 * {@link android.renderscript.Allocation}), and is handed to some kind of producer (such as
53 * {@link android.opengl.EGL14#eglCreateWindowSurface(android.opengl.EGLDisplay,android.opengl.EGLConfig,java.lang.Object,int[],int) OpenGL},
54 * {@link android.media.MediaPlayer#setSurface MediaPlayer}, or
55 * {@link android.hardware.camera2.CameraDevice#createCaptureSession CameraDevice}) to draw
56 * into.</p>
57 *
58 * <p><strong>Note:</strong> A Surface acts like a
59 * {@link java.lang.ref.WeakReference weak reference} to the consumer it is associated with. By
60 * itself it will not keep its parent consumer from being reclaimed.</p>
61 */
62 public class Surface implements Parcelable {