public override void RenderImage(RenderTarget target, bool forciblyCentered = false) { BackgroundMode bgMode = (target == RenderTarget.Printer) ? BackgroundMode.bmImage : BackgroundMode.bmAny; ChartDrawMode drawMode = (!forciblyCentered) ? ChartDrawMode.dmStatic : ChartDrawMode.dmStaticCentered; InternalDraw(drawMode, bgMode); }
private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background) { // drawing relative offset of tree on graphics int spx = 0; int spy = 0; Size clientSize = ClientSize; ExtPoint scrollPos = new ExtPoint(Math.Abs(AutoScrollPosition.X), Math.Abs(AutoScrollPosition.Y)); if (drawMode == ChartDrawMode.dmInteractive) { spx += -scrollPos.X; spy += -scrollPos.Y; Rectangle viewPort = GetImageViewPort(); fModel.VisibleArea = ExtRect.CreateBounds(scrollPos.X, scrollPos.Y, viewPort.Width, viewPort.Height); } else { fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight); } if (drawMode == ChartDrawMode.dmInteractive || drawMode == ChartDrawMode.dmStaticCentered) { if (fModel.ImageWidth < clientSize.Width) { spx += (clientSize.Width - fModel.ImageWidth) / 2; } if (fModel.ImageHeight < clientSize.Height) { spy += (clientSize.Height - fModel.ImageHeight) / 2; } } fModel.SetOffsets(spx, spy); DrawBackground(background); #if DEBUG_IMAGE using (Pen pen = new Pen(Color.Red)) { fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight); } #endif bool hasDeep = (fSelected != null && fSelected != fModel.Root && fSelected.Rec != null); if (hasDeep && fOptions.DeepMode == DeepMode.Background) { DrawDeep(fOptions.DeepMode, spx, spy); } fRenderer.SetTranslucent(0.0f); fModel.Draw(drawMode); if (hasDeep && fOptions.DeepMode == DeepMode.Foreground) { DrawDeep(fOptions.DeepMode, spx, spy); } }
private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background) { // drawing relative offset of tree on graphics int spx = 0; int spy = 0; if (drawMode == ChartDrawMode.dmInteractive) { var imageViewport = base.ImageViewport; spx = imageViewport.Left; spy = imageViewport.Top; fModel.VisibleArea = UIHelper.Rt2Rt(base.Viewport); } else { if (drawMode == ChartDrawMode.dmStaticCentered) { Size clientSize = CanvasRectangle.Size; if (fModel.ImageWidth < clientSize.Width) { spx += (clientSize.Width - fModel.ImageWidth) / 2; } if (fModel.ImageHeight < clientSize.Height) { spy += (clientSize.Height - fModel.ImageHeight) / 2; } } fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight); } fModel.SetOffsets(spx, spy); DrawBackground(background); #if DEBUG_IMAGE using (Pen pen = new Pen(Color.Red)) { fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight); } #endif bool hasDeep = (fSelected != null && fSelected != fModel.Root && fSelected.Rec != null); if (hasDeep && fOptions.DeepMode == DeepMode.Background) { DrawDeep(fOptions.DeepMode, spx, spy); } fRenderer.SetTranslucent(0.0f); fModel.Draw(drawMode); if (hasDeep && fOptions.DeepMode == DeepMode.Foreground) { DrawDeep(fOptions.DeepMode, spx, spy); } }
private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background) { // drawing relative offset of tree on graphics int spx = 0; int spy = 0; if (drawMode == ChartDrawMode.dmInteractive) { /*Rectangle viewPort = GetImageViewPort(); * fSPX = -viewPort.Left; * fSPY = -viewPort.Top;*/ spx += fBorderWidth - -AutoScrollPosition.X; spy += fBorderWidth - -AutoScrollPosition.Y; Size sz = ClientSize; if (fModel.ImageWidth < sz.Width) { spx += (sz.Width - fModel.ImageWidth) / 2; } if (fModel.ImageHeight < sz.Height) { spy += (sz.Height - fModel.ImageHeight) / 2; } fModel.VisibleArea = GetSourceImageRegion(); } else { if (drawMode == ChartDrawMode.dmStaticCentered) { Size sz = ClientSize; if (fModel.ImageWidth < sz.Width) { spx += (sz.Width - fModel.ImageWidth) / 2; } if (fModel.ImageHeight < sz.Height) { spy += (sz.Height - fModel.ImageHeight) / 2; } } fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight); } fModel.SetOffsets(spx, spy); DrawBackground(background); #if DEBUG_IMAGE using (Pen pen = new Pen(Color.Red)) { fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight); } #endif fModel.Draw(fModel.Root, fModel.Kind, drawMode); }
public void RenderStatic(BackgroundMode background, bool centered = false) { ChartDrawMode drawMode = (!centered) ? ChartDrawMode.dmStatic : ChartDrawMode.dmStaticCentered; InternalDraw(drawMode, background); }