Avalonia/Perspex.SceneGraph/Media/IDrawingContext.cs

74 строки
2.6 KiB
C#

// -----------------------------------------------------------------------
// <copyright file="IDrawingContext.cs" company="Steven Kirk">
// Copyright 2013 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Media
{
using System;
using Perspex.Media.Imaging;
/// <summary>
/// Defines the interface through which drawing occurs.
/// </summary>
public interface IDrawingContext : IDisposable
{
Matrix CurrentTransform { get; }
void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect);
/// <summary>
/// Draws a line.
/// </summary>
/// <param name="pen">The stroke pen.</param>
/// <param name="p1">The first point of the line.</param>
/// <param name="p1">The second point of the line.</param>
void DrawLine(Pen pen, Point p1, Point p2);
/// <summary>
/// Draws a geometry.
/// </summary>
/// <param name="brush">The fill brush.</param>
/// <param name="pen">The stroke pen.</param>
/// <param name="geometry">The geometry.</param>
void DrawGeometry(Brush brush, Pen pen, Geometry geometry);
/// <summary>
/// Draws the outline of a rectangle.
/// </summary>
/// <param name="pen">The pen.</param>
/// <param name="rect">The rectangle bounds.</param>
void DrawRectange(Pen pen, Rect rect);
/// <summary>
/// Draws text.
/// </summary>
/// <param name="foreground">The foreground brush.</param>
/// <param name="origin">The upper-left corner of the text.</param>
/// <param name="text">The text.</param>
void DrawText(Brush foreground, Point origin, FormattedText text);
/// <summary>
/// Draws a filled rectangle.
/// </summary>
/// <param name="brush">The brush.</param>
/// <param name="rect">The rectangle bounds.</param>
void FillRectange(Brush brush, Rect rect);
/// <summary>
/// Pushes a clip rectange.
/// </summary>
/// <param name="clip">The clip rectangle.</param>
/// <returns>A disposable used to undo the clip rectangle.</returns>
IDisposable PushClip(Rect clip);
/// <summary>
/// Pushes a matrix transformation.
/// </summary>
/// <param name="matrix">The matrix</param>
/// <returns>A disposable used to undo the transformation.</returns>
IDisposable PushTransform(Matrix matrix);
}
}