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


C# Point.ToSharpDX方法代碼示例

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


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

示例1: LinearGradientBrushImpl

        public LinearGradientBrushImpl(
            Perspex.Media.LinearGradientBrush brush,
            SharpDX.Direct2D1.RenderTarget target,
            Size destinationSize)
        {
            if (brush != null)
            {
                var gradientStops = brush.GradientStops.Select(s => new SharpDX.Direct2D1.GradientStop { Color = s.Color.ToDirect2D(), Position = (float)s.Offset }).ToArray();

                Point startPoint = new Point(0, 0);
                Point endPoint = new Point(0, 0);

                switch (brush.MappingMode)
                {
                    case Perspex.Media.BrushMappingMode.Absolute:
                        // TODO:

                        break;
                    case Perspex.Media.BrushMappingMode.RelativeToBoundingBox:
                        startPoint = new Point(brush.StartPoint.X * destinationSize.Width, brush.StartPoint.Y * destinationSize.Height);
                        endPoint = new Point(brush.EndPoint.X * destinationSize.Width, brush.EndPoint.Y * destinationSize.Height);

                        break;
                }

                PlatformBrush = new SharpDX.Direct2D1.LinearGradientBrush(
                    target,
                    new SharpDX.Direct2D1.LinearGradientBrushProperties { StartPoint = startPoint.ToSharpDX(), EndPoint = endPoint.ToSharpDX() },
                    new SharpDX.Direct2D1.BrushProperties { Opacity = (float)brush.Opacity, Transform = target.Transform },
                    new SharpDX.Direct2D1.GradientStopCollection(target, gradientStops, brush.SpreadMethod.ToDirect2D())
                );
            }
        }
開發者ID:healtech,項目名稱:Perspex,代碼行數:33,代碼來源:LinearGradientBrushImpl.cs

示例2: QuadraticBezierTo

 public void QuadraticBezierTo(Point control, Point dest)
 {
     _sink.AddQuadraticBezier(new D2D.QuadraticBezierSegment
     {
         Point1 = control.ToSharpDX(),
         Point2 = dest.ToSharpDX()
     });
 }
開發者ID:jkoritzinsky,項目名稱:Avalonia,代碼行數:8,代碼來源:StreamGeometryContextImpl.cs

示例3: CubicBezierTo

 public void CubicBezierTo(Point point1, Point point2, Point point3)
 {
     _sink.AddBezier(new D2D.BezierSegment
     {
         Point1 = point1.ToSharpDX(),
         Point2 = point2.ToSharpDX(),
         Point3 = point3.ToSharpDX(),
     });
 }
開發者ID:jkoritzinsky,項目名稱:Avalonia,代碼行數:9,代碼來源:StreamGeometryContextImpl.cs

示例4: ArcTo

 public void ArcTo(
     Point point,
     Size size,
     double rotationAngle,
     bool isLargeArc,
     Avalonia.Media.SweepDirection sweepDirection)
 {
     _sink.AddArc(new D2D.ArcSegment
     {
         Point = point.ToSharpDX(),
         Size = size.ToSharpDX(),
         RotationAngle = (float)rotationAngle,
         ArcSize = isLargeArc ? ArcSize.Large : ArcSize.Small,
         SweepDirection = (SweepDirection)sweepDirection,
     });
 }
開發者ID:jkoritzinsky,項目名稱:Avalonia,代碼行數:16,代碼來源:StreamGeometryContextImpl.cs

示例5: DrawLine

        /// <summary>
        /// Draws a line.
        /// </summary>
        /// <param name="pen">The stroke pen.</param>
        /// <param name="p1">The first point of the line.</param>
        /// <param name="p2">The second point of the line.</param>
        public void DrawLine(Pen pen, Point p1, Point p2)
        {
            if (pen != null)
            {
                var size = new Rect(p1, p2).Size;

                using (var d2dBrush = CreateBrush(pen.Brush, size))
                using (var d2dStroke = pen.ToDirect2DStrokeStyle(_renderTarget))
                {
                    if (d2dBrush.PlatformBrush != null)
                    {
                        _renderTarget.DrawLine(
                            p1.ToSharpDX(),
                            p2.ToSharpDX(),
                            d2dBrush.PlatformBrush,
                            (float)pen.Thickness,
                            d2dStroke);
                    }
                }
            }
        }
開發者ID:tshcherban,項目名稱:Perspex,代碼行數:27,代碼來源:DrawingContext.cs

示例6: LineTo

 public void LineTo(Point point)
 {
     _sink.AddLine(point.ToSharpDX());
 }
開發者ID:jkoritzinsky,項目名稱:Avalonia,代碼行數:4,代碼來源:StreamGeometryContextImpl.cs

示例7: BeginFigure

 public void BeginFigure(Point startPoint, bool isFilled)
 {
     _sink.BeginFigure(startPoint.ToSharpDX(), isFilled ? FigureBegin.Filled : FigureBegin.Hollow);
 }
開發者ID:jkoritzinsky,項目名稱:Avalonia,代碼行數:4,代碼來源:StreamGeometryContextImpl.cs


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