本文整理汇总了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())
);
}
}
示例2: QuadraticBezierTo
public void QuadraticBezierTo(Point control, Point dest)
{
_sink.AddQuadraticBezier(new D2D.QuadraticBezierSegment
{
Point1 = control.ToSharpDX(),
Point2 = dest.ToSharpDX()
});
}
示例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(),
});
}
示例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,
});
}
示例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);
}
}
}
}
示例6: LineTo
public void LineTo(Point point)
{
_sink.AddLine(point.ToSharpDX());
}
示例7: BeginFigure
public void BeginFigure(Point startPoint, bool isFilled)
{
_sink.BeginFigure(startPoint.ToSharpDX(), isFilled ? FigureBegin.Filled : FigureBegin.Hollow);
}