// 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.GPU
{
/// A retained GPU leaf, presented by its runtime-owned surface.
/// GPU nodes have no canvas command buffers, inherited canvas paint, or children.
/// A platform can derive from this type to own its native presentation container.
public class GpuNode : Node
{
/// The runtime-owned GPU surface, created on first declaration.
public ICompositionGpuSurface? Surface { get; }
/// Overrides release their owned content, children and platform resources, then call base.
protected override void DisposeCore();
}
/// Why a context could not present a native GPU surface.
public enum GpuSurfaceFailure
{
/// The native GPU surface was accepted.
None,
///
/// This drawing context requires portable output, for example an SVG capture or
/// a native context under an unsupported clip. An offscreen fallback may still work.
///
PortableFallbackRequired,
/// The runtime could not create a GPU device or native GPU surface.
NotSupported
}
/// Runtime-owned presentation resource for a retained GPU node.
public interface ICompositionGpuSurface : IDisposable
{
/// Whether the surface already holds a successfully presented frame.
bool HasContent { get; }
/// Schedules drawing after native layout; the runtime owns frame acquisition and presentation.
void RequestRender(IGpuSurfaceContent content);
}
/// Runtime factory for native GPU composition surfaces owned by a window.
public interface IGpuSurfaceFactory
{
/// Whether native GPU presentation is available.
bool IsSupported { get; }
/// Creates a surface whose lifetime belongs to the retained composition tree.
/// A native GPU surface cannot be created on this device.
ICompositionGpuSurface CreateSurface();
}
}
namespace Xui.Core.Canvas.Composition.GPU
{
using Xui.GPU.Hardware;
/// A stable reference used both as a GPU surface's key and as its renderer.
/// Implement on a class, typically the View that owns the scene. The window calls
/// Render on its UI thread after placing the native surface. Do not retain or dispose the
/// borrowed target; encode and commit GPU commands during this call. Bounds are supplied
/// by GroupOptions; target dimensions are physical pixels. Canvas paint is not inherited.
public interface IGpuSurfaceContent
{
/// Draws and submits one frame into the borrowed presentation target.
void Render(IGpuRenderTarget target);
}
}