I am trying to make a new TBitmap32 object:
Bmp32 := TBitmap32.Create;
Bmp32.SetSize(20000,20000);
and I get error: "Can't allocate the DIB handle"
How can I fix this problem? 20K x 20K bitmap is not that big. It's smaller than 1.5 GB.
This is a limit of the underlying GDI interface and there is not much you can do (it tends to differ from OS to OS as far as I remember).
This said, not everything is lost as you can create the bitmap with a TMemoryBackend or TMMFBackend (both defined in GR32_Backends_Generic) or you can try the TGDIMemoryBackend, which is essentially a TMemoryBackend, but still allows to draw the bitmap on the screen (whereas the other backends do not offer this directly).
To create a bitmap with a different backend you only need to pass the backend class as parameter like this:
BigBitmap := TBitmap32.Create(TMemoryBackend)
or
BigBitmap := TBitmap32.Create(TGDIMemoryBackend)
Eventually you have to keep your image stored in a non-visual memory bitmap and just copy the visual part onto the screen. It's a bit ugly, but you don't rely on the GDI anymore, which is even more ugly as you never know whether it works on your clients' machines.