Colour Changing in Images - fastest way?

BlitzMax Forums/BlitzMax Programming/Colour Changing in Images - fastest way?

In my opinion recoloring them before the start (so only once per match) should be faster than "setcolor drawimagepart setcolor drawnextimage"-methods...

The first method just uses CPU and RAM, the second may also depend on vram - which could slow down the fps-rate on grandpa-graphic cards.

In my game I just made some functions to colorize the grey parts in images/pixmaps/animimages. To combine different things like "base figure" + weapon or so, you can write a function "drawImageToPixmap" and then combine the basefigure and the weapon/extra to an individual player-sprite.
(you can also use this to place items on bigger backgroundsprites to minimize drawing-commands for small items no longer needed to be drawn).

This would not produce small lags and for only being done during the creation-period of a new match (and only if the colors changed) you would gain a hit in efficiency.

Using a combination of "precoloring" and "painting on pixmaps" gave me nearly a 10% improvement on fps.

You may also save memory if you free unneeded small sprites if you know that they won't be used again up to the next start of the application (I just separated small plants from the background to position them a bit randomly - and the plants have also random colors for the flowers or fruits and so on).



I know this may not be one of the answers you wanted to read, but it's a kind of opinion ;D.


bye
MB