implement decodeFromPixels#21298
Conversation
lib/web_ui/lib/src/ui/painting.dart
Outdated
| _createBmp(pixels, width, height, Endian.big, callback); | ||
| return; | ||
| case PixelFormat.bgra8888: | ||
| _createBmp(pixels, width, height, Endian.little, callback); |
There was a problem hiding this comment.
I don't know enough about this but wouldn't the little-endian version of of rgba8888 be abgr8888? (i.e. not bgra8888) Or is it just a naming issue?
There was a problem hiding this comment.
Ahhh, I think I need this to be working as if we're on Uint16 with the endianness swapped .. in which case, I might as well just do the swapping myself I think.
There was a problem hiding this comment.
I also forgot to handle rowbytes.
|
The web_tests issue is resolved. To fix the PR it needs to push a fresh new commit (or |
|
This is ready for review. |
| Null Function(Codec) callbacker = (Codec codec) { | ||
| codec.getNextFrame().then((FrameInfo frameInfo) { | ||
| callback(frameInfo.image); | ||
| }); |
There was a problem hiding this comment.
The signature says it returns Null but the body of the function looks like it's void.
|
This pull request is not suitable for automatic merging in its current state.
|
Description
Current implementation doesn't work and throws.
This implementation creates a BMP image from the pixel data and instantiates that.
Related Issues
Fixes flutter/flutter#49244
Tests
I added the following tests:
decodeImageFromPixels with both supported pixelformats.
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.