open class EglWindowSurface : EglSurface
Recordable EGL window surface. It's good practice to explicitly release() the surface, preferably from a finally block.
EglWindowSurface(eglCore: EglCore, surface: Surface, releaseSurface: Boolean = false)
Set releaseSurface to true if you want the Surface to be released when release() is called. This is convenient, but can interfere with framework classes that expect to manage the Surface themselves (e.g. if you release a SurfaceView's Surface, the surfaceDestroyed() callback won't fire). EglWindowSurface(eglCore: EglCore, surfaceTexture: SurfaceTexture)
Associates an EGL surface with the SurfaceTexture. |
var eglCore: EglCore |
|
var eglSurface: EGLSurface |
open fun release(): Unit
Releases any resources associated with the EGL surface. Does not require that the surface's EGL context be current. |
|
fun swapBuffers(): Boolean
Calls eglSwapBuffers. Use this to "publish" the current frame. Returns false on failure. |
fun getHeight(): Int
Returns the surface's height, in pixels. |
|
fun getWidth(): Int
Returns the surface's width, in pixels. |
|
fun isCurrent(): Boolean
Whether this surface is current on the attached EglCore. |
|
fun makeCurrent(): Unit
Makes our EGL context and surface current. fun makeCurrent(readSurface: EglSurface): Unit
Makes our EGL context and surface current for drawing, using the supplied surface for reading. |
|
fun makeNothingCurrent(): Unit
Makes no surface current for the attached eglCore. |
|
fun setHeight(height: Int): Unit
Can be called by subclasses whose height is guaranteed to never change, so we can cache this value. For window surfaces, this should not be called. |
|
fun setPresentationTime(nsecs: Long): Unit
Sends the presentation time stamp to EGL. nsecs is the timestamp in nanoseconds. |
|
fun setWidth(width: Int): Unit
Can be called by subclasses whose width is guaranteed to never change, so we can cache this value. For window surfaces, this should not be called. |
|
fun toByteArray(format: CompressFormat = Bitmap.CompressFormat.PNG): ByteArray
Saves the EGL surface to given format. Expects that this object's EGL surface is current. |
|
fun toFile(file: File, format: CompressFormat = Bitmap.CompressFormat.PNG): Unit
Saves the EGL surface to a file. Expects that this object's EGL surface is current. |
|
fun toOutputStream(stream: OutputStream, format: CompressFormat = Bitmap.CompressFormat.PNG): Unit
Saves the EGL surface to the given output stream. Expects that this object's EGL surface is current. |