0
我有20幀每秒。我在每一幀畫出一些線條,我得到的線條沒有問題,但經常會出現背景圖像的問題。隨機我得到10幀相同的圖像,但線條看起來不錯。Drawing.Line位圖與圖像LockBits
if (cizik == null)
{
BitmapData imageData = CloneOrj2.LockBits(new Rectangle(0, 0, CloneOrj2.Width, CloneOrj2.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
UnmanagedImage tmp = new UnmanagedImage(imageData);
cizik = UnmanagedImage.Create(CloneOrj2.Width, CloneOrj2.Height, PixelFormat.Format24bppRgb);
tmp.Copy(cizik);
Drawing.Line(cizik, new IntPoint(XX, XX), new IntPoint(XX, XX), System.Drawing.Color.Yellow);
}
else
{
BitmapData imageData = CloneOrj2.LockBits(new Rectangle(0, 0, CloneOrj2.Width, CloneOrj2.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
UnmanagedImage tmp = new UnmanagedImage(imageData);
Drawing.Line(tmp, new IntPoint(XX, XX), new IntPoint(XX, XX), System.Drawing.Color.Yellow);
cizik = UnmanagedImage.Create(CloneOrj2.Width, CloneOrj2.Height, PixelFormat.Format24bppRgb);
tmp.Copy(cizik);
}
DrawScreenActual.Image = (System.Drawing.Image)cizik.ToManagedImage().Clone();
感謝您的幫助!