library / com.otaliastudios.zoom / ZoomSurfaceView

ZoomSurfaceView

open class ZoomSurfaceView : GLSurfaceView, ZoomApi, Renderer

Uses ZoomEngine to allow zooming and pan events onto a GL rendered surface.

Types

Callback

A Callback to be notified of the surface lifecycle. All methods are invoked on the ui thread for convenience.

interface Callback

Constructors

<init>

ZoomSurfaceView(context: Context, attrs: AttributeSet? = null)

Properties

engine

val engine: ZoomEngine

surface

A Surface that can be consumed by some buffer provider. This will be non-null after Callback.onZoomSurfaceCreated and null again after Callback.onZoomSurfaceDestroyed.

var surface: Surface?

surfaceTexture

A SurfaceTexture that can be consumed by some buffer provider. This will be non-null after Callback.onZoomSurfaceCreated and null again after Callback.onZoomSurfaceDestroyed.

var surfaceTexture: SurfaceTexture?

Functions

addCallback

Adds a new Callback to be notified of the surface state. Should be called as soon as possible.

fun addCallback(callback: Callback): Unit

onDetachedFromWindow

open fun onDetachedFromWindow(): Unit

onDraw

Called on the renderer thread when the texture is being drawn. You can, if needed, perform extra transformation by editing the textureTransformMatrix or the modelMatrix using the android.opengl.Matrix utilities.

open fun onDraw(modelMatrix: FloatArray, textureTransformMatrix: FloatArray): Unit

onDrawFrame

Performs the texture and background drawing.

open fun onDrawFrame(gl: GL10): Unit

onMeasure

open fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit

onSurfaceChanged

open fun onSurfaceChanged(gl: GL10, width: Int, height: Int): Unit

onSurfaceCreated

open fun onSurfaceCreated(gl: GL10?, config: EGLConfig?): Unit

onTouchEvent

open fun onTouchEvent(ev: MotionEvent): Boolean

removeCallback

Removes a Callback previously added with addCallback.

fun removeCallback(callback: Callback): Unit

setBackgroundColor

If non transparent, we will draw this background color using GL before drawing the actual texture.

open fun setBackgroundColor(color: Int): Unit

setContentSize

Sets the size of the content. If this is not called, the size will be assumed to be that of the ZoomSurfaceView itself. In this case, make sure to measure ZoomSurfaceView correctly or the texture will be distorted.

fun setContentSize(width: Float, height: Float): Unit