Пример #1
0
 public StrokeStyle(Brush strokeColor, DashStyle dashStyle, PenLineCap dashCap)
     : this()
 {
     StrokeColor = strokeColor;
     DashStyle   = dashStyle;
     DashCap     = dashCap;
 }
Пример #2
0
 protected virtual void onPenLineCapChanged(PenLineCap cap)
 {
     if (penLineCapChanged != null)
     {
         penLineCapChanged(cap);
     }
 }
Пример #3
0
        public void SetLineCap(Pen widget, PenLineCap lineCap)
        {
            var pen = widget.ToAndroid();

            pen.StrokeCap = lineCap.ToSD();
            SetDashStyle(widget, widget.DashStyle);
        }
Пример #4
0
        public void SetLineCap(Pen widget, PenLineCap lineCap)
        {
            var swmpen = (swm.Pen)widget.ControlObject;

            swmpen.EndLineCap = swmpen.StartLineCap = swmpen.DashCap = lineCap.ToWpf();
            SetDashStyle(widget, widget.DashStyle);
        }
Пример #5
0
		public void SetLineCap (Pen widget, PenLineCap lineCap)
		{
			var pen = widget.ToSD ();
			pen.StartCap = pen.EndCap = lineCap.ToSD ();
			pen.DashCap = lineCap == PenLineCap.Round ? sd2.DashCap.Round : sd2.DashCap.Flat;
			SetDashStyle (widget, widget.DashStyle);
		}
Пример #6
0
        /// <summary>
        /// Handles changes to the TickStyle property.
        /// </summary>
        /// <param name="d">SprocketControl</param>
        /// <param name="e">DependencyProperty changed event arguments</param>
        private static void OnTickStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SprocketControl sprocket     = (SprocketControl)d;
            PenLineCap      oldTickStyle = (PenLineCap)e.OldValue;
            PenLineCap      newTickStyle = sprocket.TickStyle;

            sprocket.OnTickStyleChanged(oldTickStyle, newTickStyle);
        }
Пример #7
0
 public StrokeStyle(Brush strokeColor, double thickness, PenLineCap startLineCap, PenLineCap endLineCap)
     : this()
 {
     StrokeColor  = strokeColor;
     Thickness    = thickness;
     StartLineCap = startLineCap;
     EndLineCap   = endLineCap;
 }
Пример #8
0
 public StrokeStyle(Brush strokeColor, double thickness, DashStyle dashStyle, PenLineCap dashCap)
     : this()
 {
     StrokeColor = strokeColor;
     DashStyle   = dashStyle;
     DashCap     = dashCap;
     Thickness   = thickness;
 }
Пример #9
0
        /// <summary>
        /// Handles changes to the TickStyle property.
        /// </summary>
        /// <param name="d">SprocketControl</param>
        /// <param name="e">DependencyProperty changed event arguments</param>
        private static void OnTickStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WaitingControlCom waiting      = (WaitingControlCom)d;
            PenLineCap        oldTickStyle = (PenLineCap)e.OldValue;
            PenLineCap        newTickStyle = waiting.TickStyle;

            waiting.OnTickStyleChanged(oldTickStyle, newTickStyle);
        }
Пример #10
0
        public void SetLineCap(Pen widget, PenLineCap lineCap)
        {
            var pen = widget.ToSD();

            pen.StartCap = pen.EndCap = lineCap.ToSD();
            pen.DashCap  = lineCap == PenLineCap.Round ? sd2.DashCap.Round : sd2.DashCap.Flat;
            SetDashStyle(widget, widget.DashStyle);
        }
