Reputation: 20354
WPF has a RotateTransform
class that can be applied to a DrawingContext
. Any drawing operations performed with this transform in place will be rotated accordingly. I can call the RotateTransform.Transform
method to explicitly rotate a single point in code. I use this transformation to freely rotate some diagram graphics.
Now, for proper mouse hit testing of the effective points, I need to reverse-rotate a given point with this RotateTransform
instance. It doesn't seem to offer that though. How can this be done?
I'm looking for something like this TransformBack
method, much like IValueConverter
has a Convert
and ConvertBack
method:
var rotate = new RotateTransform(angle, centerX, centerY);
Point virtualPoint = new Point(100, 200);
Point realPoint = rotate.TransformBack(virtualPoint); // Doesn't exist
Upvotes: 0
Views: 44