-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
I'm looking into rendering Flutter canvas graphics onto an Android surface from another plugin.
Currently I have the following:
Android flutter plugin that obtains an Android Surface.
- option 1: flutter app renders
Canvas, save withPictureRecorder, copy RGBA bytes to plugin, draw toSurface - option 2: flutter app sends messages to plugin to draw on an Android
Canvas, draw toSurface
option 2 is significantly faster - but requires mirroring Canvas methods in the UI with plugin methods,
e.g.
// Draw UI
canvas
.. drawPaint(paint)
.. drawLine(pt1, pt2, paint);
// Render same thing to plugin
plugin
..drawPaint(paint);
..drawLine(pt1, ot2, paint);In our case - we currently only need a subset of Canvas methods, so this isn't too burdensome for now.
Ideally, however, this could look something like this:
// Draw UI
canvas
.. drawPaint(paint)
.. drawLine(pt1, pt2, paint);
// Render same thing to plugin
canvas = new Canvas(new PictureRecorder(plugin.textureId))
..drawPaint(paint);
..drawLine(pt1, pt2, paint);Is there a way to let a PictureRecorder record canvas operations to a texture?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team