Пример #11
0
        internal WpfPen RealizeWpfPen()
        {
#if !SILVERLIGHT
            if (_dirty || !_dirty) // TODOWPF: XPen is frozen by design, WPF Pen can change
            {
                //if (_wpfPen == null)
                _wpfPen = new WpfPen(new SolidColorBrush(_color.ToWpfColor()), _width);
                //else
                //{
                //  _wpfPen.Brush = new SolidColorBrush(_color.ToWpfColor());
                //  _wpfPen.Thickness = _width;
                //}
                PenLineCap lineCap = XConvert.ToPenLineCap(_lineCap);
                _wpfPen.StartLineCap = lineCap;
                _wpfPen.EndLineCap   = lineCap;
                _wpfPen.LineJoin     = XConvert.ToPenLineJoin(_lineJoin);
                if (_dashStyle == XDashStyle.Custom)
                {
                    // TODOWPF: does not work in all cases
                    _wpfPen.DashStyle = new System.Windows.Media.DashStyle(_dashPattern, _dashOffset);
                }
                else
                {
                    switch (_dashStyle)
                    {
                    case XDashStyle.Solid:
                        _wpfPen.DashStyle = DashStyles.Solid;
                        break;

                    case XDashStyle.Dash:
                        //_wpfPen.DashStyle = DashStyles.Dash;
                        _wpfPen.DashStyle = new System.Windows.Media.DashStyle(new double[] { 2, 2 }, 0);
                        break;

                    case XDashStyle.Dot:
                        //_wpfPen.DashStyle = DashStyles.Dot;
                        _wpfPen.DashStyle = new System.Windows.Media.DashStyle(new double[] { 0, 2 }, 1.5);
                        break;

                    case XDashStyle.DashDot:
                        //_wpfPen.DashStyle = DashStyles.DashDot;
                        _wpfPen.DashStyle = new System.Windows.Media.DashStyle(new double[] { 2, 2, 0, 2 }, 0);
                        break;

                    case XDashStyle.DashDotDot:
                        //_wpfPen.DashStyle = DashStyles.DashDotDot;
                        _wpfPen.DashStyle = new System.Windows.Media.DashStyle(new double[] { 2, 2, 0, 2, 0, 2 }, 0);
                        break;
                    }
                }
            }
#else
            _wpfPen           = new System.Windows.Media.Pen();
            _wpfPen.Brush     = new SolidColorBrush(_color.ToWpfColor());
            _wpfPen.Thickness = _width;
#endif
            return(_wpfPen);
        }
Пример #12
0
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     if (values[0] is double progress && progress > 0)
     {
         PenLineCap cap = (PenLineCap)values[1];
         return(cap);
     }
     return(PenLineCap.Flat);
 }
Пример #13
0
 public static T Shape <T>(this T shape, Stretch aspect, Brush fill, Brush stroke,
                           DoubleCollection doubleCollection, double offSet,
                           PenLineCap penLineCap, PenLineJoin penLineJoin, double strokeThickness) where T : Shape
 {
     return(shape.Aspect(aspect).Fill(fill)
            .Stroke(stroke).StrokeDashArray(doubleCollection)
            .StrokeDashOffset(offSet).StrokeLineCap(penLineCap)
            .StrokeLineJoin(penLineJoin).StrokeThickness(strokeThickness));
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="color">The stroke color.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="lineCap">Specifies the type of graphic shape to use on both ends of a line.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     uint color,
     double thickness     = 1.0,
     DashStyle dashStyle  = null,
     PenLineCap lineCap   = PenLineCap.Flat,
     PenLineJoin lineJoin = PenLineJoin.Miter,
     double miterLimit    = 10.0) : this(new SolidColorBrush(color), thickness, dashStyle, lineCap, lineJoin, miterLimit)
 {
 }
Пример #15
0
        private MIL_PEN_CAP GetInternalCapType(PenLineCap cap)
        {
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Flat == MIL_PEN_CAP.MilPenCapFlat);
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Square == MIL_PEN_CAP.MilPenCapSquare);
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Round == MIL_PEN_CAP.MilPenCapRound);
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Triangle == MIL_PEN_CAP.MilPenCapTriangle);

            return((MIL_PEN_CAP)cap);
        }
