Hey, I'm pretty sure there's something like that in my 'image functions' library. See my signature.
I'll check later when I'm back at my PC but I think I covered that.
[Edit]
OK, I checked and it looks like I didn't include that.
Not to worry here it is. Well two versions actually. The first one uses sprites and GetImage() and the second uses memblocks.
function CombineImages(img1, img2)
spr1 = CreateSprite(img1)
spr2 = CreateSprite(img2)
w = GetSpriteWidth(spr1)
h = GetSpriteHeight(spr2)
SetSpriteDepth(spr1, 0)
SetSpriteDepth(spr2, 0)
ClearScreen()
SetSpritePosition(spr1, 0, 0)
SetSpritePosition(spr2, 0, 0)
DrawSprite(spr1)
DrawSprite(spr2)
ret = GetImage(0, 0, w, h)
DeleteSprite(spr1)
DeleteSprite(spr2)
endfunction ret
function CombineImagesMB(img1, img2)
w = GetImageWidth(img1)
h = GetImageHeight(img1)
img3 = CopyImage(img2, 0, 0, GetImageWidth(img2), GetImageHeight(img2))
mb1 = CreateMemblockFromImage(img1)
ResizeImage(img3, w, h)
mb2 = CreateMemblockFromImage(img3)
mb3 = CreateMemblockEmptyImage(w, h)
for k = 12 to GetMemblockSize(mb1)-12 step 4
r1 = GetMemblockByte(mb1, k)
g1 = GetMemblockByte(mb1, k+1)
b1 = GetMemblockByte(mb1, k+2)
a1 = GetMemblockByte(mb1, k+3)
r2 = GetMemblockByte(mb2, k)
g2 = GetMemblockByte(mb2, k+1)
b2 = GetMemblockByte(mb2, k+2)
a2 = GetMemblockByte(mb2, k+3)
pc# = GetMemblockByte(mb2, k+3) / 255.0
SetMemblockByte(mb3, k, r1*(1-pc#)+r2*pc#)
SetMemblockByte(mb3, k+1, g1*(1-pc#)+g2*pc#)
SetMemblockByte(mb3, k+2, b1*(1-pc#)+b2*pc#)
SetMemblockByte(mb3, k+3, a1*(1-pc#)+a2*pc#)
next k
ret = CreateImageFromMemblock(mb3)
DeleteMemblock(mb1)
DeleteMemblock(mb2)
DeleteMemblock(mb3)
DeleteImage(img3)
endfunction ret
And if you don't have the rest of my image functions included then you'll also need this function:
/********** CreateMemblockEmptyImage(w, h) **************************
Description: Creates a new memblock ready to create an image and
populates the header of the memblock with the dimensions.
Parameters: w - The width of the image
h - The height of the image
Returns: mb - The memblock ID of the newly created memblock
*/
function CreateMemblockEmptyImage(w, h)
mb = CreateMemblock(w*h*4+12)
SetMemblockInt(mb, 0, w)
SetMemblockInt(mb, 4, h)
SetMemblockInt(mb, 8, 32)
endfunction mb