On-the-fly texture modification

BlitzMax Forums/BlitzMax Programming/On-the-fly texture modification

Tylerbot(Posted 2007) [#1]
Goal - to draw a small pixmap with alpha transparency information onto a larger, background pixmap, in order to achieve a "destroyed beauty" look over time.

Basic setup - a background tile is loaded and copied into several actual instances, to cover a non-scrolling screen at variable resolutions (ranging from 320x200 windowed to 1600x1200 fullscreen). Then, over the course of the game, the various pieces of background are modified by effects such as movement trails, explosions and others.

My difficulty - I'm using lists to keep track of specific sprite instances of the effects, but they become numerous and eventually slow down my game. I _want_ to directly draw a copy of the permanent effect sprite onto the appropriate tile instance. This would have the desired effect of potentially many background modifications with no performance hit. I'd also be able to "clean" specific areas by reloading some or all of the original tile data.

My question - how do I draw a pixmap with alpha information directly onto another pixmap efficiently? I could conceive of a pixel-by-pixel batch operation in which I loop through the pixels of the effect pixmap and subtract them (or add them, or multiply them or whatever) to the tile instance's pixmap -- but, I'd rather use a built-in method if it already exists.

What I've done so far to answer my own question - I've looked through the Blitz docs and found the TPixmap.Paste(..) but didn't think that was it. I've also searched the forums, but haven't found the answer so far.

Any suggestions appreciated!

- Tylerbot


tonyg(Posted 2007) [#2]
this *might* be what you're after and *might* be quick enough.