using System; using Avalonia.Media; using Avalonia.Rendering.SceneGraph; using Avalonia.Utilities; using Avalonia.Visuals.Media.Imaging; namespace Avalonia.Platform { /// /// Defines the interface through which drawing occurs. /// public interface IDrawingContextImpl : IDisposable { /// /// Gets or sets the current transform of the drawing context. /// Matrix Transform { get; set; } /// /// Clears the render target to the specified color. /// /// The color. void Clear(Color color); /// /// Draws a bitmap image. /// /// The bitmap image. /// The opacity to draw with. /// The rect in the image to draw. /// The rect in the output to draw to. /// The bitmap interpolation mode. void DrawBitmap(IRef source, double opacity, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode = BitmapInterpolationMode.Default); /// /// Draws a bitmap image. /// /// The bitmap image. /// The opacity mask to draw with. /// The destination rect for the opacity mask. /// The rect in the output to draw to. void DrawBitmap(IRef source, IBrush opacityMask, Rect opacityMaskRect, Rect destRect); /// /// Draws a line. /// /// The stroke pen. /// The first point of the line. /// The second point of the line. void DrawLine(IPen pen, Point p1, Point p2); /// /// Draws a geometry. /// /// The fill brush. /// The stroke pen. /// The geometry. void DrawGeometry(IBrush brush, IPen pen, IGeometryImpl geometry); /// /// Draws a rectangle with the specified Brush and Pen. /// /// The brush used to fill the rectangle, or null for no fill. /// The pen used to stroke the rectangle, or null for no stroke. /// The rectangle bounds. /// Box shadow effect parameters /// /// The brush and the pen can both be null. If the brush is null, then no fill is performed. /// If the pen is null, then no stoke is performed. If both the pen and the brush are null, then the drawing is not visible. /// void DrawRectangle(IBrush brush, IPen pen, RoundedRect rect, BoxShadows boxShadow = default); /// /// Draws text. /// /// The foreground brush. /// The upper-left corner of the text. /// The text. void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text); /// /// Draws a glyph run. /// /// The foreground. /// The glyph run. /// The baseline origin of the glyph run. void DrawGlyphRun(IBrush foreground, GlyphRun glyphRun, Point baselineOrigin); /// /// Creates a new that can be used as a render layer /// for the current render target. /// /// The size of the layer in DIPs. /// An /// /// Depending on the rendering backend used, a layer created via this method may be more /// performant than a standard render target bitmap. In particular the Direct2D backend /// has to do a format conversion each time a standard render target bitmap is rendered, /// but a layer created via this method has no such overhead. /// IRenderTargetBitmapImpl CreateLayer(Size size); /// /// Pushes a clip rectangle. /// /// The clip rectangle. void PushClip(Rect clip); /// /// Pops the latest pushed clip rectangle. /// void PopClip(); /// /// Pushes an opacity value. /// /// The opacity. void PushOpacity(double opacity); /// /// Pops the latest pushed opacity value. /// void PopOpacity(); /// /// Pushes an opacity mask /// void PushOpacityMask(IBrush mask, Rect bounds); /// /// Pops the latest pushed opacity mask. /// void PopOpacityMask(); /// /// Pushes a clip geometry. /// /// The clip geometry. void PushGeometryClip(IGeometryImpl clip); /// /// Pops the latest pushed geometry clip. /// void PopGeometryClip(); /// /// Adds a custom draw operation /// /// Custom draw operation void Custom(ICustomDrawOperation custom); } }