Sprite.Method.01.RenderPrepare.cs 880 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Drawing;
  2. using System.Drawing.Drawing2D;
  3. namespace Microsoft.Windows.Forms
  4. {
  5. partial class Sprite
  6. {
  7. private Graphics m_Graphics;
  8. private Region m_GraphicsClip;
  9. /// <summary>
  10. /// 开始渲染
  11. /// </summary>
  12. public void BeginRender(Graphics g)
  13. {
  14. this.DisposeReferences();
  15. this.m_Graphics = g;
  16. this.m_GraphicsClip = g.Clip;
  17. //由于此时未对 BackColorRect 赋值.所以不能设置剪切区,在生成 m_CurrentBackColorPathRect 时设置剪切区
  18. }
  19. /// <summary>
  20. /// 结束渲染
  21. /// </summary>
  22. public void EndRender()
  23. {
  24. this.m_Graphics.SetClip(this.m_GraphicsClip, CombineMode.Replace);
  25. this.m_GraphicsClip.Dispose();
  26. this.m_GraphicsClip = null;
  27. }
  28. }
  29. }