Image Pasting
BlitzMax Forums/BlitzMax Programming/Image Pasting
| ||
Hi, i was wondering if it were posssible to draw one image onto into another keeping transparent pixels transparent and other attributes like scale, alpha etc |
| ||
Hi James, Only with a render to texture function, since images are actually textures in BMAX you would have to set the target image as the Rendertarget and render the source image to it. This is possible in BMAX and technically it's quite simple, I have a module in progess to do such a thing but since Mark changed a lot of core stuff in version 1.14 I've put the project on hold. Maybe some other time. |
| ||
this might helpFunction InsertImage(src:TImage,destx:Int,desty:Int,srcFrame:Int,dest:TImage,transColor:Int=$FF000000) Local dmap:TPixmap = LockImage(dest) Local smap:TPixmap = LockImage(src,srcFrame) For Local y:Int =0 To ImageHeight(src)-1 For Local x:Int=0 To ImageWidth(src)-1 Local color:Int = ReadPixel(smap,x,y) color=(color & ($FFFFFF:Int)) | $FF000000:Int If color<>transColor Then WritePixel(dmap,x+destx,y+desty,color) EndIf Next Next UnlockImage(src,srcFrame) UnlockImage(dest) End Function |
| ||
Ok, thanks for that! |