Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
 private PointDouble RoundMouseCanvasPoint(PointDouble pt) =>
 PointDouble.Truncate(pt);
Exemplo n.º 5
0
 protected PointDouble SnapPoint(PointDouble canvasPoint) =>
 PointDouble.Truncate(canvasPoint);