Пример #16
0
		public void SetLineCap (Pen widget, PenLineCap lineCap)
		{
			var pen = widget.ToSD ();
			// get dash style before changing cap
			var dashStyle = widget.DashStyle;
			pen.StartCap = pen.EndCap = lineCap.ToSD ();
			pen.DashCap = lineCap == PenLineCap.Round ? sd2.DashCap.Round : sd2.DashCap.Flat;
			SetDashStyle (widget, dashStyle);
		}
        /// <summary>
        ///     Returns whether or not an enumeration instance a valid value.
        ///     This method is designed to be used with ValidateValueCallback, and thus
        ///     matches it's prototype.
        /// </summary>
        /// <param name="valueObject">
        ///     Enumeration value to validate.
        /// </param>
        /// <returns> 'true' if the enumeration contains a valid value, 'false' otherwise. </returns>
        public static bool IsPenLineCapValid(object valueObject)
        {
            PenLineCap value = (PenLineCap)valueObject;

            return((value == PenLineCap.Flat) ||
                   (value == PenLineCap.Square) ||
                   (value == PenLineCap.Round) ||
                   (value == PenLineCap.Triangle));
        }
        public static void LineCaps(GradientMode gradientMode, PenLineCap lineCap)
        {
            using var app = Application.AttachOrLaunch("Gu.Wpf.Geometry.Demo.exe", WindowName);
            var window = app.MainWindow;

            _ = window.FindComboBox("LineCap").Select(lineCap.ToString());
            _ = window.FindComboBox("GradientMode").Select(gradientMode.ToString());
            ImageAssert.AreEqual($"Images\\GradientPathLineCapsWindow\\{TestImage.Current}\\{gradientMode}_{lineCap}.png", window.FindGroupBox("Path"), TestImage.OnFail);
        }
Пример #19
0
        public void SetLineCap(Pen widget, PenLineCap lineCap)
        {
            var pen = widget.ToSD();
            // get dash style before changing cap
            var dashStyle = widget.DashStyle;

            pen.StartCap = pen.EndCap = lineCap.ToSD();
            pen.DashCap  = lineCap == PenLineCap.Round ? sd2.DashCap.Round : sd2.DashCap.Flat;
            SetDashStyle(widget, dashStyle);
        }
Пример #20
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public VisualElementFormat(Brush BackgroundBrush, Brush LineBrush, double LineThickness = DEFAULT_LINE_THICKNESS, double Opacity = 1.0,
                                   DashStyle LineDash = null, PenLineCap LineCap = PenLineCap.Round, PenLineJoin LineJoin = PenLineJoin.Miter)
        {
            this.MainBackground = BackgroundBrush.NullDefault(Brushes.WhiteSmoke);

            this.LineBrush     = LineBrush ?? Brushes.Black;
            this.Opacity       = Opacity;
            this.LineThickness = LineThickness;
            this.LineDash      = LineDash ?? DashStyles.Solid;
        }
Пример #21
0
        public static d2.DashCap ToDashCap(this PenLineCap me)
        {
            switch (me)
            {
            case PenLineCap.Round: return(d2.DashCap.Round);

            case PenLineCap.Triangle: return(d2.DashCap.Triangle);
            }
            return(d2.DashCap.Flat);
        }
Пример #22
0
 public void Reset()
 {
     Type              = NativeBrushType.Solid;
     Opacity           = 1f;
     Color             = 0;
     Stroke            = false;
     StrokeThickness   = 1;
     GradientStopCount = 0;
     StrokeDashCount   = 0;
     StrokeLineCap     = PenLineCap.Flat;
 }
Пример #23
0
 public void Reset()
 {
     Type = NativeBrushType.Solid;
     Opacity = 1f;
     Color = 0;
     Stroke = false;
     StrokeThickness = 1;
     GradientStopCount = 0;
     StrokeDashCount = 0;
     StrokeLineCap = PenLineCap.Flat;
 }
Пример #24
0
 public StrokeStyle(Brush strokeColor, double thickness, PenLineCap startLineCap, PenLineCap endLineCap,
                    PenLineJoin lineJoin, DashStyle dashStyle)
     : this()
 {
     StrokeColor  = strokeColor;
     Thickness    = thickness;
     StartLineCap = startLineCap;
     EndLineCap   = endLineCap;
     LineJoin     = lineJoin;
     DashStyle    = dashStyle;
 }
