For my current project I have a function in place to load and split an image into several smaller images with increasing image numbers, where "first" is the number of the first image and hor and ver tell the routine into how many pieces the image is to be split.
TempBmp and ScreenBmp are constants pointing to the appropriate bitmaps.
Function LoadMultiImage(file$, first, hor, ver)
Set Current Bitmap TempBmp
Load Image file$, first, 1
Paste Image first, 0, 0
w = Floor(Image Width(first)/hor)
h = Floor(Image Height(first)/ver)
Delete Image first
i = first-1
For y = 1 to ver
For x = 1 to hor
Inc i
Get Image i, (x-1)*w, (y-1)*h, x*w, y*h, 3
Next x
Next y
Set Current Bitmap ScreenBmp
EndFunction
This should be kind of similar to what the animated sprite loading routine does but since I need to paste the seperate images at will onto another bitmap I cannot use sprites to do this.
The routine itself works perfectly but it has one mayor setback which I don't know how to solve:
I would like to split the initial image with the same result AND keep any alphachannel-data on the imageparts intact (I am using PNG images here).
Right now I am only "cheating" on this by putting the background of the picture into the smaller pictures but this kind of makes it very unflexible.
I was thinking of memblocks but unfortunately I still need to get into memblocks