Peter Tran
10/15/2024, 2:56 PMPeter Tran
10/15/2024, 2:58 PMDrawScope
draw calls.
In Android I can do this:
val androidSurface: android.view.Surface = getHWSurfaceFromSomewher()
val androidCanvas = surface.lockHardwareCanvas()
val canvas = Canvas(androidCanvas)
CanvasDrawScope().draw(
canvas = canvas
) {
//DrawScope draw calls
}
surface.unlockCanvasAndPost(androidCanvas)
// drawing has been rendered to texture
Peter Tran
10/15/2024, 3:00 PMval tex = device!!.newTextureWithDescriptor(texDescriptor)
//what is this???
val texturePtr
val renderTarget = BackendRenderTarget.makeMetal(width, height, texturePtr)
val skiaSurface = Surface.makeFromBackendRenderTarget(rt = renderTarget)
val composeCanvas = skiaSurface?.canvas?.asComposeCanvas()
But I do not know what to pass in for texturePtr
to BackendRenderTarget.makeMetal
.Peter Tran
10/15/2024, 3:07 PMCanvas(bitmap)
, and then copy the pixels to a texture. But the extra copy seems less than ideal vs letting the skia backend draw directly to the texture.
Thoughts?