Пример #25
0
        void RenderCore(DrawingContext context, IBrush background, IBrush borderBrush, BoxShadows boxShadows,
                        double borderDashOffset, PenLineCap borderLineCap, PenLineJoin borderLineJoin,
                        AvaloniaList <double> borderDashArray)
        {
            if (_useComplexRendering)
            {
                var backgroundGeometry = _backgroundGeometryCache;
                if (backgroundGeometry != null)
                {
                    context.DrawGeometry(background, null, backgroundGeometry);
                }

                var borderGeometry = _borderGeometryCache;
                if (borderGeometry != null)
                {
                    context.DrawGeometry(borderBrush, null, borderGeometry);
                }
            }
            else
            {
                var  borderThickness = _borderThickness.Top;
                IPen pen             = null;


                ImmutableDashStyle?dashStyle = null;

                if (borderDashArray != null && borderDashArray.Count > 0)
                {
                    dashStyle = new ImmutableDashStyle(borderDashArray, borderDashOffset);
                }

                if (borderBrush != null && borderThickness > 0)
                {
                    pen = new ImmutablePen(
                        borderBrush.ToImmutable(),
                        borderThickness,
                        dashStyle,
                        borderLineCap,
                        borderLineJoin);
                }


                var rect = new Rect(_size);
                if (!MathUtilities.IsZero(borderThickness))
                {
                    rect = rect.Deflate(borderThickness * 0.5);
                }
                var rrect = new RoundedRect(rect, _cornerRadius.TopLeft, _cornerRadius.TopRight,
                                            _cornerRadius.BottomRight, _cornerRadius.BottomLeft);

                context.PlatformImpl.DrawRectangle(background, pen, rrect, boxShadows);
            }
        }
Пример #26
0
 public CanvasStyle(CanvasPath path, Brush fill, Brush stroke, double strokeWidth, PenLineJoin strokeLineJoin,
                    PenLineCap lineCap, float strokeMiterLimit, double globalAlpha)
 {
     _path = path;
     _fill = fill;
     _stroke = stroke;
     _strokeWidth = strokeWidth;
     _strokeLineJoin = strokeLineJoin;
     _lineCap = lineCap;
     _globalAlpha = globalAlpha;
     _strokeMiterLimit = strokeMiterLimit;
 }
Пример #27
0
        public static d2.LineCap ToGdiPlus(this PenLineCap me)
        {
            switch (me)
            {
            case PenLineCap.Square: return(d2.LineCap.Square);

            case PenLineCap.Round: return(d2.LineCap.Round);

            case PenLineCap.Triangle: return(d2.LineCap.Triangle);
            }
            return(d2.LineCap.Flat);
        }
Пример #28
0
        void DrawLineCap(DrawingContext dc, Point point, Vector vector,
                         PenLineCap startLineCap, PenLineCap endLineCap)
        {
            if (startLineCap == PenLineCap.Flat && endLineCap == PenLineCap.Flat)
            {
                return;
            }

            // Construct really tiny horizontal line
            vector.Normalize();
            double          angle  = Math.Atan2(vector.Y, vector.X);
            RotateTransform rotate = new RotateTransform(-180 * angle / Math.PI, point.X, point.Y);
            Point           point1 = rotate.Transform(point);
            Point           point2 = rotate.Transform(point + 0.25 * vector);

            // Construct pen for that line
            Pen pen = new Pen()
            {
                Thickness    = StrokeThickness,
                StartLineCap = startLineCap,
                EndLineCap   = endLineCap
            };

            pen.Freeze();

            // Why don't I just call dc.DrawLine at this point? Well, to avoid gaps between
            //  the tetragons, I had to draw them with an 'outlinePenWidth' pen based on the
            //  same brush as the fill. If I just called dc.DrawLine here, the caps would
            //  look a little smaller than the line, so....

            LineGeometry lineGeo = new LineGeometry(point1, point2);
            PathGeometry pathGeo = lineGeo.GetWidenedPathGeometry(pen);
            Brush        brush   = null;

            if (GradientMode == GradientMode.Perpendicular)
            {
                brush = new LinearGradientBrush(GradientStops, new Point(0, 0), new Point(0, 1));
                (brush as LinearGradientBrush).ColorInterpolationMode = ColorInterpolationMode;
            }
            else
            {
                double offset = endLineCap == PenLineCap.Flat ? 0 : 1;
                brush = new SolidColorBrush(GetColorFromGradientStops(offset));
                brush.Freeze();
            }

            pen = new Pen(brush, outlinePenWidth);
            pen.Freeze();
            rotate.Angle = 180 * angle / Math.PI;
            dc.PushTransform(rotate);
            dc.DrawGeometry(brush, pen, pathGeo);
            dc.Pop();
        }
