Expand description
§Cranpose Pixels Renderer
cranpose-render-pixels draws Cranpose scenes into a caller-owned RGBA byte
buffer. Renderer and host authors use PixelsRenderer when a software frame
fits the target surface. App authors can select the renderer-pixels feature
on cranpose.
PixelsRenderer::draw_scaled writes the current scene into a host-owned RGBA
buffer at the requested device scale:
use cranpose_render_pixels::PixelsRenderer;
let renderer = PixelsRenderer::new();
let mut rgba = vec![0; 64 * 64 * 4];
renderer.draw_scaled(&mut rgba, 64, 64, 2.0);AppShell supplies the scene before each frame. The host presents the image.
The watchOS host
shows the complete integration.
Default features are empty. The optional
embedded-default-font feature supplies a fallback font. The
renderer-pixels feature
selects this backend through cranpose; the watchos feature selects the same
backend.
See the PixelsRenderer API,
the renderer architecture guide
and the crate source.
Modules§
- scene
- The retained scene and hit regions of the pixel renderer.
- sprites
- The scene as sprites for a GPU compositor other than wgpu: SpriteKit on watchOS, which gives an app no Metal of its own.
Structs§
- HitRegion
- A hit target in window space: the node’s geometry, clips and pointer handlers.
- Picture
- The picture a host drew last.
PixelsRenderer::update_picturemoves it to the current scene and finds the pixels that change, andPixelsRenderer::draw_picture_areadraws any part of it. - Pixel
Rect - A rectangle of device pixels: columns
x..x + widthof rowsy..y + height. - Pixels
Renderer - A renderer that draws the scene into a caller-owned RGBA pixel buffer on the CPU.
- Scene
- The retained render graph of a window together with the hit targets built from it.
Functions§
- draw_
scene - Draws
sceneintoframe, an RGBA8 buffer ofwidthbyheightpixels, at one device pixel per logical pixel and with the default font resources.