package android.graphics class SurfaceTexture(val texture: Int) { fun interface OnFrameAvailableListener {fun onFrameAvailable(surface: SurfaceTexture)} var released=false;var updates=0;var throwUpdate=false var width=0;var height=0 private var listener: OnFrameAvailableListener?=null;private var handler: android.os.Handler?=null init {check(texture in android.opengl.GLES20.liveTextures)} fun setDefaultBufferSize(w: Int,h: Int) {width=w;height=h} fun setOnFrameAvailableListener(l: OnFrameAvailableListener?,h: android.os.Handler?=null) {listener=l;handler=h} fun frame() {val cb=listener ?: return;handler!!.post {cb.onFrameAvailable(this)}} fun updateTexImage() {check(!released);if(throwUpdate) error("synthetic_update_failure");updates++} fun release() {check(!released);released=true} } object ImageFormat {const val YUV_420_888=35} class Matrix {fun postRotate(f: Float) {}} class Rect(val left: Int,val top: Int,val right: Int,val bottom: Int) {fun width()=right-left;fun height()=bottom-top} class Bitmap(val width: Int,val height: Int) { enum class Config {ARGB_8888} fun recycle() {} companion object { fun createBitmap(p: IntArray,w: Int,h: Int,c: Config)=Bitmap(w,h) fun createBitmap(b: Bitmap,x: Int,y: Int,w: Int,h: Int,m: Matrix,f: Boolean)=Bitmap(w,h) } }