csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.7 KiB
96 lines
3.7 KiB
// -----------------------------------------------------------------------
|
|
// <copyright file="StreamGeometryContext.cs" company="Steven Kirk">
|
|
// Copyright 2015 MIT Licence. See licence.md for more information.
|
|
// </copyright>
|
|
// -----------------------------------------------------------------------
|
|
|
|
namespace Perspex.Media
|
|
{
|
|
using System;
|
|
using Perspex.Platform;
|
|
|
|
/// <summary>
|
|
/// Describes a geometry using drawing commands.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This class is used to define the geometry of a <see cref="StreamGeometry"/>. An instance
|
|
/// of <see cref="StreamGeometryContext"/> is obtained by calling
|
|
/// <see cref="StreamGeometry.Open"/>.
|
|
/// </remarks>
|
|
/// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed?
|
|
public class StreamGeometryContext : IDisposable
|
|
{
|
|
private IStreamGeometryContextImpl impl;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="StreamGeometryContext"/> class.
|
|
/// </summary>
|
|
/// <param name="impl">The platform-specific implementation.</param>
|
|
public StreamGeometryContext(IStreamGeometryContextImpl impl)
|
|
{
|
|
this.impl = impl;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Draws an arc to the specified point.
|
|
/// </summary>
|
|
/// <param name="point">The destination point.</param>
|
|
/// <param name="size">The radii of an oval whose perimeter is used to draw the angle.</param>
|
|
/// <param name="rotationAngle">The rotation angle of the oval that specifies the curve.</param>
|
|
/// <param name="isLargeArc">true to draw the arc greater than 180 degrees; otherwise, false.</param>
|
|
/// <param name="sweepDirection">
|
|
/// A value that indicates whether the arc is drawn in the Clockwise or Counterclockwise direction.
|
|
/// </param>
|
|
public void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection)
|
|
{
|
|
this.impl.ArcTo(point, size, rotationAngle, isLargeArc, sweepDirection);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Begins a new figure.
|
|
/// </summary>
|
|
/// <param name="startPoint">The starting point for the figure.</param>
|
|
/// <param name="isFilled">Whether the figure is filled.</param>
|
|
public void BeginFigure(Point startPoint, bool isFilled)
|
|
{
|
|
this.impl.BeginFigure(startPoint, isFilled);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Draws a Bezier curve to the specified point.
|
|
/// </summary>
|
|
/// <param name="point1">The first control point used to specify the shape of the curve.</param>
|
|
/// <param name="point2">The second control point used to specify the shape of the curve.</param>
|
|
/// <param name="point3">The destination point for the end of the curve.</param>
|
|
public void BezierTo(Point point1, Point point2, Point point3)
|
|
{
|
|
this.impl.BezierTo(point1, point2, point3);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Draws a line to the specified point.
|
|
/// </summary>
|
|
/// <param name="point">The destination point.</param>
|
|
public void LineTo(Point point)
|
|
{
|
|
this.impl.LineTo(point);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ends the figure started by <see cref="BeginFigure(Point, bool)"/>.
|
|
/// </summary>
|
|
/// <param name="isClosed">Whether the figure is closed.</param>
|
|
public void EndFigure(bool isClosed)
|
|
{
|
|
this.impl.EndFigure(isClosed);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Finishes the drawing session.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
this.impl.Dispose();
|
|
}
|
|
}
|
|
}
|
|
|