/// <summary> /// BMPキャッシュ機能を追加したレイヤー描画 /// </summary> /// <param name="pane"></param> /// <param name="layerid"></param> /// <param name="pts"></param> protected override void drawLayer(IRichPane pane, int layerid, IEnumerable <PartsBase> pts) { if (_enabledLayers.ContainsKey(layerid)) { if (bmps.ContainKeys(pane, layerid) == false) { var pr = MotherPane.GetPaneRect(); bmps[pane, layerid] = new Bitmap(pr.Width, pr.Height); } var bmp = bmps[pane, layerid]; if (EnableShot == false) { var rp = RichPaneCustomGraphicsBinder.CreateCopy(MotherPane, Graphics.FromImage(bmp)); rp.SetParent(MotherPane); rp.Graphics.Clear(Color.Transparent); base.drawLayer(rp, layerid, pts); var sr = pane.GetPaneRect(); MotherPane.Graphics.DrawImageUnscaledAndClipped(bmp, sr); panebak[pane, layerid] = rp; } else { var sr = pane.GetPaneRect(); var rpbak = panebak[pane, layerid]; // pane.Graphics.SetClip(sr); sr += ScreenPos.FromInt(pane.Scroll.X - rpbak.Scroll.X, pane.Scroll.Y - rpbak.Scroll.Y); MotherPane.Graphics.DrawImageUnscaledAndClipped(bmp, sr); } } else { base.drawLayer(pane, layerid, pts); } }
/// <summary> /// Graphicsを指定したインスタンスを構築 /// </summary> /// <param name="value"></param> /// <param name="g"></param> /// <returns></returns> public static RichPaneCustomGraphicsBinder CreateCopy(IRichPane value, Graphics g) { var ret = new RichPaneCustomGraphicsBinder { _parent = null, _zoom = value.Zoom, _scroll = value.Scroll, _idtext = value.IdText, _graphics = g }; return(ret); }