renderToTexture
Renders the given frame to a Skia Image and returns it.
The frame is wrapped as a GPU texture without any copy (through its NativeBuffer), and onDraw draws it (and anything else) into an offscreen GPU canvas the size of the upright frame, transformed to cancel the frame's Frame.orientation and Frame.isMirrored: drawing the texture at (0, 0) draws it upright.
val image = renderToTexture(frame) { (frameTexture, canvas) ->
canvas.drawImage(frameTexture, 0f, 0f)
}Content copied to clipboard
The returned image is a GPU image of the calling thread's GPU context: use it on this thread, or copy it to the CPU with makeNonTextureImage (on this thread) to use it anywhere. Close it when you are done with it.
Parameters
frame
The Frame to render. It will be converted to a texture. It must have a native buffer (see Frame.hasNativeBuffer).
onDraw
A provided draw function to perform the rendering.