-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DrawBitmap support for ICanvas #4094
Comments
Thank you so much for your bug report! Unfortunately, we cannot reproduce your issue with the information above, could you provide a sample project and screenshots or more details that we can reproduce your issue? That should greatly speed up the process, thanks! |
Hi @BharanikhumarSR. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@BharanikhumarSR sorry for the confusion, we now realize this was a feature proposal and not a bug report. You can ignore the comments from the msftbot account - this won't be closed. |
I've run into this problem as well. I'd like to just draw to a bitmap and then draw the bitmap to the canvas, but can't figure out how to do it without platform code. I'm looking at IImage or IPicture instead. I don't need to read from file, I just need this buffer to exist in memory to save on canvas draw operations. One other way I've thought of doing it is with parallel linq, but the canvas really doesn't want to be accessed like this. Next step i guess is to clone the canvas for the draw operations, but this is rabbit-hole-ing rather quickly. The end goal here is to take an array of pixels and blit them to the canvas, but just stumbling my way there. DrawImage() looks like what I want, but not sure how to get that IImage.... here's my sample: https://github.com/SheepReaper/ParallelDrawOnCanvas This was inspired by my wanting to do a fully MAUI non-skia version of this: https://swharden.com/blog/2021-09-10-maui-graphics/ So my paths right now, if anyone knows how:
|
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Description
In terms of drawing using ICanvas I feel features are bit limited on MAUI. Drawing on bitmap would be lot easier to save the UI and reuse object whenever needed.
For example, here is a case where I have tried to render circle based on the touch points interacted and for this I need to store every points and render again for each interaction. This results in performance issues on higher point counts. So I have overcame this issue on android native by drawing the points on bitmap parallelly and rendered the existing bitmap to the view on each interaction. So this lets canvas draw the bitmap alone at invalidate. So it would be good to provide feature to draw on the bitmap and draw a bitmap to the view using ICanvas.
Public API Changes
canvas.DrawBitmap(bitmap)
-Renders bitmap to the given canvascanvas.DrawCircle(bitmap)
-Render on the bitmap objectIntended Use-Case
In my app I have a situation where I would add different paths to the canvas. But adding each paths every time at invalidation costs me the performance issue. Drawing on the bitmap and drawing the same bitmap to the view would be lot performance savings
The text was updated successfully, but these errors were encountered: