pimoroni / pimoroni-pico

Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
https://shop.pimoroni.com/collections/pico
MIT License
1.33k stars 499 forks source link

Pico Unicorn: Add get_pixel method? #818

Open top-tumble opened 1 year ago

top-tumble commented 1 year ago

Absolute novice here but really enjoying playing around with my Pico W and Unicorn (7 x 16).

Would it be possible to implement a get_pixel(x, y) method that returned [r, g, b]?

dpage commented 12 months ago

I just found myself wishing for this too.

Gadgetoid commented 10 months ago

The best way to deal with colours is check out the numpy examples and work with arrays in your desired colourspace so you've always got the colour information available.

I appreciate this is... weird (and a waste of RAM)... but setting a pixel in PicoGraphics is so fraught with complexity that there's no reasonable way we can - in all cases - return a sensible value with get_pixel since all but the RGB888 colourspace is destructive.

What's the use case for get_pixel? (I can think of a few myself, but it'd be interesting to know if we have some good reasons to justify figuring this out)