private void EndRedraw(RectDouble canvasBounds, RectFloat maskSourceRect, IBitmap <ColorAlpha8> interiorMask, IBitmap <ColorAlpha8>[] dashedOutlineMasks) { base.VerifyAccess(); if (base.IsDisposed) { DisposableUtil.Free <IBitmap <ColorAlpha8> >(ref interiorMask); DisposableUtil.FreeContents <IBitmap <ColorAlpha8> >(dashedOutlineMasks); } else { this.isRedrawing = false; base.CanvasView.Invalidate(this.renderedCanvasBounds); this.ReturnOrFreeDeviceBitmap(ref this.renderedInteriorDeviceBitmap); this.ReturnOrFreeDeviceBitmaps(this.renderedDashedOutlineDeviceBitmaps); this.renderedDashedOutlineDeviceBitmaps = null; DisposableUtil.Free <IBitmap <ColorAlpha8> >(ref this.renderedInteriorMask); this.renderedInteriorMask = interiorMask; DisposableUtil.FreeContents <IBitmap <ColorAlpha8> >(this.renderedDashedOutlineMasks); this.renderedDashedOutlineMasks = dashedOutlineMasks; this.renderedCanvasBounds = canvasBounds; this.renderedMaskSourceRect = maskSourceRect; this.renderedRenderParams = this.redrawRenderParams; this.redrawRenderParams = null; base.CanvasView.Invalidate(this.renderedCanvasBounds); if (this.isRedrawNeeded) { this.isRedrawNeeded = false; this.QueueBeginRedraw(); } } }
private void BeginRedraw() { base.VerifyAccess(); if ((this.isRedrawing || (base.CanvasView == null)) || (base.CanvasView.RenderTarget == null)) { this.isRedrawNeeded = true; } else { this.isRedrawNeeded = false; this.isRedrawing = true; this.redrawRenderParams = base.Owner.GetRenderParameters(base.CanvasView); if (!this.redrawRenderParams.IsOutlineEnabled && !this.redrawRenderParams.IsInteriorFilled) { this.EndRedraw(RectDouble.Zero, RectFloat.Zero, null, null); } else { WorkItemDispatcher.Default.Enqueue(new Action(this.RedrawOnBackgroundThread), WorkItemQueuePriority.High); } } }
private void RenderSelection(IDrawingContext dc, float scale, PointFloat offset, SelectionRenderParameters renderParams, Result <IGeometry> lazyGeometry, IBrush interiorBrush, IBrush outlineBrush, IStrokeStyle outlineStrokeStyle, AntialiasMode antialiasMode) { using (dc.UseScaleTransform(scale, scale, MatrixMultiplyOrder.Prepend)) { using (dc.UseTranslateTransform(offset.X, offset.Y, MatrixMultiplyOrder.Prepend)) { if (renderParams.IsInteriorFilled && (interiorBrush != null)) { using (dc.UseAntialiasMode(AntialiasMode.Aliased)) { dc.FillGeometry(lazyGeometry.Value, interiorBrush, null); } } if (renderParams.IsOutlineEnabled && (outlineBrush != null)) { float strokeWidth = this.outlineStrokeWidthPx / scale; using (dc.UseAntialiasMode(antialiasMode)) { using (dc.UseTranslateTransform(0.5f, 0.5f, MatrixMultiplyOrder.Append)) { dc.DrawGeometry(lazyGeometry.Value, outlineBrush, strokeWidth, outlineStrokeStyle); } } } } } }