[Plugin] Bitmap manipulation for images before they get into the GPU
It would be awesome to have means of manipulating an image (bitmap) BEFORE it goes into GPU. So a plugin, where images are stored in binary form (C arrays, faster than lua tables) and we can read and change their data. Then use such inmemory image with display.newImage, graphics.newImageSheet and etc. One way of implementing this is to define filename schema. For example
display.newImage(‘ram/inmemory.png’), where ‘ram’ (or ‘ram://’) is a special string, representing that it should load image from memory. And each inmemory image would have a name ‘inmemory.png’ or ‘whatever.jpg’ which are assigned to them by means of such plugin.
Well, it would be not entirely a plugin, because loading from memory is going to be implemented in the core, but all image manipulation code is good to have outside the core.
Another way to load from memory would be passing userdata instead of string filenames.
Think about OpenCV, PythonImageLibrary, GD library, Adobe Generic Image Library, FreeImage and others.
That would be super useful.
The reason for such idea is that you simply can't edit a bitmap efficiently once it is in the GPU. So instead, we would just edit images before they get into GPU. That way it's much more efficient.