private static ColorBgra GetBasisColor(RecolorToolChanges changes, IRenderer <ColorBgra> sampleSource) { PointInt32 pt = PointDouble.Truncate(changes.InputPoints.First <BrushInputPoint>().Location); if (sampleSource.Bounds <ColorBgra>().Contains(pt)) { return(sampleSource.GetPointSlow(pt)); } return(ColorBgra.TransparentBlack); }
private static void SnapMouseCanvasPoints(ShapeSnappingOption snappingOption, PointDouble startPoint, PointDouble endPoint, out PointDouble snappedStartPoint, out PointDouble snappedEndPoint) { switch (snappingOption) { case ShapeSnappingOption.None: snappedStartPoint = startPoint; snappedEndPoint = endPoint; return; case ShapeSnappingOption.RectangleCorners: SnapMouseCanvasCoordinatesToRectangleCorners(startPoint, endPoint, out snappedStartPoint, out snappedEndPoint); return; case ShapeSnappingOption.PixelCenters: snappedStartPoint = PointDouble.Truncate(startPoint) + new VectorDouble(0.5, 0.5); snappedEndPoint = PointDouble.Truncate(endPoint) + new VectorDouble(0.5, 0.5); return; } throw ExceptionUtil.InvalidEnumArgumentException <ShapeSnappingOption>(snappingOption, "snappingOption"); }
protected override CloneStampToolChanges CreateChanges(IEnumerable <KeyValuePair <string, object> > drawingSettingsValues, IEnumerable <BrushInputPoint> inputPoints, MouseButtonState rightButtonState) { WhichUserColor whichUserColor = (rightButtonState == MouseButtonState.Pressed) ? WhichUserColor.Secondary : WhichUserColor.Primary; int anchorLayerIndex = this.GetAnchorLayerIndex(); PointDouble pt = (PointDouble) - this.GetStaticData().anchorOffset; return(new CloneStampToolChanges(drawingSettingsValues, whichUserColor, inputPoints, anchorLayerIndex, PointDouble.Truncate(pt))); }
private PointDouble RoundMouseCanvasPoint(PointDouble pt) => PointDouble.Truncate(pt);
protected PointDouble SnapPoint(PointDouble canvasPoint) => PointDouble.Truncate(canvasPoint);