0
我繪製從PNG圖像的中心的線到頂部在下面的代碼旋轉:繪製線以一定的角度超過位圖
private string ProcessImage(string fileIn)
{
var sourceImage = System.Drawing.Image.FromFile(fileIn);
var fileName = Path.GetFileName(fileIn);
var finalPath = Server.MapPath(@"~/Output/" + fileName);
int x = sourceImage.Width/2;
int y = sourceImage.Height/2;
using (var g = Graphics.FromImage(sourceImage))
{
g.DrawLine(new Pen(Color.Black, (float)5), new Point(x, 0), new Point(x, y));
}
sourceImage.Save(finalPath);
return @"~/Output/" + fileName;
}
這工作正常,我有一條線,是90度的圖像的中心。 現在我需要的不是90度垂直線,我想接受用戶輸入的程度。如果用戶輸入45度,則應該從png圖像中心以45度畫線。
請引導我在正確的方向。
謝謝