Example(s) of how to use DrawImage
jackpotdk opened this issue · 2 comments
I am looking for a way to draw images on Canvas without having to do JS Interop, but I don't see any way currently. Can this be done more elegantly currently?
Hello @jackpotdk,
I don't have an example for you but instead I can provide a workaround until some pull requests getting merged into the master. If you still want to use this library you should consider to split your canvas.
For example you do have a background that isn't updated as often as the foreground. In that case you can create a second canvas and fill the background image as css styling. By this way you can avoid javascript.
<canvas id="bgCanvas" Width="1" Height="1" class="backgroundCanvas" style="@_backgroundCanvasStyle" />
<BECanvas @ref="_canvasReference" Width="1" Height="1" />
If you want to draw on the foreground the only way is to use the function DrawImageAsync()
.
Thanks, I will try this method and see if it will work. Well let you know.