I'm hoping that someone will be able to help me with a query on images in BlitzMax.
What I want to do is create a new image and paste another onto it. The code I'm currently using I've cribbed from this forum but it seems to allow black pixels to become transparent, which I don't want. How can I adapt this code to paste a picture into a larger black picture?
Thanks in advance.
What I want to do is create a new image and paste another onto it. The code I'm currently using I've cribbed from this forum but it seems to allow black pixels to become transparent, which I don't want. How can I adapt this code to paste a picture into a larger black picture?
Function InsertImage:timage(src:TImage,destx:Int,desty:Int,srcFrame:Int,dest:TImage) Local dmap:TPixmap = LockImage(dest) Local smap:TPixmap = LockImage(src,srcFrame) For y=0 To dest.height-1 For x=0 To dest.width-1 WritePixel(dmap,x,y,$0:Int) Next Next For y:Int =0 To ImageHeight(src)-1 For x:Int=0 To ImageWidth(src)-1 color:Int = ReadPixel(smap,x,y) color=(color & ($FFFFFF:Int)) | $FF000000:Int pixX=x+destX pixY=y+desty err=0 If pixX<0 Or pixX>dest.width-1 err=1 End If If pixY<0 Or pixY>dest.height-1 err=1 End If If err=0 WritePixel(dmap,x+destx,y+desty,color) End If Next Next UnlockImage(src,srcFrame) UnlockImage(dest) Return dest End Function
Thanks in advance.