Replies: 3 comments
-
|
Wow, after a bit of research I discovered something I wasn't aware of: I have no idea about how efficient it is, bit at least it drastically reduce boilerplate ! What do you think of using that rust API, since there is no "right way" to implement it yet ? |
Beta Was this translation helpful? Give feedback.
-
|
@rambip I support this idea. ;) |
Beta Was this translation helpful? Give feedback.
-
|
Not to be harsh, but this isn't something Yew should provide. Yew's scope is creating and arranging the DOM tree in Rust, not allowing you to software render a canvas. If you're trying to draw onto the canvas, you're better off using an actual graphics API that can latch onto a canvas as a surface. For example, see wgpu. I have a full WASM example here. If you truly want a software rendered example, you'll definitely need to mimic the behavior in JavaScript (make your own crate) or find another crate which does this for you; Yew is not the ticket. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It is really a pain to do anything with the canvas in webassembly: I did it multiple time with emscripten, js and rust, but there is no way to do it easily.
The seed project seems to be working on it:
seed-rs/seed#283
What I would like is just a function to display a raw
[u8]pixel buffer on a screen (with the js ImageData), without needing to create a canvas, a context, an ImageData, a UintArray and an arraybuffer !The right way to do it is probably to create a shared memory region, to fill it with webassembly with a
[u8]and then to create an ImageData with it from js. Is there any attempt to create a convenient method without all this boilerplate ?Beta Was this translation helpful? Give feedback.
All reactions