I have never used a plugin that loads images into memblocks from zip files.
However I can probably give you the information that you need.
For a game I've been working on I texture characters with their skin. I then lay a clothing texture down on top of that. This allows for many different skin types and clothing without exponential numbers of textures.
This is done by taking the skin texture and merging the partially transparent clothing texture down on top of it into a single dbpro image.
The following function does this merging process.
However it also demonstrates 2 important things. How to create an image from a memblock and how to do it where it generates new mipmaps.
function Media_MergeImage(imageOne, imageTwo)
If imageOne < 1 then ExitFunction
If Image Exist(imageOne) = 0 then ExitFunction
If imageTwo < 1 then ExitFunction
If Image Exist(imageTwo) = 0 then ExitFunction
`Find unused memblocks
Memblock1 = 1
repeat
inc Memblock1
until memblock exist(Memblock1) = 0
Memblock2 = 2
repeat
inc Memblock2
until memblock exist(Memblock2) = 0
Memblock3 = 3
repeat
inc Memblock3
until memblock exist(Memblock3) = 0
`Set up variables
Width as Dword
Height as Dword
Depth as Dword
Red as Byte
Green as Byte
Blue as Byte
Alpha as Byte
`Do it!
make memblock from image Memblock1, imageOne
Width = memblock dword(Memblock1,0)
Height = memblock dword(Memblock1,4)
Depth = memblock dword(Memblock1,8)
make memblock from image Memblock2, imageTwo
Width2 = memblock dword(Memblock2,0)
Height2 = memblock dword(Memblock2,4)
Make Memblock Memblock3, GET MEMBLOCK SIZE(Memblock1)
If Width = 0 then ExitFunction
If Width2 = 0 then ExitFunction
If Height = 0 then ExitFunction
If Height2 = 0 then ExitFunction
w1# = Width
w2# = Width2
h1# = Height
h2# = Height2
xMod# = w2# / w1#
yMod# = h2# / h1#
Position = 12 `skip header
`Copy The header off of Image one onto the final Image.
For i = 0 to Position
write memblock Dword Memblock3, i, memblock byte(Memblock1, i)
Next i
mCounter = 1
for y = 1 to Height `Height
for x = 1 to Width`Width
xPos = (x * xMod#)
yPos = (y * yMod#)
If xPos > Width2 then xPos = Width2
If yPos > Height2 then yPos = Height2
If xPos < 1 then xPos = 1
If yPos < 1 then yPos = 1
mPosition = int((((yPos - 1) * Width2) * 4) + ((xPos - 1) * 4) + 12)
Alpha = memblock byte(Memblock1, Position+3)
Blue = memblock byte(Memblock1,Position)
Green = memblock byte(Memblock1,Position+1)
Red = memblock byte(Memblock1,Position+2)
oAlpha = memblock byte(Memblock2, mPosition+3)
oBlue = memblock byte(Memblock2,mPosition)
oGreen = memblock byte(Memblock2,mPosition+1)
oRed = memblock byte(Memblock2,mPosition+2)
`oAlpha = Int(oAlpha * alphaTwo#)
If oAlpha > 0
Blue = Blue + ((oAlpha * (oBlue - Blue)) / 255.0)
Green = Green + ((oAlpha * (oGreen - Green)) / 255.0)
Red = Red + ((oAlpha * (oRed - Red)) / 255.0)
Alpha = 255 `Alpha + oAlpha `Override Alpha to be completely opaque
EndIf
newCol = (Alpha << 24) + (Red << 16) + (Green << 8) + Blue `//argb
write memblock Dword Memblock3,Position, newCol
inc Position,4
next x
next y
Delete Image imageOne
make image from memblock ImageOne,Memblock3
delete memblock Memblock1
delete memblock Memblock2
delete memblock Memblock3
endfunction
The key parts in this I am moving the data into a third memblock not created by
make memblock from image and I am deleting the first image rather than relying on
make image from memblock to overwrite it itself.
Before I implemented these details what was happening was the merged clothed texture was overwriting the first image (originally just the body/skin) and the original mipmaps remained.
This caused people to look naked at a distance, forcing me to turn off mipmapping.