// Generated API outline. Implementation bodies omitted. #nullable enable using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; using System.Threading; using System; using nfloat = System.Runtime.InteropServices.NFloat; using static Xui.Core.Math2D.Constants; namespace Xui.Core.Canvas.Composition.Commands { using System.Runtime.InteropServices; using Xui.Core.Canvas.Composition.Commands.Records; using Xui.Core.Canvas.Filter; using Xui.Core.Canvas.Symbols; /// Reusable pooled binary records and inline payloads, with a pooled managed resource table. /// Not thread-safe. Dispose the buffer to return its rented storage. Clear retains capacity /// for the next recording. Resource objects are retained by reference and are never disposed here. public sealed partial class CanvasCommandBuffer { /// Replays the owned stream into a canvas, reading each typed record without alignment assumptions. public void Replay(IContext target); } } namespace Xui.Core.Canvas.Composition.Commands { using System.Buffers; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Xui.Core.Canvas.Composition.Commands.Records; /// Reusable pooled binary records and inline payloads, with a pooled managed resource table. /// Not thread-safe. Dispose the buffer to return its rented storage. Clear retains capacity /// for the next recording. Resource objects are retained by reference and are never disposed here. public sealed partial class CanvasCommandBuffer : IDisposable { /// Creates a buffer backed by the shared byte and object array pools. public CanvasCommandBuffer(); /// Creates a buffer backed by the supplied pool; storage is rented on first use. public CanvasCommandBuffer(ArrayPool pool); /// Creates a buffer with supplied binary and resource pools, rented on first use. public CanvasCommandBuffer(ArrayPool pool, ArrayPool resourcePool); /// The number of complete commands in the stream. public int Count { get; } /// Packed headers followed immediately by their length-prefixed payload elements. /// The span is borrowed until the next mutation or disposal. Use MemoryMarshal.Read for /// unaligned headers. For text, dashes and gradients, Length specifies how many elements follow /// the header. Managed objects use ResourceRef IDs. These process-local bytes are not a portable /// serialization format. public ReadOnlySpan Data { get; } /// The number of retained object references in the shared resource list. public int ResourceCount { get; } /// Resolves an ID from this buffer to its retained object. /// The command determines the expected type, such as string or IImage. /// The list is not restricted to image resources; it can also retain future texture or /// other managed resource types. Null is allowed for a default font's family name. public object? GetResource(ResourceRef reference); /// Releases resource references while retaining rented storage for the next recording. public void Clear(); /// Clears all object references and returns both rented arrays. Safe to call more than once. public void Dispose(); /// Copies the binary stream and resource references into this buffer's owned storage. public void CopyFrom(CanvasCommandBuffer source); } } namespace Xui.Core.Canvas.Composition.Commands { /// Discriminator for a packed canvas command record. public enum CanvasOp { /// The Save operation. Save, /// The Restore operation. Restore, /// The BeginPath operation. BeginPath, /// The ClosePath operation. ClosePath, /// The Stroke operation. Stroke, /// The Clip operation. Clip, /// The GlobalAlpha operation. GlobalAlpha, /// The LineWidth operation. LineWidth, /// The MiterLimit operation. MiterLimit, /// The LineDashOffset operation. LineDashOffset, /// The LineCap operation. LineCap, /// The LineJoin operation. LineJoin, /// The TextAlign operation. TextAlign, /// The TextBaseline operation. TextBaseline, /// The Translate operation. Translate, /// The Scale operation. Scale, /// The Rotate operation. Rotate, /// The Transform operation. Transform, /// The SetTransform operation. SetTransform, /// The FillRect operation. FillRect, /// The StrokeRect operation. StrokeRect, /// The Rect operation. Rect, /// The MoveTo operation. MoveTo, /// The LineTo operation. LineTo, /// The Quadratic operation. Quadratic, /// The Cubic operation. Cubic, /// The ArcTo operation. ArcTo, /// The Arc operation. Arc, /// The Ellipse operation. Ellipse, /// The RoundRect operation. RoundRect, /// The Fill operation. Fill, /// The FilterNone operation. FilterNone, /// The Brightness operation. Brightness, /// The Font operation. Font, /// The FillColor operation. FillColor, /// The FillLinear operation. FillLinear, /// The FillRadial operation. FillRadial, /// The FillPattern operation. FillPattern, /// The StrokeColor operation. StrokeColor, /// The StrokeLinear operation. StrokeLinear, /// The StrokeRadial operation. StrokeRadial, /// The StrokePattern operation. StrokePattern, /// The Text operation. Text, /// The Dashes operation. Dashes, /// The Image operation. Image, /// The ImageCrop operation. ImageCrop, /// Text drawn from a retained string resource. TextResource, /// A placement of immutable reusable vector content. Symbol, } } namespace Xui.Core.Canvas.Composition.Commands { using System.Runtime.InteropServices; /// An ID for a managed object retained by a canvas command buffer. /// IDs belong to the buffer that recorded them. CopyFrom preserves their mapping; /// clearing or recording into that buffer invalidates previously borrowed IDs. /// The buffer retains references but does not dispose the resources. [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ResourceRef { /// Zero-based index in the owning buffer's shared resource list. public int Id; /// Creates a reference to an entry in the owning buffer. public ResourceRef(int id); } } namespace Xui.Core.Canvas.Composition.Commands { using Xui.Core.Canvas.Composition.Commands.Records; using Xui.Core.Canvas.Filter; using Xui.Core.Math2D; /// A keyed drawing tree. Each node draws its background first, then its child surfaces. public sealed partial class RetainedCanvasContext { public void DrawSymbol(Xui.Core.Canvas.Symbols.SymbolContent content); public void Save(); public void Restore(); public void BeginPath(); public void ClosePath(); public void Stroke(); public void Clip(); public nfloat GlobalAlpha { set; } public nfloat LineWidth { set; } public nfloat MiterLimit { set; } public nfloat LineDashOffset { set; } public LineCap LineCap { set; } public LineJoin LineJoin { set; } public TextAlign TextAlign { set; } public TextBaseline TextBaseline { set; } public void Translate(Vector value); public void Scale(Vector value); public void Rotate(nfloat angle); public void Transform(AffineTransform value); public void SetTransform(AffineTransform value); public void FillRect(Rect bounds); public void StrokeRect(Rect bounds); public void Rect(Rect bounds); public void MoveTo(Point position); public void LineTo(Point position); public void CurveTo(Point control, Point end); public void CurveTo(Point control1, Point control2, Point end); public void ArcTo(Point control, Point end, nfloat radius); public void Arc(Point center, nfloat radius, nfloat start, nfloat end, Winding winding = Winding.ClockWise); public void Ellipse(Point center, nfloat rx, nfloat ry, nfloat rotation, nfloat start, nfloat end, Winding winding = Winding.ClockWise); public void RoundRect(Rect bounds, CornerRadius corners); public void Fill(FillRule rule = FillRule.NonZero); public void SetFilter(); public void SetFilter(Brightness brightness); public void SetFont(Font font); public void SetFill(Color color); public void SetFill(LinearGradient gradient); public void SetFill(RadialGradient gradient); public void SetFill(ImagePattern pattern); public void SetStroke(Color color); public void SetStroke(LinearGradient gradient); public void SetStroke(RadialGradient gradient); public void SetStroke(ImagePattern pattern); public void FillText(ReadOnlySpan text, Point position); public void SetLineDash(ReadOnlySpan segments); public void DrawImage(IImage image, Rect destination, nfloat opacity); public void DrawImage(IImage image, Rect source, Rect destination, nfloat opacity); public void RoundRect(Rect rect, nfloat radius); public void FillText(string text, Point pos); public void DrawImage(IImage image, Rect dest); public TextMetrics MeasureText(string text); public TextMetrics MeasureText(ReadOnlySpan text); } } namespace Xui.Core.Canvas.Composition.Commands { using Xui.Core.Canvas.Composition.Commands.Records; using Xui.Core.Canvas.Composition.GPU; using Xui.Core.Canvas.Composition.Graphics; using Xui.Core.Math2D; /// A keyed drawing tree. Each node draws its background first, then its child surfaces. public sealed partial class RetainedCanvasContext : IContext { public GraphicsNode Root { get; } /// Creates a recorder, optionally using platform-specific nodes for the entire tree. /// Text service used while recording. /// Optional native GPU surface provider. /// Creates fresh graphics nodes for the root and keyed groups. /// Creates fresh GPU leaves. Cached nodes retain their instance and resources. public RetainedCanvasContext(ITextDrawingContext measure, IGpuSurfaceFactory? gpuSurfaces = null, Func? graphicsNodeFactory = null, Func? gpuNodeFactory = null); public void BeginFrame(Rect bounds, nfloat scale); public void EndFrame(); public void AcceptFrame(); public void AbortFrame(); public void Dispose(); public bool GpuSurface(scoped in GroupOptions options); public bool GpuSurface(scoped in GroupOptions options, out GpuSurfaceFailure failure); public CompositionGroup Group(scoped in GroupOptions options); public void EndGroup(); } }