I'm developing simple application for 2D drawing with ability to use layers. I tried different platforms (.NET, Java, QT...) and I always run into the same problem. I can't understand how to store all graphic layers/images/bitmaps in memory efficiently, especially when canvas (each object that stores graphic data) size is big (Like 3000x3000 pixels or so). I suppose there's no other way but to store every layer as image/bitmap object (or any kind of color-data-array that still will consume alot of memory).
What I have already tried:
So what is the correct way to store alot of graphic objects? How do popular software like Photoshop can handle many large layers and still work fast? Does anyone know?
---- S O L U T I O N ----
Okay! Thanks to evilruff, I solved this. Looks like when I read a small needed slice of layer from cached file, memory allocation proceeds much faster than when I try to allocate the whole layer.
Here's what I did:
Works very fast and there's only one visible bitmap/image allocated in memory.
Bad side: cached file for every layer still takes hard drive's space. But nowdays that's not critical when everyone has large hard-drives.
Well it depends.. What is the nature of your drawings? Are they initially vector based (like maps, diagrams what so ever) or you work with set of raster images which you put as a set of layers?