WPF Window -> SkiaGrid Coordinate Conversion Logic Problem
Howdy folk!
I'm working on a WPF project that for a graphical editor using Skia/SKSurface/SKCanvas.
In this application I am tracking the coordinates of where the mouse is, and draw a rectangle (as a cursor) on the grid overtop of the existing image.
The issue: I cannot get my coordinate systems to line up, and I believe it's a consequence of poor translation or offsets that I can't quite figure out.
Pictured: A debug image (ignore the terrible color scheme and the fact that I don't know why the elements aren't filling), where my cursor (not pictured) is actually placed on the gray square, but the yellow cursor square (left and up) of where it should be.
So, before showing any code - I want to ask: Is there a standard way of doing this? I've tried using the .TranslatePoint() calls and Control.PointToScreen/PointFromScreen() methods in order to translate between points of reference, but nothing seems to really work...
Any help is appreciated. Thanks!
1 Reply
Pls use the functions like obj.PointToScreen and PointFromScreen