Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flock][Feature] - Mutate bitmap data directly from Dart #39

Open
matthew-carroll opened this issue Jan 13, 2025 · 5 comments
Open

[Flock][Feature] - Mutate bitmap data directly from Dart #39

matthew-carroll opened this issue Jan 13, 2025 · 5 comments
Labels
feature flock Relates to the Flock, a fork of Flutter

Comments

@matthew-carroll
Copy link
Contributor

Flutter Issue Ticket Link:
flutter/flutter#37180

Why didn't Flutter implement this?
The team said combinations of "it's hard", "it's ambiguous", "it's impossible".

Why does this belong in Flock?
The goal requires adding or altering the boundary between the framework and the engine, which can't be done in a package.

Describe the solution you'd like
I don't have strong opinions about APIs, or even which problem is solved. There are at least a couple places that a solution could be formulated:

  • Make it possible to change pixels on an Image object (or create a MutableImage). Currently, one has to copy the pixels from the engine into Dart, modify the pixels, then send the pixels back to the engine.
  • Introduce a canvas method for drawing pixels.

Additional context
This limitation was the most impactful blocker when working on flutter_processing in terms of being able to alter bitmap data in real time. Many Processing APIs are bitmap-centric. You set individual pixel values. This makes it possible for visual effects where the next frame is applied to the previous frame.

These effects can generally be accomplished with shaders. However, shaders require knowledge of a shader language, and involve a completely separate development and integration pathway. It would be nice if Flutter developers could leverage their Dart and Flutter abilities to at least create proofs of concept before worrying about shader languages.

Flutter Processing: https://github.com/matthew-carroll/flutter_processing

@matthew-carroll matthew-carroll added flock Relates to the Flock, a fork of Flutter feature labels Jan 13, 2025
@jezell
Copy link
Collaborator

jezell commented Jan 13, 2025

This is kind of why the Texture stuff is there, but as pointed out in the issue, the challenge with Texture is that the assumption (at the moment) is that you are always mutating the texture from native code, and there aren't hooks for interacting with the textures directly. Maybe some higher level texture support? I've requested it multiple times, starting with just basic support for Texture on web:

flutter/flutter#119649

@jezell
Copy link
Collaborator

jezell commented Jan 13, 2025

Also related, though maybe not directly, support for video textures is really something that would be nice out of the box:

flutter/flutter#150592

Same type of challenge, that you need better hooks to have any chance of it performing well.

@matthew-carroll
Copy link
Contributor Author

@jezell can you file a ticket for the video texture, along with a motivating use-case, and ideally provide any breadcrumbs for a contributor to start looking in the right parts of the engine?

@jezell
Copy link
Collaborator

jezell commented Jan 14, 2025

@matthew-carroll sure

@jezell
Copy link
Collaborator

jezell commented Jan 14, 2025

#45 and #46 added which could be related to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature flock Relates to the Flock, a fork of Flutter
Projects
None yet
Development

No branches or pull requests

2 participants