Пример #29
0
        SKStrokeCap convertCap(PenLineCap cap)
        {
            if (cap == PenLineCap.Flat)
            {
                return(SKStrokeCap.Butt);
            }
            else if (cap == PenLineCap.Round)
            {
                return(SKStrokeCap.Round);
            }

            return(SKStrokeCap.Square);
        }
Пример #30
0
        public static DrawingImage GetImage(sdd.DashCap val)
        {
            double height = 1;
            double width  = 2;

            PenLineCap dashCap = PenLineCap.Flat;

            switch (val)
            {
            default:
            case sdd.DashCap.Flat:
                dashCap = PenLineCap.Flat;
                break;

            case sdd.DashCap.Round:
                dashCap = PenLineCap.Round;
                break;

            case sdd.DashCap.Triangle:
                dashCap = PenLineCap.Triangle;
                break;
            }

            //
            // Create the Geometry to draw.
            //
            var drawingGroup    = new DrawingGroup();
            var geometryDrawing = new GeometryDrawing()
            {
                Geometry = new RectangleGeometry(new Rect(0, 0, width, height))
            };

            geometryDrawing.Pen = new Pen(Brushes.Transparent, 0);
            drawingGroup.Children.Add(geometryDrawing);

            geometryDrawing = new GeometryDrawing()
            {
                Geometry = new LineGeometry(new Point(0, height / 2), new Point(width, height / 2))
            };
            geometryDrawing.Pen = new Pen(Brushes.Black, height / 5)
            {
                DashCap = dashCap, DashStyle = DashStyles.Dash
            };
            drawingGroup.Children.Add(geometryDrawing);

            var geometryImage = new DrawingImage(drawingGroup);

            // Freeze the DrawingImage for performance benefits.
            geometryImage.Freeze();
            return(geometryImage);
        }
Пример #31
0
        internal BaseStrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, PenLineCap cap, PenLineJoin join, AnimatableIntegerValue opacity, AnimatableFloatValue width, IList <AnimatableFloatValue> dashPattern, AnimatableFloatValue offset)
        {
            _lottieDrawable = lottieDrawable;

            Paint.Style      = Paint.PaintStyle.Stroke;
            Paint.StrokeCap  = cap;
            Paint.StrokeJoin = join;

            _opacityAnimation = opacity.CreateAnimation();
            _widthAnimation   = width.CreateAnimation();

            if (offset == null)
            {
                _dashPatternOffsetAnimation = null;
            }
            else
            {
                _dashPatternOffsetAnimation = offset.CreateAnimation();
            }
            _dashPatternAnimations = new List <IBaseKeyframeAnimation <float?> >(dashPattern.Count);
            _dashPatternValues     = new double[dashPattern.Count];

            for (var i = 0; i < dashPattern.Count; i++)
            {
                _dashPatternAnimations.Add(dashPattern[i].CreateAnimation());
            }

            layer.AddAnimation(_opacityAnimation);
            layer.AddAnimation(_widthAnimation);
            for (var i = 0; i < _dashPatternAnimations.Count; i++)
            {
                layer.AddAnimation(_dashPatternAnimations[i]);
            }
            if (_dashPatternOffsetAnimation != null)
            {
                layer.AddAnimation(_dashPatternOffsetAnimation);
            }

            _opacityAnimation.ValueChanged += OnValueChanged;
            _widthAnimation.ValueChanged   += OnValueChanged;

            for (var i = 0; i < dashPattern.Count; i++)
            {
                _dashPatternAnimations[i].ValueChanged += OnValueChanged;
            }
            if (_dashPatternOffsetAnimation != null)
            {
                _dashPatternOffsetAnimation.ValueChanged += OnValueChanged;
            }
        }
            internal FlattenedFigure(PathFigure figure, PenLineCap startLineCap, PenLineCap endLineCap, double strokeThickness)
            {
                var lines = GetLines(figure);

                if (!lines.Any())
                {
                    this.Segments = EmptySegments;
                    return;
                }

                var segments = new List <FlattenedSegment>(lines.Count);

                switch (startLineCap)
                {
                case PenLineCap.Flat:
                    break;

                case PenLineCap.Square:
                case PenLineCap.Round:
                case PenLineCap.Triangle:
                    segments.Add(FlattenedSegment.CreateStartLineCap(lines[0], startLineCap, strokeThickness));
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(startLineCap), startLineCap, "Unknown line cap.");
                }

                for (int i = 0; i < lines.Count; i++)
                {
                    segments.Add(FlattenedSegment.Create(lines.ElementAtOrDefault(i - 1), lines[i], lines.ElementAtOrDefault(i + 1), strokeThickness));
                }

                switch (endLineCap)
                {
                case PenLineCap.Flat:
                    break;

                case PenLineCap.Square:
                case PenLineCap.Round:
                case PenLineCap.Triangle:
                    segments.Add(FlattenedSegment.CreateEndLineCap(lines[lines.Count - 1], endLineCap, strokeThickness));
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(endLineCap), endLineCap, "Unknown line cap.");
                }

                this.Segments    = segments;
                this.TotalLength = this.Segments.Sum(x => x.Line.Length);
            }
