使用使用System.Drawing.Drawing2D.Matrix.RotateAt(),旋转图像后边缘锯齿严重,图像失真
用代码块功能插入代码,请勿粘贴截图
if (_IsLeftDown)
{
Point[] points = new Point[] { e.Location };
Matrix matrix_Invert = _matrix.Clone();
matrix_Invert.Invert();
matrix_Invert.TransformPoints(points);
switch(_ClickArea)
{
case CLICK_AREA.AREA_IMG:
{
_matrix.Translate((points[0].X - _LastPt.X), (points[0].Y - _LastPt.Y));
// _LastPt = points[0];
}
break;
case CLICK_AREA.AREA_IMG_ROUTE:
{
double corrb = Math.Atan2(_LastPt.Y - _rcImg.Height / 2, _LastPt.X - _rcImg.Width / 2);
double corre = Math.Atan2(points[0].Y - _rcImg.Height / 2, points[0].X - _rcImg.Width / 2);
_matrix.RotateAt((float)((corre -corrb) *180.0f/Math.PI), new Point(_rcImg.Width / 2, _rcImg.Height / 2));
DRoute += (Double)((corre - corrb) * 180.0f / Math.PI);
Console.WriteLine(DRoute);
}
break;
case CLICK_AREA.AREA_IMG_SCALING:
{
}
break;
default:
break;
}
Refresh();
}
}