當前位置: 首頁>>代碼示例>>C#>>正文


C# StreamGeometryContext.QuadraticBezierTo方法代碼示例

本文整理匯總了C#中System.Windows.Media.StreamGeometryContext.QuadraticBezierTo方法的典型用法代碼示例。如果您正苦於以下問題:C# StreamGeometryContext.QuadraticBezierTo方法的具體用法?C# StreamGeometryContext.QuadraticBezierTo怎麽用?C# StreamGeometryContext.QuadraticBezierTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.StreamGeometryContext的用法示例。


在下文中一共展示了StreamGeometryContext.QuadraticBezierTo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SerializeData

 /// <summary>
 /// SerializeData - Serialize the contents of this Segment to the provided context.
 /// </summary>
 internal override void SerializeData(StreamGeometryContext ctx)
 {
     ctx.QuadraticBezierTo(Point1, Point2, IsStroked, IsSmoothJoin);
 }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:7,代碼來源:QuadraticBezierSegment.cs

示例2: ParseToGeometryContext


//.........這裏部分代碼省略.........
                        else
                        {
                            p = ReadPoint(cmd, ! AllowComma);

                            _secondLastPoint = ReadPoint(cmd, AllowComma);
                        }
                            
                        _lastPoint = ReadPoint(cmd, AllowComma);

                        context.BezierTo(p, _secondLastPoint, _lastPoint, IsStroked, ! IsSmoothJoin);
                        
                        last_cmd = 'C';
                    }
                    while (IsNumber(AllowComma));
                    
                    break;
                    
                case 'q': case 'Q': // quadratic Bezier
                case 't': case 'T': // smooth quadratic Bezier
                    EnsureFigure();
                    
                    do
                    {
                        if ((cmd == 't') || (cmd == 'T'))
                        {
                            if (last_cmd == 'Q')
                            {
                                _secondLastPoint = Reflect();
                            }
                            else
                            {
                                _secondLastPoint = _lastPoint;
                            }

                            _lastPoint = ReadPoint(cmd, ! AllowComma);
                        }
                        else
                        {
                            _secondLastPoint = ReadPoint(cmd, ! AllowComma);
                            _lastPoint = ReadPoint(cmd, AllowComma);
                        }

                        context.QuadraticBezierTo(_secondLastPoint, _lastPoint, IsStroked, ! IsSmoothJoin);
                        
                        last_cmd = 'Q';
                    }
                    while (IsNumber(AllowComma));
                    
                    break;
                    
                case 'a': case 'A':
                    EnsureFigure();
                    
                    do
                    {
                        // A 3,4 5, 0, 0, 6,7
                        double w        = ReadNumber(! AllowComma);
                        double h        = ReadNumber(AllowComma);
                        double rotation = ReadNumber(AllowComma);
                        bool large      = ReadBool();
                        bool sweep      = ReadBool();
                        
                        _lastPoint = ReadPoint(cmd, AllowComma);

                        context.ArcTo(
                            _lastPoint,
                            new Size(w, h),
                            rotation,
                            large,
#if PBTCOMPILER
                            sweep,
#else                            
                            sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise,
#endif                             
                            IsStroked,
                            ! IsSmoothJoin
                            );
                    }
                    while (IsNumber(AllowComma));
                    
                    last_cmd = 'A';
                    break;
                    
                case 'z':
                case 'Z':
                    EnsureFigure();
                    context.SetClosedState(IsClosed);
                    
                    _figureStarted = false;
                    last_cmd = 'Z';
                    
                    _lastPoint = _lastStart; // Set reference point to be first point of current figure
                    break;
                    
                default:
                    ThrowBadToken();
                    break;
                }
            }
        }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:101,代碼來源:parserscommon.cs

示例3: DrawFigure

        public static void DrawFigure(StreamGeometryContext ctx, PathFigure figure)
        {
            ctx.BeginFigure(figure.StartPoint, figure.IsFilled, figure.IsClosed);
            foreach (var segment in figure.Segments)
            {
                var lineSegment = segment as WpfLineSegment;
                if (lineSegment != null) { ctx.LineTo(lineSegment.Point, lineSegment.IsStroked, lineSegment.IsSmoothJoin); continue; }

                var bezierSegment = segment as BezierSegment;
                if (bezierSegment != null) { ctx.BezierTo(bezierSegment.Point1, bezierSegment.Point2, bezierSegment.Point3, bezierSegment.IsStroked, bezierSegment.IsSmoothJoin); continue; }

                var quadraticSegment = segment as QuadraticBezierSegment;
                if (quadraticSegment != null) { ctx.QuadraticBezierTo(quadraticSegment.Point1, quadraticSegment.Point2, quadraticSegment.IsStroked, quadraticSegment.IsSmoothJoin); continue; }

                var polyLineSegment = segment as PolyLineSegment;
                if (polyLineSegment != null) { ctx.PolyLineTo(polyLineSegment.Points, polyLineSegment.IsStroked, polyLineSegment.IsSmoothJoin); continue; }

                var polyBezierSegment = segment as PolyBezierSegment;
                if (polyBezierSegment != null) { ctx.PolyBezierTo(polyBezierSegment.Points, polyBezierSegment.IsStroked, polyBezierSegment.IsSmoothJoin); continue; }

                var polyQuadraticSegment = segment as PolyQuadraticBezierSegment;
                if (polyQuadraticSegment != null) { ctx.PolyQuadraticBezierTo(polyQuadraticSegment.Points, polyQuadraticSegment.IsStroked, polyQuadraticSegment.IsSmoothJoin); continue; }

                var arcSegment = segment as ArcSegment;
                if (arcSegment != null) { ctx.ArcTo(arcSegment.Point, arcSegment.Size, arcSegment.RotationAngle, arcSegment.IsLargeArc, arcSegment.SweepDirection, arcSegment.IsStroked, arcSegment.IsSmoothJoin); continue; }
            }
        }
開發者ID:WenzCao,項目名稱:automatic-graph-layout,代碼行數:27,代碼來源:GraphmapsNode.cs


注:本文中的System.Windows.Media.StreamGeometryContext.QuadraticBezierTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。