Пример #33
0
        private void DrawLineCap(
            DrawingContext dc,
            Line line,
            PenLineCap startLineCap,
            PenLineCap endLineCap)
        {
            if (startLineCap == PenLineCap.Flat && endLineCap == PenLineCap.Flat)
            {
                return;
            }
            var point = endLineCap == PenLineCap.Flat ? line.StartPoint : line.EndPoint;
            // Construct really tiny horizontal line
            var angle  = Math.Atan2(line.Direction.Y, line.Direction.X);
            var rotate = new RotateTransform(-180 * angle / Math.PI, point.X, point.Y);
            var point1 = rotate.Transform(point);
            var point2 = rotate.Transform(point + 0.25 * line.Direction);

            // Construct pen for that line
            var pen = new Pen()
            {
                Thickness = this.StrokeThickness, StartLineCap = startLineCap, EndLineCap = endLineCap
            };

            // Why don't I just call dc.DrawLine at this point? Well, to avoid gaps between
            //  the tetragons, I had to draw them with an 'outlinePenWidth' pen based on the
            //  same brush as the fill. If I just called dc.DrawLine here, the caps would
            //  look a little smaller than the line, so....

            var   lineGeo = new LineGeometry(point1, point2);
            var   pathGeo = lineGeo.GetWidenedPathGeometry(pen);
            Brush brush;

            if (this.GradientMode == GradientMode.Perpendicular)
            {
                brush = new LinearGradientBrush(this.GradientStops, new Point(0, 0), new Point(0, 1));
                ((LinearGradientBrush)brush).ColorInterpolationMode = this.ColorInterpolationMode;
            }
            else
            {
                double offset = endLineCap == PenLineCap.Flat ? 0 : 1;
                brush = new SolidColorBrush(this.GradientStops.GetColorAt(offset, this.ColorInterpolationMode));
            }

            pen          = new Pen(brush, 0);
            rotate.Angle = 180 * angle / Math.PI;
            dc.PushTransform(rotate);
            dc.DrawGeometry(brush, pen, pathGeo);
            dc.Pop();
        }
Пример #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="brush">The brush used to draw.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="lineCap">The line cap.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     IBrush brush,
     double thickness     = 1.0,
     DashStyle dashStyle  = null,
     PenLineCap lineCap   = PenLineCap.Flat,
     PenLineJoin lineJoin = PenLineJoin.Miter,
     double miterLimit    = 10.0)
 {
     Brush      = brush;
     Thickness  = thickness;
     LineCap    = lineCap;
     LineJoin   = lineJoin;
     MiterLimit = miterLimit;
     DashStyle  = dashStyle;
 }
