问题描述
我需要以用户指定的角度绘制图像->为此应用平移变换,然后进行旋转变换
using (Graphics d = Graphics.FromImage(img))
{
{
d.TranslateTransform(img.Width / 2,img.Height / 2);
d.RotateTransform(anglec);
int k = (int)-(bmp.Width / 2);
int p = (int)-(bmp.Height / 2);
Rectangle destRect = new Rectangle(k,p,bmp.Width,bmp.Height);
Rectangle s = new Rectangle(new Point(0,0),new Size(img.Width,img.Height));
if (!s.Contains(destRect))
{
}
d.DrawImage(bmp,destRect,bmp.Height,GraphicsUnit.Pixel);
}
有时旋转的图像末端似乎从主图像中掉了。要检查是否发生这种情况,我试图使用Contains
方法来查找矩形是否包含在主图像中。总是错误的。我认为转换在这里正在做某事。有人可以请教。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)