fluttercommunity / flutter_blurhash

Compact representation of a placeholder for an image. Encode a blurry image under 30 caracters for instant display like used by Medium. Maintainer: @Solido
https://pub.dev/packages/flutter_blurhash
MIT License
523 stars 66 forks source link

Workaround for Flutter issue #19

Closed deakjahn closed 4 years ago

deakjahn commented 4 years ago

Temporary workaround for https://github.com/flutter/flutter/issues/45190

On the web, there are various issues with Skia async functions no returning. As I mentioned in that thread, I suspect the HtmlCodec to be at fault. Until such time as this is fixed, I present the following workaround: on Flutter Web, we can create a BMP image on the fly. Considering the small size of the blurhash image, there is really no need for the compression that PNG or JPG could provide, so this is the cheapest temporary solution.

Solido commented 4 years ago

Oh I see the point. BMP are raw encoding.

deakjahn commented 4 years ago

Yes, you do the same in the normal branch, anyway, ui.PixelFormat.rgba8888. So, it's not that big of a difference. Just a header in front. Still, it should work normally...

Solido commented 4 years ago

When first writing the code I was looking for this but wasn't aware of this encoding. Thx.