tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
622 stars 196 forks source link

pixel: add NewImageFromBytes function #713

Closed deadprogram closed 3 weeks ago

deadprogram commented 3 weeks ago

This PR adds a new function NewImageFromBytes() to create a pixel.Image from an existing slice of bytes.

It is already being used as part of some refactoring that @conejoninja and I are doing on the badger2040 repo.

Thanks to @conejoninja for helping me debug these changes!

conejoninja commented 3 weeks ago

Thanks, merged.

In a later PR we might change the interface as proposed, but merge this now to keep things simple.

conejoninja commented 3 weeks ago

I undo this with the revert because it makes the test fails even thought the build succeeded before I merged it :thinking: