18
Vote

GetBitmap function

description

This is somewhat related to graphics optimization issue created before. This would be great for our customer needs.
 
Why does Bitmap.GetBitmap() returns 32bpp but NETMF is actually 16bpp? If you have xx megabyte of RAM then this is no problem but on very small devices this is a problem.
 
Here is an example: On FEZ Cerberus http://www.ghielectronics.com/catalog/product/349, we are trying to draw to a 128x128 SPI display http://www.ghielectronics.com/catalog/product/343 thanks to modern chips, we have a decentheap.
 
To flush the display on SPI, we need to Bitmap.GetBytes() and then send the data over SPI. The problem is that the code tries to allocate 64K because it assumes 4 bytes per pixel and this basically fails. If the GetBuytes returned 16bpp then things would have worked perfectly. We now flush half the display(128x64) and then flush the other half after!
 
So what we like to see is Bitmap.GetBytes16bpp(); and also Bitmap.GetBytes1bpp(). The later one is perfect for SPI monochrome displays. If we also see Btmap.GetBytes8bit() that would also be fantastic but this is not required.

comments

juliusfriedman wrote May 25, 2012 at 4:34 PM

Why not just an Extension GetBytes(this Bitmap bitLength) { ... }