Expand description
The raster: a frame painted in software, the reference picture of a
GlyphBuffer that every backend must match. shuyi-app’s GPU
renderer is held to it (ticket 2018), and compare is the one
comparison every backend’s pixels go through. frame-png, the tool
contract and a game’s PNG snapshots paint with it; a game may too, at
run time (a save’s thumbnail, a photo mode). It takes decoded pictures:
decoding a file is the caller’s (shuyi-cli decodes PNG). Its
pictures are shuyi_assets::image::Image, what the image formats
decode, so a decoded picture is painted as it is.
Painter is a software copy of shuyi-app’s renderer, pixel for
pixel at whole scales: the clear colour, cell backgrounds, Under
items in order (a painted picture, ADR-0078, from the frame’s table,
as a sprite of the same pixels), glyphs tinted with their fg (a wide one over its two
cells, a wide one without its continuation as the fallback), Over
items in order (a gizmo, ADR-0085, as the runs of whole console pixels
GizmoItem::for_each_run
gives);
and before all that, a backdrop’s scene in its window. Textures are
sampled at the nearest pixel and blended over what is beneath with
their alpha, as the GPU does. one_bit_picture paints a one-bit
frame black and white, and test_card is a generated test image for
sprite items. card is the render card: one frame with every kind of
thing a frame draws, which a backend draws to hold its pixels to the
raster’s.
Behind the raster feature (the tests have it anyway): the default
engine and a console’s build don’t need it.
Modules§
- card
- The render card (ADR-0052 §6, ticket 2392): one fixed frame with every
kind of thing a frame draws, so a backend’s window is held to the
raster for all of them, with no game behind it.
shuyi-app’srender_cardexample draws it in a window and compares the window withRenderCard::painter’s picture, in CI’srenderjob. - test_
card - The test card: a public test image for sprite items, generated, not
art, so the same code always makes the same pixels. The raster’s and
frame-png’s tests paint it, and a game may write it into its test files.
Structs§
- Comparison
- What
comparefound. Over pictures of different sizes, every field butsame_sizecovers the top-left area both share. - Image
- A picture of four bytes a pixel: the image formats’ (
shuyi-assets), so a picture aFormatsregistry decodes paints as it is. An image’s pixels: four bytes each (red, green, blue, alpha), row by row from the top. - Painter
- The font atlas and images, decoded, ready to render any number of frames.
- Tolerance
- How far a backend’s picture may be from the reference and still pass
compare. Read from a plan file as(channel: 4); a key left out takes its default.
Constants§
- MISSING_
COLOR - The colour of what is missing, as in
shuyi-app(macroquad’sMAGENTA): an image the painter lacks, a glyph the atlas lacks, and a pixel over the tolerance in aComparison’sdiff.
Functions§
- compare
- Compares a backend’s picture,
window, with thereferencethe raster painted, pixel by pixel, withintolerance. - of_
painted picture’s pixels as RGBA (Painted::rgba_into).- one_
bit_ picture frameas a black and white picture, each pixelscale×scale.