I have TPathData arrow and draw directly on Canvas. How to rotate TPathData? I know about rotating Tpath but I draw directly on Canvas (lines and arrows). I tried to rotate Tpath and the get Data string - but it is the same as before.
Instead of rotating the TPathData, why not set the TCanvas matrix before drawing the path? This is probably more efficient because the GPU takes care of the rotation, and also more numerically stable since you won't lose any precision in your path data points if you're rotating many times.
msave := Image1.Bitmap.Canvas.Matrix;
Image1.Bitmap.Canvas.SetMatrix(TMatrix.CreateRotation(DegToRad(90)));
Image1.Bitmap.Canvas.DrawPath(PathData, 1);
Image1.Bitmap.Canvas.SetMatrix(msave); // Restore canvas matrix
You have to create a rotation matrix and then apply it.
M := TMatrix.CreateRotation(DegToRad(90));
PathData.ApplyMatrix(M);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With