Exemplo n.º 1
0
        public Line Offset(double distance)
        {
            var v  = PerpendicularDirection;
            var sp = StartPoint.WithOffset(v, distance);
            var ep = EndPoint.WithOffset(v, distance);

            return(new Line(sp, ep));
        }
        internal static Point DrawCorner(this StreamGeometryContext context, Point fromPoint, double offsetX, double offsetY)
        {
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (offsetX == 0)
            {
                return fromPoint;
            }

            var p = fromPoint.WithOffset(offsetX, offsetY);
            var size = new Size(Math.Abs(offsetX), Math.Abs(offsetY));
            context.ArcTo(p, size, 90, false, SweepDirection.Clockwise, true, true);
            return p;
        }
        internal static Point DrawCorner(this StreamGeometryContext context, Point fromPoint, double offsetX, double offsetY)
        {
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (offsetX == 0)
            {
                return(fromPoint);
            }

            var p    = fromPoint.WithOffset(offsetX, offsetY);
            var size = new Size(Math.Abs(offsetX), Math.Abs(offsetY));

            context.ArcTo(p, size, 90, false, SweepDirection.Clockwise, true, true);
            return(p);
        }
Exemplo n.º 4
0
        internal static Point DrawCorner(this StreamGeometryContext context, Point fromPoint, double offsetX, double offsetY)
        {
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (offsetX == 0)
            {
                return(fromPoint);
            }

            var p    = fromPoint.WithOffset(offsetX, offsetY);
            var size = new Size(Math.Abs(offsetX), Math.Abs(offsetY));

            context.ArcTo(
                point: p,
                size: size,
                rotationAngle: 90,
                isLargeArc: false,
                sweepDirection: SweepDirection.Clockwise,
                isStroked: true,
                isSmoothJoin: true);
            return(p);
        }
Exemplo n.º 5
0
        private static StreamGeometry GetCornerGeometry(Point outerStart, Point outerEnd, Point innerEnd, Point innerStart, Size outerRd, double innerRadius, double xOffset, double yOffset)
        {
            outerStart = outerStart.WithOffset(xOffset, yOffset);
            outerEnd   = outerEnd.WithOffset(xOffset, yOffset);
            innerEnd   = innerEnd.WithOffset(xOffset, yOffset);
            innerStart = innerStart.WithOffset(xOffset, yOffset);

            //Size outerRd = new Size(outerRadius, outerRadius);
            Size innerRd  = new Size(innerRadius, innerRadius);
            var  geometry = new StreamGeometry();

            using (var ctx = geometry.Open())
            {
                ctx.BeginFigure(outerStart, true);
                ctx.ArcTo(outerEnd, outerRd, 90, false, SweepDirection.Clockwise);
                //ctx.LineTo(outerEnd);
                ctx.LineTo(innerEnd);
                ctx.ArcTo(innerStart, innerRd, -90, false, SweepDirection.CounterClockwise);
                //ctx.LineTo(innerStart);
                ctx.EndFigure(true);
            }
            //geometry.Transform = new TranslateTransform(xOffset, yOffset);
            return(geometry);
        }
Exemplo n.º 6
0
 private static Circle CreateBottomLeft(Point p, double r) => new Circle(p.WithOffset(r, -r), r);
Exemplo n.º 7
0
 private static Circle CreateTopRight(Point p, double r) => new Circle(p.WithOffset(-r, r), r);
Exemplo n.º 8
0
 private static Circle CreateBottomLeft(Point p, double r) => new Circle(p.WithOffset(r, -r), r);
Exemplo n.º 9
0
 private static Circle CreateTopRight(Point p, double r) => new Circle(p.WithOffset(-r, r), r);
Exemplo n.º 10
0
 public static Point WithOffset(this Point origin, Point offset)
 => origin.WithOffset(offset.X, offset.Y);