I'm using SDK 2.0.1, and everything below was tested only in the Simulator, running in Windows 11 with Visual Studio 2022.
I created a 73x55 1bpp png, loaded it via graphics->loadBitmap()
, and then called getBitmapData()
on it, it said the rowbytes
was 10, which makes sense (73 / 8 = 9.125, so you'd need at least 10 bytes per line).
Then I called newBitmap(73, 55, kColorWhite)
, but when I retrieved its rowbytes
, it was 12. This messed up some other code I had written that naively tried to memcpy the image data from the loaded image to the new bitmap.
I ended up switching from newBitmap to copyBitmap, which created an LCDBitmap with the same rowbytes of 10 as the original.
So I'm just curious why newBitmap does that. Is it padding out on purpose (maybe to hit DWORD alignment? but then why doesn't it matter that my loaded bitmap isn't DWORD aligned?)