Пример #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="color">The stroke color.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="dashCap">The dash cap.</param>
 /// <param name="startLineCap">The start line cap.</param>
 /// <param name="endLineCap">The end line cap.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     uint color, 
     double thickness = 1.0,
     DashStyle dashStyle = null, 
     PenLineCap dashCap = PenLineCap.Flat, 
     PenLineCap startLineCap = PenLineCap.Flat,
     PenLineCap endLineCap = PenLineCap.Flat, 
     PenLineJoin lineJoin = PenLineJoin.Miter, 
     double miterLimit = 10.0)
 {
     Brush = new SolidColorBrush(color);
     Thickness = thickness;
     StartLineCap = startLineCap;
     EndLineCap = endLineCap;
     LineJoin = lineJoin;
     MiterLimit = miterLimit;
     DashStyle = dashStyle;
     DashCap = dashCap;
 }
Пример #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pen"/> class.
 /// </summary>
 /// <param name="brush">The brush used to draw.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashStyle">The dash style.</param>
 /// <param name="dashCap">The dash cap.</param>
 /// <param name="startLineCap">The start line cap.</param>
 /// <param name="endLineCap">The end line cap.</param>
 /// <param name="lineJoin">The line join.</param>
 /// <param name="miterLimit">The miter limit.</param>
 public Pen(
     Brush brush, 
     double thickness = 1.0,
     DashStyle dashStyle = null, 
     PenLineCap dashCap = PenLineCap.Flat, 
     PenLineCap startLineCap = PenLineCap.Flat, 
     PenLineCap endLineCap = PenLineCap.Flat, 
     PenLineJoin lineJoin = PenLineJoin.Miter, 
     double miterLimit = 10.0)
 {
     Brush = brush;
     Thickness = thickness;
     DashCap = dashCap;
     StartLineCap = startLineCap;
     EndLineCap = endLineCap;
     LineJoin = lineJoin;
     MiterLimit = miterLimit;
     DashStyle = dashStyle;
 }
Пример #37
0
        /// <summary>
        /// Pen - Initializes the brush from the parameters.
        /// </summary>
        /// <param name="brush"> The Pen's Brush. </param>
        /// <param name="thickness"> The Pen's thickness. </param>
        /// <param name="startLineCap"> The PenLineCap which applies to the start of the stroke. </param>
        /// <param name="endLineCap"> The PenLineCap which applies to the end of the stroke. </param>
        /// <param name="dashCap"> The PenDashCap which applies to the ends of each dash. </param>
        /// <param name="lineJoin"> The PenLineJoin. </param>
        /// <param name="miterLimit"> The miter limit. </param>
        /// <param name="dashStyle"> The dash style. </param>
        internal Pen(
            Brush brush,
            double thickness,
            PenLineCap startLineCap,
            PenLineCap endLineCap,
            PenLineCap dashCap,
            PenLineJoin lineJoin,
            double miterLimit,
            DashStyle dashStyle)
        {
            Thickness = thickness;
            StartLineCap = startLineCap;
            EndLineCap = endLineCap;
            DashCap = dashCap;
            LineJoin = lineJoin;
            MiterLimit = miterLimit;

            Brush = brush;
            DashStyle = dashStyle;
        }
Пример #38
0
		public void SetLineCap (Pen widget, PenLineCap lineCap)
		{
			((PenObject)widget.ControlObject).LineCap = lineCap.ToCairo ();
		}
Пример #39
0
 public StrokeStyle(Brush strokeColor, DashStyle dashStyle, PenLineCap dashCap)
     : this()
 {
     StrokeColor = strokeColor;
     DashStyle = dashStyle;
     DashCap = dashCap;
 }
Пример #40
0
 public StrokeStyle(Brush strokeColor, double thickness, DashStyle dashStyle, PenLineCap dashCap)
     : this()
 {
     StrokeColor = strokeColor;
     DashStyle = dashStyle;
     DashCap = dashCap;
     Thickness = thickness;
 }
Пример #41
0
		public void SetLineCap(Pen widget, PenLineCap lineCap)
		{
			throw new NotImplementedException();
		}
Пример #42
0
 public StrokeStyle(Brush strokeColor, double thickness, PenLineCap startLineCap, PenLineCap endLineCap,
     PenLineJoin lineJoin)
     : this()
 {
     StrokeColor = strokeColor;
     Thickness = thickness;
     StartLineCap = startLineCap;
     EndLineCap = endLineCap;
     LineJoin = lineJoin;
 }
Пример #43
0
 public StrokeStyle(Brush strokeColor, double thickness, PenLineCap startLineCap, PenLineCap endLineCap,
     PenLineJoin lineJoin, DashStyle dashStyle, PenLineCap dashCap)
     : this()
 {
     StrokeColor = strokeColor;
     Thickness = thickness;
     StartLineCap = startLineCap;
     EndLineCap = endLineCap;
     LineJoin = lineJoin;
     DashStyle = dashStyle;
     DashCap = dashCap;
 }
Пример #44
0
    CreateFrozenPen
    (
        Brush oBrush,
        Double dThickness,
        DashStyle oDashStyle,
        PenLineCap eLineCap
    )
    {
        Debug.Assert(oBrush != null);
        Debug.Assert(dThickness > 0);
        Debug.Assert(oDashStyle != null);
        // AssertValid();

        Pen oPen = new Pen(oBrush, dThickness);
        oPen.DashStyle = oDashStyle;
        oPen.StartLineCap = eLineCap;
        oPen.EndLineCap = eLineCap;
        WpfGraphicsUtil.FreezeIfFreezable(oPen);

        return (oPen);
    }
Пример #45
0
 /// <summary>
 /// Provides derived classes an opportunity to handle changes to the TickStyle property.
 /// </summary>
 /// <param name="oldTickStyle">Old Value</param>
 /// <param name="newTickStyle">New Value</param>
 protected virtual void OnTickStyleChanged(PenLineCap oldTickStyle, PenLineCap newTickStyle)
 {
   InvalidateVisual();
 }
Пример #46
0
        private MIL_PEN_CAP GetInternalCapType(PenLineCap cap)
        {
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Flat == MIL_PEN_CAP.MilPenCapFlat);
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Square == MIL_PEN_CAP.MilPenCapSquare);
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Round == MIL_PEN_CAP.MilPenCapRound);
            Debug.Assert((MIL_PEN_CAP)PenLineCap.Triangle == MIL_PEN_CAP.MilPenCapTriangle);

            return (MIL_PEN_CAP)cap;
        }
Пример #47
0
		public void SetLineCap(Pen widget, PenLineCap lineCap)
		{
			var pen = widget.ToAndroid();
			pen.StrokeCap = lineCap.ToSD();
			SetDashStyle(widget, widget.DashStyle);
		}
Пример #48
0
 public void DrawLine(CMember line, SolidColorBrush color, PenLineCap startCap, PenLineCap endCap, double thickness, Canvas imageCanvas)
 {
     Line myLine = new Line();
     myLine.Stretch = Stretch.Fill;
     myLine.Stroke = color;
     myLine.X1 = line.NodeStart.X;
     myLine.X2 = line.NodeEnd.X;
     myLine.Y1 = line.NodeStart.Z;
     myLine.Y2 = line.NodeEnd.Z;
     myLine.StrokeThickness = thickness;
     myLine.StrokeStartLineCap = startCap;
     myLine.StrokeEndLineCap = endCap;
     myLine.HorizontalAlignment = HorizontalAlignment.Left;
     myLine.VerticalAlignment = VerticalAlignment.Center;
     Canvas.SetTop(myLine, line.NodeStart.Z);
     Canvas.SetLeft(myLine, line.NodeStart.X);
     imageCanvas.Children.Add(myLine);
 }
Пример #49
0
		public void SetLineCap (Pen widget, PenLineCap lineCap)
		{
			var swmpen = (swm.Pen)widget.ControlObject;
			swmpen.EndLineCap = swmpen.StartLineCap = swmpen.DashCap = lineCap.ToWpf ();
			SetDashStyle (widget, widget.DashStyle);
		}
Пример #50
0
		public void SetLineCap(Pen widget, PenLineCap lineCap)
		{
			widget.ToPenData().LineCap = lineCap;
		}