8000 Add `Picture.toImageSync` that returns `Image` · Issue #77289 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add Picture.toImageSync that returns Image #77289
Closed
flutter/engine
#33736
@yjbanov

Description

@yjbanov

Currently Flutter has Picture.toImage returning Future<Image> (api docs). The API docs say "Although the image is returned synchronously, the picture is actually rasterized the first time the image is drawn and then cached". This makes me think that wrapping the result in a Future is redundant. Can we have a Picture.toImageSync that returns the image truly synchronously?

The use-case is procedurally generated atlasses that can be rendered using Canvas.drawAtlas. For example, to render particle effects, such as those generated by https://felixblaschke.github.io/liquid-studio, it is more efficient to use an atlas rather than many drawCircles with blurring mask filter. However, to generate the atlas one needs to call Picture.toImage and miss at least one frame. Picture.toImageSync would allow us to generate an atlas synchronously (and cheaply, since the atlas contains just one particle) and in the same frame render thousands of particles using drawAtlas.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: new featureNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)c: proposalA detailed proposal for a change to Fluttere: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine repository. See also e: labels.perf: speedPerformance issues related to (mostly rendering) speed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0