Load PNG from memory

BlitzPlus Forums/BlitzPlus Programming/Load PNG from memory

Using DECLS, you could try to use the API commands for retrieving files from an EXE's resources (LoadResource(), LockResource(), etc..). You must use a program like ResHacker to add all the PNG files into your Blitz EXE. I think you can get a valid pointer to data, but then I don't know if you can use Blitz bank commands with it. I don't have B+ yet so I have to try (but still you'd need to code your own PNG decoder in Blitz).

Another solution is to pack the PNG files into an external DLL's resources. You call the DLL from the Blitz program and you get a pointer to the bitmap data (in Blitz, you pass a bank). Then, using a Bank2Image function you poke the bitmap data to a valid image created with Blitz. I think this is a solution that can work indeed.

The DLL should unpack and decode the PNG files into flat bitmap data. Such task could be done easily with PureBasic (it has an internal PNG decoder and a general packer).