Picographics spritesheet support on cosmic unicorn?

Does anyone know if the Picographics graphics.sprite() functionality is supported on the cosmic unicorn? I have been able to use sprites on the Pico Display Pack 2, but have not had any success using them on cosmic unicorn.

Here is some example code, that tries to display a single frame of a 32x32 pixel ‘party parrot’ by selecting 16 ‘blocks’ of 8x8 sprites from a 128x128 pixel spritesheet.

from cosmic import CosmicUnicorn
from picographics import PicoGraphics, DISPLAY_COSMIC_UNICORN as DISPLAY, PEN_RGB332
cu = CosmicUnicorn()
graphics = PicoGraphics(DISPLAY, pen_type = PEN_RGB332)
# set the led brightness
# load spritesheet
# load 16 'blocks' of 8x8 sprites to fill a 32x32 grid with a single frame
for i in range(0, 4):
    for j in range(0,4):
        graphics.sprite(i, j, i*8, j*8)

This code produces no output on cosmic unicorn. By contrast, similar code works on the Pico Display Pack:

from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_RGB332
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2,pen_type=PEN_RGB332)
# set the display backlight
# load spritesheet of 128x128 pixels
# set scale for higher pixel count displays
scale = 8
# fill 32x32 pixels with 16 8x8 pixel "blocks" from the spritesheet
# to create one "frame";
for i in range(0,4):
    for j in range(0,4):
            display.sprite(i, j, (i)*8*scale, (j)*8*scale, scale)

Is there a better approach for generating animations on the cosmic unicorn that I should explore instead?

For anyone interested in this issue, you can accomplish similar functionality on the cosmic unicorn with the PNGdec module, described in these Pimoroni-brand Micropython release notes - Release Version 1.20.4 · pimoroni/pimoroni-pico · GitHub. I filed a pull request to add these notes to the main Pico Graphics function reference.

I never did find a way to get the spirtesheet functionality working on the cosmic unicorn - I am not sure if that is because it is unsupported on that hardware, or just an oversight of mine!

1 Like

Phil Howard @gadgetoid may be the guy to talk too.
I’m thinking it’s due to the RGB LED controller? And how the LED’s are addressed and written too. I’m far from any expert on it though.
One option is to post it as a feature request or issue on Github.
pimoroni/pimoroni-pico: Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython. (github.com)