-
Notifications
You must be signed in to change notification settings - Fork 540
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
Interaction with shapes #2330
Comments
Skia is a rendering library, what you are asking for is completely out of scope. |
Yes, I understand that, I just wanted to find out what ways there are in general, I could create a mathematical model of each figure I draw and count its collision, or I could add its own canvas to each drawn figure and draw it there again and get a pixel at the right coordinates (if there is such a function in skia at all), then I will get thousands of canvases, or tens of thousands, and maybe it won't even work too slowly, I could also create a polygon around pixels, for this I also need to somehow get a drawn shape separately from the general canvas, is this possible in skia? But it still seems to me that there should be an easier way, if skia returned at least some information about the shape that it just rendered, it would be easier, I think |
you could draw the shapes to a new surface (not rendered to the screen), pass a unique color for each shape, then call |
this is just speculation at the moment but representing the UI as a DOM-like tree of System.Drawing.Drawing2D or equivalent for .Net Core objects then mapping the DOM-like tree to skia drawing methods should be one approach Then on pointer events use Rectangle.Contains For prioritizing elements of top of others, the DOM-like tree need z-index @VeyDlin issue should be closed and instead a discussion thread in discussions as it's outside skia codebase |
You can try https://github.com/wieslawsoltes/Draw2D |
Hi @wieslawsoltes! I opened your library and it seems the github pages deployment has failed. |
I'm trying to determine which shapes are located by coordinates (mouse click).
I realized that skia does not provide such an API and I need to implement it myself, but I have no ideas on this.
Everything is complicated by the fact that I need to understand exactly that the click occurred on the figure, and not its square hitbox, for example, I can click inside the text with the number "0" and this should not be considered a hit, there are also rectangles with rounded edges, complex curves, different shapes, and there are thousands of them on the canvas
I will be grateful for any advice because right now I don't even know how to Google for a solution to my problem
The text was updated successfully, but these errors were encountered: