Skip to content

[Feature Request / Improvement Request ] Faster way of converting a Picture to an Image #90542

@Yusuf-Uluc

Description

@Yusuf-Uluc

Use case

I started creating an app for writing down notes on your tablet using a pen. For this, I used a CustomPaint (with canvas.drawLine()) in combination with a GestureDetector. After some Lines, the app gets extreme frame drops and is unusable, so I converted the lines into images every few hundred offsets.
Here some of the relevant code:

ui.PictureRecorder recorder = ui.PictureRecorder();
// some code inbetween...
ui.Picture picture = recorder.endRecording();
ui.Image newImage = await picture.toImage(
         ....
      );

Now the problem with this method is that I am getting a really strong frame drop every time toImage() gets called.

Recording of the issue in Release Mode:

Peek 2021-09-22 21-12

Proposal

In the Flutter docs, there is mentioned that 'This is a slow operation that is performed on a background thread.'.
But I wanted to request a faster and more efficient way of converting a Picture to an Image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: imagesLoading, displaying, rendering imagesc: proposalA detailed proposal for a change to Flutterdependency: dartDart team may need to help usengineflutter/engine related. 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