protected override Geometry OnCreateOutlineDrawGeometry(RectDouble bounds, IDictionary <string, object> settingValues) => this.GetFlattenedEllipseGeometry(bounds);
public static RectDouble ConvertCanvasToViewport(RectDouble canvasRect, double scaleRatio, PointDouble viewportCanvasOffset) => ConvertExtentToViewport(ConvertCanvasToExtent(canvasRect, scaleRatio), scaleRatio, viewportCanvasOffset);
protected override Geometry OnCreateGuideGeometry(RectDouble bounds, IDictionary <string, object> settingValues) => unitGeometry;
protected override SegmentedList <PointDouble> CreateShape(SegmentedList <PointDouble> tracePoints) { RectDouble num3; double num6; double num7; PointDouble a = tracePoints[0]; PointDouble b = tracePoints[tracePoints.Count - 1]; SelectionDrawMode mode = base.ToolSettings.Selection.DrawMode.Value; double num4 = base.ToolSettings.Selection.DrawWidth.Value; double num5 = base.ToolSettings.Selection.DrawHeight.Value; MeasurementUnit sourceUnits = base.ToolSettings.Selection.DrawUnits.Value; switch (mode) { case SelectionDrawMode.FixedRatio: case SelectionDrawMode.FixedSize: num6 = Math.Abs(num4); num7 = Math.Abs(num5); break; default: num6 = num4; num7 = num5; break; } switch (mode) { case SelectionDrawMode.Normal: if ((base.ModifierKeys & Keys.Shift) == Keys.None) { num3 = RectDoubleUtil.FromPixelPoints(a, b); break; } num3 = RectDoubleUtil.FromPixelPointsConstrained(a, b); break; case SelectionDrawMode.FixedRatio: try { double num13 = b.X - a.X; double num14 = b.Y - a.Y; double num15 = num13 / num6; double num16 = Math.Sign(num15); double num17 = num14 / num7; double num18 = Math.Sign(num17); double num19 = num6 / num7; if (num15 < num17) { double x = a.X; double y = a.Y; double right = a.X + num13; double bottom = a.Y + (num18 * Math.Abs((double)(num13 / num19))); num3 = RectDouble.FromEdges(x, y, right, bottom); } else { double left = a.X; double top = a.Y; double num26 = a.X + (num16 * Math.Abs((double)(num14 * num19))); double num27 = a.Y + num14; num3 = RectDouble.FromEdges(left, top, num26, num27); } } catch (ArithmeticException) { num3 = new RectDouble(a.X, a.Y, 0.0, 0.0); } break; case SelectionDrawMode.FixedSize: { double width = Document.ConvertMeasurement(num6, sourceUnits, base.Document.DpuUnit, base.Document.DpuX, MeasurementUnit.Pixel); double height = Document.ConvertMeasurement(num7, sourceUnits, base.Document.DpuUnit, base.Document.DpuY, MeasurementUnit.Pixel); num3 = new RectDouble(b.X, b.Y, width, height); break; } default: throw ExceptionUtil.InvalidEnumArgumentException <SelectionDrawMode>(mode, "drawMode"); } RectDouble num8 = RectDouble.Intersect(num3, base.Document.Bounds()); RectDouble num10 = num8.Int32Bound; if (num8.HasPositiveArea) { SegmentedList <PointDouble> list = new SegmentedList <PointDouble>(5, 7) { new PointDouble(num10.Left, num10.Top), new PointDouble(num10.Right, num10.Top), new PointDouble(num10.Right, num10.Bottom), new PointDouble(num10.Left, num10.Bottom) }; list.Add(list[0]); return(list); } return(new SegmentedList <PointDouble>(0, 7)); }
public static RectDouble ConvertViewportToExtent(RectDouble viewportRect, double scaleRatio, PointDouble viewportCanvasOffset) => new RectDouble(ConvertViewportToExtent(viewportRect.Location, scaleRatio, viewportCanvasOffset), viewportRect.Size);
public void ProcessMouseWheel(Control sender, MouseEventArgs e) { double num11; double num12; double num13; RectDouble visibleCanvasViewportBounds = this.canvasView.GetVisibleCanvasViewportBounds(); PointInt32 point = base.PointToClient(sender.PointToScreen(e.Location)).ToPointInt32(); PointDouble viewportPt = RectDoubleUtil.Clamp(visibleCanvasViewportBounds, point); PointDouble extentPt = this.canvasView.ConvertViewportToExtent(viewportPt); PointDouble num5 = this.canvasView.ConvertExtentToCanvas(extentPt); double scaleRatio = this.canvasView.ScaleRatio; PointDouble viewportCanvasOffset = this.canvasView.ViewportCanvasOffset; double num8 = ((double)e.Delta) / scaleRatio; double x = viewportCanvasOffset.X; double y = viewportCanvasOffset.Y; ScaleBasis scaleBasis = this.canvasView.ScaleBasis; ScaleBasis ratio = ScaleBasis.Ratio; if (Control.ModifierKeys == Keys.Shift) { num11 = x - num8; num12 = y; ratio = scaleBasis; num13 = scaleRatio; } else if (Control.ModifierKeys == Keys.Control) { double num16; double num14 = ((double)e.Delta) / 120.0; double num15 = Math.Pow(1.12, Math.Abs(num14)); if (e.Delta > 0) { num16 = scaleRatio * num15; } else { num16 = scaleRatio / num15; } double num17 = this.canvasView.ClampScaleRatio(num16); double num18 = Math.Round(num17, MidpointRounding.AwayFromZero); if ((Math.Abs((double)(num18 - num17)) < (num18 * 0.1)) && (Math.Abs((double)(num18 - num17)) < Math.Abs((double)(num18 - scaleRatio)))) { num13 = num18; } else { num13 = num17; } ratio = ScaleBasis.Ratio; num11 = num5.X - (viewportPt.X / num13); num12 = num5.Y - (viewportPt.Y / num13); } else if (Control.ModifierKeys == Keys.None) { num11 = x; num12 = y - num8; ratio = scaleBasis; num13 = scaleRatio; } else { num11 = x; num12 = y; ratio = scaleBasis; num13 = scaleRatio; } this.canvasView.ViewportCanvasOffset = new PointDouble(num11, num12); this.canvasView.ScaleBasis = ratio; this.canvasView.ScaleRatio = num13; }
protected override void OnRender(IDrawingContext dc, RectFloat clipRect, CanvasView canvasView) { double canvasHairWidth = canvasView.CanvasHairWidth; if (this.handleDiameter > 2.0) { double rotationAngle = this.handleTransform.GetRotationAngle(); PointDouble location = this.handleTransform.Transform(this.handleLocation) + ((PointDouble)(this.handleLocationScreenOffset * canvasHairWidth)); VectorDouble[] vecs = new VectorDouble[] { new VectorDouble(-1.0, -1.0), new VectorDouble(1.0, -1.0), new VectorDouble(1.0, 1.0), new VectorDouble(-1.0, 1.0), new VectorDouble(-1.0, 0.0), new VectorDouble(1.0, 0.0), new VectorDouble(0.0, -1.0), new VectorDouble(0.0, 1.0) }; vecs.RotateInPlace(rotationAngle); vecs.NormalizeInPlace(); double num5 = ((double)this.handleAlpha) / 255.0; this.whiteBrush.Opacity = num5; this.blackBrush.Opacity = num5; if (this.handleShape != MoveHandleShape.Circle) { PointDouble[] numArray2 = new PointDouble[] { location + (vecs[0] * (this.handleDiameter * canvasHairWidth)), location + (vecs[1] * (this.handleDiameter * canvasHairWidth)), location + (vecs[2] * (this.handleDiameter * canvasHairWidth)), location + (vecs[3] * (this.handleDiameter * canvasHairWidth)) }; PointDouble[] numArray3 = new PointDouble[] { location + (vecs[0] * ((this.handleDiameter - 1.0) * canvasHairWidth)), location + (vecs[1] * ((this.handleDiameter - 1.0) * canvasHairWidth)), location + (vecs[2] * ((this.handleDiameter - 1.0) * canvasHairWidth)), location + (vecs[3] * ((this.handleDiameter - 1.0) * canvasHairWidth)) }; PointDouble[] numArray4 = new PointDouble[] { location + (vecs[0] * ((this.handleDiameter - 2.0) * canvasHairWidth)), location + (vecs[1] * ((this.handleDiameter - 2.0) * canvasHairWidth)), location + (vecs[2] * ((this.handleDiameter - 2.0) * canvasHairWidth)), location + (vecs[3] * ((this.handleDiameter - 2.0) * canvasHairWidth)) }; dc.DrawLine(numArray2[0], numArray2[1], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray2[1], numArray2[2], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray2[2], numArray2[3], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray2[3], numArray2[0], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray3[0], numArray3[1], this.blackBrush, canvasHairWidth); dc.DrawLine(numArray3[1], numArray3[2], this.blackBrush, canvasHairWidth); dc.DrawLine(numArray3[2], numArray3[3], this.blackBrush, canvasHairWidth); dc.DrawLine(numArray3[3], numArray3[0], this.blackBrush, canvasHairWidth); dc.DrawLine(numArray4[0], numArray4[1], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray4[1], numArray4[2], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray4[2], numArray4[3], this.whiteBrush, canvasHairWidth); dc.DrawLine(numArray4[3], numArray4[0], this.whiteBrush, canvasHairWidth); } else if (this.handleShape == MoveHandleShape.Circle) { RectDouble rect = new RectDouble(location, SizeDouble.Zero); rect.Inflate((double)((this.handleDiameter - 1.0) * canvasHairWidth), (double)((this.handleDiameter - 1.0) * canvasHairWidth)); dc.DrawEllipse(EllipseDouble.FromRect(rect), this.whiteBrush, canvasHairWidth); rect.Inflate(-canvasHairWidth, -canvasHairWidth); dc.DrawEllipse(EllipseDouble.FromRect(rect), this.blackBrush, canvasHairWidth); rect.Inflate(-canvasHairWidth, -canvasHairWidth); dc.DrawEllipse(EllipseDouble.FromRect(rect), this.whiteBrush, canvasHairWidth); } if (this.handleShape == MoveHandleShape.Compass) { PointDouble num7 = location + ((PointDouble)(vecs[0] * ((this.handleDiameter - 1.0) * canvasHairWidth))); PointDouble point = location + ((PointDouble)(vecs[1] * ((this.handleDiameter - 1.0) * canvasHairWidth))); PointDouble num9 = location + ((PointDouble)(vecs[2] * ((this.handleDiameter - 1.0) * canvasHairWidth))); PointDouble num10 = location + ((PointDouble)(vecs[3] * ((this.handleDiameter - 1.0) * canvasHairWidth))); PointDouble num11 = new PointDouble(num7.X, (num7.Y + num10.Y) / 2.0); PointDouble num12 = new PointDouble((num7.X + point.X) / 2.0, num7.Y); PointDouble num13 = new PointDouble(point.X, (point.Y + num9.Y) / 2.0); PointDouble num14 = new PointDouble((num10.X + num9.X) / 2.0, num9.Y); PointDouble num15 = new PointDouble(num12.X, num11.Y); PathGeometry geometry = new PathGeometry(); PathFigure item = new PathFigure { IsClosed = true, IsFilled = true, StartPoint = num7 }; item.Segments.Add(new LineSegment(point)); item.Segments.Add(new LineSegment(num9)); item.Segments.Add(new LineSegment(num10)); geometry.Figures.Add(item); dc.FillGeometry(geometry, this.whiteBrush, null); PathGeometry geometry2 = new PathGeometry(); double num16 = canvasHairWidth; double num17 = 1.35 * canvasHairWidth; double num18 = (num17 * 3.0) / 2.0; double num19 = num16 / 2.0; double num20 = (num17 * Math.Sqrt(27.0)) / 2.0; PathFigure figure2 = new PathFigure { IsFilled = true, IsClosed = true, StartPoint = num11 }; figure2.Segments.Add(new LineSegment(new PointDouble(num11.X + num20, num11.Y + num18))); figure2.Segments.Add(new LineSegment(new PointDouble(num11.X + num20, num11.Y + num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num15.X - num19, num15.Y + num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num14.X - num19, num14.Y - num20))); figure2.Segments.Add(new LineSegment(new PointDouble(num14.X - num18, num14.Y - num20))); figure2.Segments.Add(new LineSegment(num14)); figure2.Segments.Add(new LineSegment(new PointDouble(num14.X + num18, num14.Y - num20))); figure2.Segments.Add(new LineSegment(new PointDouble(num14.X + num19, num14.Y - num20))); figure2.Segments.Add(new LineSegment(new PointDouble(num15.X + num19, num15.Y + num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num13.X - num20, num13.Y + num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num13.X - num20, num13.Y + num18))); figure2.Segments.Add(new LineSegment(num13)); figure2.Segments.Add(new LineSegment(new PointDouble(num13.X - num20, num13.Y - num18))); figure2.Segments.Add(new LineSegment(new PointDouble(num13.X - num20, num13.Y - num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num15.X + num19, num15.Y - num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num12.X + num19, num12.Y + num20))); figure2.Segments.Add(new LineSegment(new PointDouble(num12.X + num18, num12.Y + num20))); figure2.Segments.Add(new LineSegment(num12)); figure2.Segments.Add(new LineSegment(new PointDouble(num12.X - num18, num12.Y + num20))); figure2.Segments.Add(new LineSegment(new PointDouble(num12.X - num19, num12.Y + num20))); figure2.Segments.Add(new LineSegment(new PointDouble(num15.X - num19, num15.Y - num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num11.X + num20, num11.Y - num19))); figure2.Segments.Add(new LineSegment(new PointDouble(num11.X + num20, num11.Y - num18))); geometry2.Figures.Add(figure2); dc.FillGeometry(geometry2, this.blackBrush, null); } } base.OnRender(dc, clipRect, canvasView); }
private void OnRenderSelection(IDrawingContext dc, RectFloat clipRect) { IDeviceBitmap bitmap; IDeviceBitmap bitmap2; IDeviceBitmap bitmap3; bool flag = false; try { this.GetInitializedRenderBitmaps(dc, out bitmap, out bitmap2, out bitmap3); } catch (RecreateTargetException) { bitmap = null; bitmap2 = null; bitmap3 = null; } if (((bitmap == null) || (bitmap2 == null)) || (bitmap3 == null)) { flag = true; } else { using (dc.UseAntialiasMode(AntialiasMode.Aliased)) { Matrix3x2Float identity; RectFloat renderedMaskSourceRect = this.renderedMaskSourceRect; RectFloat renderedCanvasBounds = (RectFloat)this.renderedCanvasBounds; Matrix3x2Double interimTransform = this.renderedRenderParams.SelectionSnapshot.InterimTransform; VectorDouble scale = interimTransform.GetScale(); if (((interimTransform.HasInverse && (Math.Abs(scale.X) > 0.001)) && (Math.Abs(scale.Y) > 0.001)) && (base.Owner.SelectionSnapshot.GeometryVersion == this.renderedRenderParams.SelectionSnapshot.GeometryVersion)) { Matrix3x2Double inverse = interimTransform.Inverse; Matrix3x2Double num9 = base.Owner.Selection.GetInterimTransform(); Matrix3x2Double num10 = inverse * num9; identity = (Matrix3x2Float)num10; } else { identity = Matrix3x2Float.Identity; } RectFloat num6 = (RectFloat)RectDouble.Inflate(renderedCanvasBounds, 1.0, 1.0); RectFloat num7 = new RectFloat(PointFloat.Zero, (SizeFloat)this.renderedRenderParams.CanvasSize); using (dc.UseAxisAlignedClip(num7, AntialiasMode.Aliased)) { using (dc.UseTransformMultiply(identity, MatrixMultiplyOrder.Prepend)) { IBrush cachedOrCreateResource = dc.GetCachedOrCreateResource <IBrush>(this.renderedRenderParams.InteriorBrush); dc.FillOpacityMask(bitmap, cachedOrCreateResource, OpacityMaskContent.Graphics, new RectFloat?(renderedCanvasBounds), new RectFloat?(renderedMaskSourceRect)); } } using (dc.UseTransformMultiply(identity, MatrixMultiplyOrder.Prepend)) { using (dc.UseAxisAlignedClip(num6, AntialiasMode.Aliased)) { IBrush brush = dc.GetCachedOrCreateResource <IBrush>(blackBrush); dc.FillOpacityMask(bitmap2, brush, OpacityMaskContent.Graphics, new RectFloat?(renderedCanvasBounds), new RectFloat?(renderedMaskSourceRect)); IBrush brush3 = dc.GetCachedOrCreateResource <IBrush>(whiteBrush); dc.FillOpacityMask(bitmap3, brush3, OpacityMaskContent.Graphics, new RectFloat?(renderedCanvasBounds), new RectFloat?(renderedMaskSourceRect)); } } } if (this.renderedRenderParams.ViewportCanvasBounds != base.CanvasView.ViewportCanvasBounds) { flag = true; } } if (flag && !this.isRedrawing) { this.QueueBeginRedraw(); } }
private void RedrawOnBackgroundThread() { if (base.CheckAccess()) { ExceptionUtil.ThrowInvalidOperationException(); } if (this.redrawThreadFactory == null) { this.redrawThreadFactory = new Direct2DFactory(Direct2DFactoryType.MultiThreaded, DebugLevel.None); } if ((this.redrawThreadGeometryCache == null) || (this.redrawThreadGeometryCache.SelectionSnapshot != this.redrawRenderParams.SelectionSnapshot)) { DisposableUtil.Free <SelectionGeometryCache>(ref this.redrawThreadGeometryCache); this.redrawThreadGeometryCache = new SelectionGeometryCache(this.redrawThreadFactory, this.redrawRenderParams.SelectionSnapshot); } double scaleRatio = this.redrawRenderParams.ScaleRatio; PointDouble location = this.redrawRenderParams.ViewportCanvasBounds.Location; SizeDouble viewportSize = this.redrawRenderParams.ViewportSize; SizeInt32 num5 = SizeDouble.Ceiling(viewportSize); RectDouble b = RectDouble.Inflate(CanvasCoordinateConversions.ConvertExtentToViewport(CanvasCoordinateConversions.ConvertCanvasToExtent(this.redrawRenderParams.SelectionSnapshot.GeometryList.Value.Bounds, scaleRatio), scaleRatio, location), (double)this.outlineStrokeWidthPx, (double)this.outlineStrokeWidthPx); RectDouble a = new RectDouble(PointDouble.Zero, viewportSize); RectDouble renderViewportBounds = RectDouble.Intersect(a, b); RectInt32 viewportRect = renderViewportBounds.Int32Bound; RectDouble extentRect = CanvasCoordinateConversions.ConvertViewportToExtent(viewportRect, scaleRatio, location); RectDouble renderCanvasBounds = CanvasCoordinateConversions.ConvertExtentToCanvas(extentRect, scaleRatio); if (!viewportRect.HasPositiveArea) { base.SyncContext.Post((SendOrPostCallback)(_ => this.EndRedraw(renderViewportBounds, RectFloat.Zero, null, null))); } else { IBitmap <ColorAlpha8> interiorMask; float scale; PointFloat offset; Result <IGeometry> lazyGeometry; IBitmap <ColorAlpha8>[] dashedOutlineMasks; RectFloat maskSourceRect; SelectionSnapshot selectionSnapshot = this.redrawRenderParams.SelectionSnapshot; SelectionGeometryCache redrawThreadGeometryCache = this.redrawThreadGeometryCache; bool flag = this.redrawRenderParams.SelectionRenderingQuality == SelectionRenderingQuality.Aliased; if (!flag) { lazyGeometry = redrawThreadGeometryCache.Geometry; } else { bool flag3 = selectionSnapshot.IsRectilinear.Value; bool flag4 = selectionSnapshot.IsPixelated.Value; if (flag3 & flag4) { lazyGeometry = redrawThreadGeometryCache.Geometry; } else { lazyGeometry = redrawThreadGeometryCache.PixelatedGeometry; } } bool flag2 = !flag && this.redrawRenderParams.IsOutlineAntialiased; AntialiasMode antialiasMode = ((flag || !flag2) || selectionSnapshot.IsRectilinear.Value) ? AntialiasMode.Aliased : AntialiasMode.PerPrimitive; if (this.CanContinueRedrawing(null, null)) { scale = (float)this.redrawRenderParams.ScaleRatio; float x = -((float)renderCanvasBounds.X); float y = -((float)renderCanvasBounds.Y); offset = new PointFloat(x, y); interiorMask = BitmapAllocator.Alpha8.Allocate(viewportRect.Size, AllocationOptions.ZeroFillNotRequired); try { RetryManager.RunMemorySensitiveOperation(delegate { using (IDrawingContext context = DrawingContext.FromBitmap(this.redrawThreadFactory, interiorMask)) { context.Clear(null); IBrush interiorBrush = context.GetCachedOrCreateResource <IBrush>(whiteBrush); this.RenderSelection(context, scale, offset, this.redrawRenderParams, lazyGeometry, interiorBrush, null, null, antialiasMode); } }); } catch (OutOfMemoryException) { } if (this.CanContinueRedrawing(interiorMask, null)) { int num15; dashedOutlineMasks = new IBitmap <ColorAlpha8> [SelectionCanvasLayer.DashLength]; for (int i = 0; i < dashedOutlineMasks.Length; i = num15) { if ((!this.redrawRenderParams.IsOutlineAnimated && (i != 0)) && (i != (SelectionCanvasLayer.DashLength / 2))) { dashedOutlineMasks[i] = null; } else { dashedOutlineMasks[i] = BitmapAllocator.Alpha8.Allocate(viewportRect.Size, AllocationOptions.ZeroFillNotRequired); try { RetryManager.RunMemorySensitiveOperation(delegate { using (IDrawingContext context = DrawingContext.FromBitmap(this.redrawThreadFactory, dashedOutlineMasks[i])) { context.Clear(null); StrokeStyle resourceSource = SelectionCanvasLayer.GetDashedStrokeStyle(i); IStrokeStyle outlineStrokeStyle = context.GetCachedOrCreateResource <IStrokeStyle>(resourceSource); IBrush cachedOrCreateResource = context.GetCachedOrCreateResource <IBrush>(whiteBrush); this.RenderSelection(context, scale, offset, this.redrawRenderParams, lazyGeometry, null, cachedOrCreateResource, outlineStrokeStyle, antialiasMode); } }); } catch (OutOfMemoryException) { } if (!this.CanContinueRedrawing(interiorMask, dashedOutlineMasks)) { return; } } num15 = i + 1; } maskSourceRect = new RectFloat(PointFloat.Zero, interiorMask.Size); base.SyncContext.Post(_ => this.EndRedraw(renderCanvasBounds, maskSourceRect, interiorMask, dashedOutlineMasks), null); } } } }
private static RectDouble CalculateInvalidRect(CanvasView canvasView, RectDouble canvasRect) { double canvasHairWidth = canvasView.CanvasHairWidth; return(RectDouble.Inflate(canvasRect, canvasHairWidth, canvasHairWidth)); }
public DragBarWidget(RectDouble <T> InBounds) { SetTransform(MatrixFactory <T> .NewTranslation(InBounds.Left, InBounds.Bottom)); Bounds = new RectDouble <T>(M.Zero <T>(), M.Zero <T>(), InBounds.Width, InBounds.Height); }
protected override Geometry OnCreateImageGeometry(RectDouble bounds, IDictionary <string, object> settingValues) => this.GetRoundedRectangleGeometry(bounds, bounds.Width / 4.0, bounds.Height / 4.0).EnsureFrozen <RectangleGeometry>();
protected override Geometry OnCreateGuideGeometry(RectDouble bounds, IDictionary <string, object> settingValues) { float num = (float)settingValues[ToolSettings.Null.Radius.Path]; return(this.GetRoundedRectangleGeometry(bounds, (double)num, (double)num).EnsureFrozen <RectangleGeometry>()); }
public RectDouble GetBounds(SizeDouble stampSize) { SizeDouble size = new SizeDouble(stampSize.Width * this.stampScale, stampSize.Height * this.stampScale); return(RectDouble.FromCenter(this.center, size)); }
public RoundedRect(RectDouble <T> bounds, T r) : this(bounds.Left, bounds.Bottom, bounds.Right, bounds.Top, r) { }
public virtual void Invalidate(RectDouble <T> rectToInvalidate) { Parrent.Invalidate(rectToInvalidate); }
protected override void OnKeyDown(KeyEventArgs e) { if (e.Handled) { goto Label_0347; } PaintDotNet.Canvas.CanvasView canvasView = this.CanvasView; if (canvasView == null) { goto Label_0347; } bool flag = false; switch (e.KeyCode) { case Keys.PageUp: if (!e.Shift) { canvasView.ViewportCanvasOffset -= new VectorDouble(0.0, canvasView.ViewportCanvasBounds.Height); } else { canvasView.ViewportCanvasOffset -= new VectorDouble(canvasView.ViewportCanvasBounds.Width, 0.0); } flag = true; e.Handled = true; goto Label_032E; case Keys.Next: if (!e.Shift) { canvasView.ViewportCanvasOffset += new VectorDouble(0.0, canvasView.ViewportCanvasBounds.Height); break; } canvasView.ViewportCanvasOffset += new VectorDouble(canvasView.ViewportCanvasBounds.Width, 0.0); break; case Keys.End: if (!e.Control || !e.Alt) { if (e.Control) { canvasView.ViewportCanvasOffset = canvasView.ViewportCanvasOffsetMax; } else { RectDouble visibleCanvasBounds = canvasView.GetVisibleCanvasBounds(); SizeDouble size = canvasView.ViewportCanvasBounds.Size; PointDouble bottomRight = canvasView.GetCanvasBounds().BottomRight; if ((visibleCanvasBounds.Left <= (bottomRight.X - 1.0)) && (visibleCanvasBounds.Right >= bottomRight.X)) { if ((visibleCanvasBounds.Top > (bottomRight.Y - 1.0)) || (visibleCanvasBounds.Bottom < bottomRight.Y)) { canvasView.ViewportCanvasOffset = new PointDouble(canvasView.ViewportCanvasOffset.X, bottomRight.Y - size.Height); } } else { canvasView.ViewportCanvasOffset = new PointDouble(bottomRight.X - size.Width, canvasView.ViewportCanvasOffset.Y); } } } flag = true; e.Handled = true; goto Label_032E; case Keys.Home: if (!e.Control || !e.Alt) { if (e.Control) { canvasView.ViewportCanvasOffset = canvasView.ViewportCanvasOffsetMin; } else { RectDouble num2 = canvasView.GetVisibleCanvasBounds(); PointDouble topLeft = canvasView.GetCanvasBounds().TopLeft; if ((num2.Left <= topLeft.X) && (num2.Right >= (topLeft.X + 1.0))) { if ((num2.Top > topLeft.Y) || (num2.Bottom < (topLeft.Y + 1.0))) { canvasView.ViewportCanvasOffset -= new VectorDouble(0.0, num2.Top - topLeft.Y); } } else { canvasView.ViewportCanvasOffset -= new VectorDouble(num2.Left - topLeft.X, 0.0); } } } flag = true; e.Handled = true; goto Label_032E; default: goto Label_032E; } flag = true; e.Handled = true; Label_032E: if (flag) { canvasView.SetValue(PaintDotNet.Canvas.CanvasView.ViewportCanvasOffsetProperty, canvasView.GetValue(PaintDotNet.Canvas.CanvasView.ViewportCanvasOffsetProperty)); } Label_0347: base.OnKeyDown(e); }
public SimpleVertexSourceWidget(T x1, T y1, T x2, T y2) { Bounds = new RectDouble <T>(x1, y1, x2, y2); }
private RectDouble CalculateInvalidRect(CanvasView canvasView, RectDouble canvasRect) => RectDouble.Inflate(this.GetHandleCanvasRect(canvasView), 1.0, 1.0);
public static RectDouble ConvertViewportToExtent(this CanvasView canvasView, RectDouble viewportRect) => CanvasCoordinateConversions.ConvertViewportToExtent(viewportRect, canvasView.ScaleRatio, canvasView.ViewportCanvasOffset);
private RectDouble CalculateInvalidRect(CanvasView canvasView, RectDouble canvasRect) => RectDouble.Inflate(this.GetCursorOutlineRect(canvasView, canvasRect), 1.0, 1.0);
public static RectDouble ConvertCanvasToExtent(this CanvasView canvasView, RectDouble canvasRect) => CanvasCoordinateConversions.ConvertCanvasToExtent(canvasRect, canvasView.ScaleRatio);
public static RectDouble ConvertViewportToCanvas(RectDouble viewportRect, double scaleRatio, PointDouble viewportCanvasOffset) => ConvertExtentToCanvas(ConvertViewportToExtent(viewportRect, scaleRatio, viewportCanvasOffset), scaleRatio);
public static RectDouble ConvertCanvasToViewport(this CanvasView canvasView, RectDouble canvasRect) => CanvasCoordinateConversions.ConvertCanvasToViewport(canvasRect, canvasView.ScaleRatio, canvasView.ViewportCanvasOffset);
public static RectDouble ConvertCanvasToExtent(RectDouble canvasRect, double scaleRatio) { PointDouble location = ConvertCanvasToExtent(canvasRect.Location, scaleRatio); return(new RectDouble(location, ConvertCanvasToExtent(canvasRect.Size, scaleRatio))); }
public static RectDouble ConvertExtentToCanvas(this CanvasView canvasView, RectDouble extentRect) => CanvasCoordinateConversions.ConvertExtentToCanvas(extentRect, canvasView.ScaleRatio);
public static RectDouble ConvertExtentToCanvas(RectDouble extentRect, double scaleRatio) { PointDouble location = ConvertExtentToCanvas(extentRect.Location, scaleRatio); return(new RectDouble(location, ConvertExtentToCanvas(extentRect.Size, scaleRatio))); }
public PlacedBitmap(IBitmap bitmap, RectDouble layoutRect, bool assumeOwnership) { this.bitmap = assumeOwnership ? bitmap : bitmap.CreateRef(); this.layoutRect = layoutRect; }
public SelectionSnapshot(Result <PaintDotNet.Rendering.GeometryList> lazyGeometryList, Result <IReadOnlyList <RectInt32> > lazyPixelatedScans, Matrix3x2Double interimTransform, RectDouble fastMaxBounds, bool isEmpty, int geometryVersion) { Validate.Begin().IsNotNull <Result <PaintDotNet.Rendering.GeometryList> >(lazyGeometryList, "lazyGeometryList").IsNotNull <Result <IReadOnlyList <RectInt32> > >(lazyPixelatedScans, "lazyPixelatedScans").Check(); this.lazyGeometryList = lazyGeometryList; this.lazyPixelatedScans = lazyPixelatedScans; this.interimTransform = interimTransform; this.fastMaxBounds = fastMaxBounds; this.isEmpty = isEmpty; this.geometryVersion = geometryVersion; this.isRectilinear = LazyResult.New <bool>(() => this.GeometryList.Value.IsRectilinear, LazyThreadSafetyMode.ExecutionAndPublication, new SingleUseCriticalSection()); this.isPixelated = LazyResult.New <bool>(() => this.GeometryList.Value.IsPixelated, LazyThreadSafetyMode.ExecutionAndPublication, new SingleUseCriticalSection()); }
protected override Geometry OnCreateGuideGeometry(RectDouble bounds, IDictionary <string, object> settingValues) => this.GetEllipseGeometry(bounds);