I've been fighting with my rendering (http://stackoverflow.com/questions/297697/outofmemoryexception-when-creating-a-large-bitmap-in-cf-net) for a while, and I'm still looking for a good way to fix my issues.
My engine creates a single large bitmap (2x or 3x bigger than the size of the screen), and draws everything to that surface. I then draw that image onto the screen at an offset, allowing the user to scroll VERY smoothly.
This works great most of the time, but some users encounter OutOfMemoryExecptions when creating that large bitmap. I've done my homework and it appears that this is because I am creating a Device Dependant Bitmap (DDB), and on Windows Mobile all DDBs are assigned to the gwes.exe process, along with every other apps bitmaps. If that gwes.exe process takes up more than 32M, you get this exception.
I do see that Device Independent Bitmaps(DIB) are actually created in your own process space, rather than be assigned to gwes.exe. Since I have way more room before reaching 32M in my process, I thought I'd explore this possibility.
But the only way I can find to create a DIB is through creating a bitmap from a stream, like an existing file. I can't figure out any way to create one from scratch and specify that I want it to be 1280x240 with 256 colors.
Does anyone know how this can be done?