Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Avalonia.Rendering.AvaloniaBitmapRenderSurfaceAdapter Class Reference

Provides a bitmap (CPU) render surface adapter for Avalonia that presents each frame by copying pixel data from a SKImage into an WriteableBitmap displayed by AvaloniaBitmapRenderSurfaceControl. This approach works on all Avalonia targets (desktop, WebAssembly, Android, iOS, macOS) without requiring platform-specific SkiaSharp view packages. More...

Inheritance diagram for Gondwana.Avalonia.Rendering.AvaloniaBitmapRenderSurfaceAdapter:
Gondwana.Rendering.RenderSurfaceAdapterBase

Public Member Functions

 AvaloniaBitmapRenderSurfaceAdapter (AvaloniaBitmapRenderSurfaceControl control)
 Initializes a new instance of the AvaloniaBitmapRenderSurfaceAdapter class.
void RefreshDestinationSize ()
 Refreshes the destination size to match the control's current bounds.
override void Present (SKImage bufferImage, SKRectI bufferRect, SKRect destRect)
 Presents the specified buffer image to the render surface by copying pixels into an Avalonia WriteableBitmap and scheduling a repaint on the UI thread.
void Dispose ()
 Releases all resources used by the AvaloniaBitmapRenderSurfaceAdapter.
Public Member Functions inherited from Gondwana.Rendering.RenderSurfaceAdapterBase
Point AdapterPxToScreenPx (PointF adapterPx)
 Converts adapter input to logical ScreenPx, retaining outside coordinates for capture/leave.
void DrawImage (SKCanvas canvas, SKImage image, SKColor clearColor)
 Presents a complete image using the same transform as pointer normalization.
void Present (SKImage bufferImage, SKRectI bufferRect, SKRect destRect)
 Presents the specified portion of the Backbuffer image to the destination rectangle on the RenderSurfaceAdapter.

Additional Inherited Members

Protected Member Functions inherited from Gondwana.Rendering.RenderSurfaceAdapterBase
 RenderSurfaceAdapterBase (int destWidth, int destHeight)
 Initializes a new instance of the RenderSurfaceAdapterBase class with the specified dimensions.
 RenderSurfaceAdapterBase (int destWidth, int destHeight, bool initialSizeAvailable)
 Constructs an adapter whose initial layout may still be pending.
void SetDestinationSize (int destWidth, int destHeight)
 Sets the destination size of the render surface and raises the Resized event if the dimensions have changed.
Properties inherited from Gondwana.Rendering.RenderSurfaceAdapterBase
PresentationTransform Presentation [get]
 Current immutable aspect-preserving mapping of Backbuffer ScreenPx to adapter pixels.
float PresentationScale [get]
 Current derived presentation scale; adapter resize does not resize the Backbuffer.
int Width [get, protected set]
 Gets the current width of the render surface in pixels.
int Height [get, protected set]
 Gets the current height of the render surface in pixels.
Events inherited from Gondwana.Rendering.RenderSurfaceAdapterBase
Action< RenderSurfaceAdapterResizedEventArgs >? Resized
 Occurs when the render surface adapter is resized.

Detailed Description

Provides a bitmap (CPU) render surface adapter for Avalonia that presents each frame by copying pixel data from a SKImage into an WriteableBitmap displayed by AvaloniaBitmapRenderSurfaceControl. This approach works on all Avalonia targets (desktop, WebAssembly, Android, iOS, macOS) without requiring platform-specific SkiaSharp view packages.

Definition at line 17 of file AvaloniaBitmapRenderSurfaceAdapter.cs.

Constructor & Destructor Documentation

◆ AvaloniaBitmapRenderSurfaceAdapter()

Gondwana.Avalonia.Rendering.AvaloniaBitmapRenderSurfaceAdapter.AvaloniaBitmapRenderSurfaceAdapter ( AvaloniaBitmapRenderSurfaceControl control)

Initializes a new instance of the AvaloniaBitmapRenderSurfaceAdapter class.

Parameters
controlThe AvaloniaBitmapRenderSurfaceControl to target.
Exceptions
ArgumentNullExceptionThrown when control is null.

Definition at line 40 of file AvaloniaBitmapRenderSurfaceAdapter.cs.

Member Function Documentation

◆ Dispose()

void Gondwana.Avalonia.Rendering.AvaloniaBitmapRenderSurfaceAdapter.Dispose ( )

Releases all resources used by the AvaloniaBitmapRenderSurfaceAdapter.

Definition at line 207 of file AvaloniaBitmapRenderSurfaceAdapter.cs.

◆ Present()

override void Gondwana.Avalonia.Rendering.AvaloniaBitmapRenderSurfaceAdapter.Present ( SKImage bufferImage,
SKRectI bufferRect,
SKRect destRect )

Presents the specified buffer image to the render surface by copying pixels into an Avalonia WriteableBitmap and scheduling a repaint on the UI thread.

Parameters
bufferImageThe image to present.
bufferRectThe source rectangle within the buffer image.
destRectThe destination rectangle on the render surface.

Definition at line 71 of file AvaloniaBitmapRenderSurfaceAdapter.cs.

◆ RefreshDestinationSize()

void Gondwana.Avalonia.Rendering.AvaloniaBitmapRenderSurfaceAdapter.RefreshDestinationSize ( )

Refreshes the destination size to match the control's current bounds.

Definition at line 55 of file AvaloniaBitmapRenderSurfaceAdapter.cs.