utils.bitmappresentadapter

A tool so contexts that produce a bitmap can still render to screen.

class rendercanvas.utils.bitmappresentadapter.BitmapPresentAdapter(canvas, present_methods)

An adapter to present a bitmap to a canvas using wgpu.

This adapter can be used by context objects that want to present a bitmap, when the canvas only supports presenting to screen.

present_bitmap(bitmap)

Present the given bitmap to screen.

Supported formats are “rgba-u8” and “i-u8” (grayscale). Returns the present-result dict produced by GPUCanvasContext.present().

class rendercanvas.utils.bitmappresentadapter.FullscreenTexture(device)

An object that helps rendering a texture to the full viewport.

draw(command_encoder, target_texture_view)

Draw the bitmap to given target texture view.

set_texture_data(data)

Upload new data to the texture. Creates a new internal texture object if needed.