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.Blazor.Rendering.BlazorBitmapRenderSurfaceAdapter Class Referencesealed

Provides a bitmap (CPU) render surface adapter for Blazor that presents each frame by converting pixel data from a SKImage into an RGBA byte array and drawing it onto the HTML canvas element owned by BlazorBitmapRenderSurfaceComponent. More...

Inheritance diagram for Gondwana.Blazor.Rendering.BlazorBitmapRenderSurfaceAdapter:
Gondwana.Rendering.RenderSurfaceAdapterBase

Public Member Functions

 BlazorBitmapRenderSurfaceAdapter (BlazorBitmapRenderSurfaceComponent component)
 Initializes a new instance of BlazorBitmapRenderSurfaceAdapter.
override void Present (SKImage bufferImage, SKRectI bufferRect, SKRect destRect)
 Presents the specified buffer image to the render surface by reading pixels into an RGBA byte array and scheduling a canvas update on the Blazor component's UI context.
void Dispose ()
 Releases all resources used by the adapter.
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 Blazor that presents each frame by converting pixel data from a SKImage into an RGBA byte array and drawing it onto the HTML canvas element owned by BlazorBitmapRenderSurfaceComponent.

This approach works in Blazor WebAssembly without requiring platform-specific SkiaSharp view packages. Each frame the engine produces is read into a managed RGBA byte array and then transferred to the browser canvas via the gondwana-blazor.js JS module.

Definition at line 17 of file BlazorBitmapRenderSurfaceAdapter.cs.

Constructor & Destructor Documentation

◆ BlazorBitmapRenderSurfaceAdapter()

Gondwana.Blazor.Rendering.BlazorBitmapRenderSurfaceAdapter.BlazorBitmapRenderSurfaceAdapter ( BlazorBitmapRenderSurfaceComponent component)

Initializes a new instance of BlazorBitmapRenderSurfaceAdapter.

Parameters
componentThe Blazor component that owns the canvas element.
Exceptions
ArgumentNullExceptionThrown when component is null.

Definition at line 28 of file BlazorBitmapRenderSurfaceAdapter.cs.

Member Function Documentation

◆ Dispose()

void Gondwana.Blazor.Rendering.BlazorBitmapRenderSurfaceAdapter.Dispose ( )

Releases all resources used by the adapter.

Definition at line 101 of file BlazorBitmapRenderSurfaceAdapter.cs.

◆ Present()

override void Gondwana.Blazor.Rendering.BlazorBitmapRenderSurfaceAdapter.Present ( SKImage bufferImage,
SKRectI bufferRect,
SKRect destRect )

Presents the specified buffer image to the render surface by reading pixels into an RGBA byte array and scheduling a canvas update on the Blazor component's UI context.

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

Definition at line 51 of file BlazorBitmapRenderSurfaceAdapter.cs.