_stage¶
C-level helpers for animation of sprites on a stage
The _stage module contains native code to speed-up the `stage Library
<https://github.com/python-ugame/circuitpython-stage>`_.
-
_stage.render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) → Any¶ Render and send to the display a fragment of the screen.
- Parameters
x0 (int) – Left edge of the fragment.
y0 (int) – Top edge of the fragment.
x1 (int) – Right edge of the fragment.
y1 (int) – Bottom edge of the fragment.
buffer (bytearray) – A buffer to use for rendering.
display (Display) – The display to use.
scale (int) – How many times should the image be scaled up.
background (int) – What color to display when nothing is there.
There are also no sanity checks, outside of the basic overflow checking. The caller is responsible for making the passed parameters valid.
This function is intended for internal use in the
stagelibrary and all the necessary checks are performed there.
-
class
_stage.Layer(width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray)¶ Keep information about a single layer of graphics
-
move(self, x: Any, y: Any)¶ Set the offset of the layer to the specified values.
-
frame(self, frame: Any, rotation: Any)¶ Set the animation frame of the sprite, and optionally rotation its graphic.
-