-
Notifications
You must be signed in to change notification settings - Fork 20
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
Why canvas? #3
Comments
Had some time to prototype this afternoon. I couldn't find a mime-type that emulated the simple pixel format of Here's a gist of a simple hook-based approach: https://gist.github.com/WorldMaker/a3cbe0059acd827edee568198376b95a (ETA: Tested it with a basic |
@WorldMaker the hook you published was useful. I didn't want to get into flipping between The component is a very thin wrapper over Here's a gist with the |
@ngbrown you should consider opening a PR, the |
@kyle-mccarthy pull request to what? Neither the |
I understand. Since the hook would be limited to react I don’t see a reason to fragment it into another package. It would be an addition to this package.
…On Jun 1, 2020, 9:09 PM -0500, Nathan Brown ***@***.***>, wrote:
@kyle-mccarthy pull request to what? Neither the useBlurhash hook nor the BlurImg component use react-blurhash, what this repository is.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Would this not be a better job for a webworker? |
Why not just wrap the decoded
UInt8ClampedArray
straight into aBlob
of the appropriate bitmap mime-type andURL.createObjectUrl(blob)
(making sure to appropriatelyURL.revokeObjectUrl
on hash change or unmount) to create an image URL for a standardimg
tag (or anywhere an image source can be used such as CSSbackground-url
)? It allows you more style options in CSS over the hash, and it makes it easier to swap in a real URL later when things have "loaded" without changing so many DOM elements in the process.Canvas
seems like overkill for rendering the BlurHash in most scenarios to me, but maybe I'm missing something?Blobs should be supported everywhere that
UInt8ClampedArray
is, so it doesn't seem like a compatibility issue to me.https://caniuse.com/#feat=bloburls
https://caniuse.com/#feat=blobbuilder
The text was updated successfully, but these errors were encountered: