PicoGraphics: Layers. (EXPERIMENTAL) #1011
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add preliminary support for multiple layered drawing surfaces.
Allows, for example, static content to be loaded into one layer and remain unmodified while the above layer contains animations.
Particularly useful for drawing PNG or JPEG UI elements which are then overdrawn with text or animated elements, without paying the cost of loading/decoding every frame.
Support for two layers is currently hard-coded for RGB332 and RGB565 pen types. There is no alpha blending, a pixel from the top layer is shown if it is not black (0) otherwise the underlying layer is displayed.
Since RAM usage is a multiple of layers, RGB332 will take 320240num_layers and RGB565 would be 3202402*num_layers, this is very much better suited for Pico 2 albeit RGB332 works well on a Pico.
Layer support is provided by the
frame_convert
function, as such it must always be called, even if the display native type matches the graphics buffer. EG: ST7735 and ST7789 displays supporting RGB565 now must callframe_convert
even if your display buffer is RGB565. This could be improved by checking the number of layers and skipping the call if it's 1.TODO
layers=
should belayered=
set_layer
) is called?