当前位置: 首页>>代码示例>>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;未经允许,请勿转载。