tint a sprite, is possible?

Previous topic - Next topic

pinete

Hi all!
somebody knows the way in which I could 'tint' a sprite?
What I need it's make the whole sprite of one unique color.
Is this possible?

Wampus

There are two ways I know of. The first is possibly what you're looking for.

1) You can draw your sprite using the polyvector commands. Whenever polyvectors are used they require colour set by RGB. Setting RGB to (255,255,255) is normal full brightness and colour. Changing the RGB value will result in a tinted look, e.g. RGB of (255,0,0) will show only reds and be quite dark, whereas (255,127,127) will show reds prominently but keep some of the other colour qualities and look brighter. Experiment with it to see.

2) You can load a sprite to memory with SPRITE2MEM or LOADSPRITEMEM. Afterwards you can apply a hue shift to the sprite in a similar way to GIMP or Photoshop and return the memory to a sprite form with MEM2SPRITE. The trouble with this approach is it can be slow. It is probably far too slow for doing it in real time for each frame. However, If applied to a sprite sheet before the beginning of a new level of a game or similar scenario it works very well.

bigtunacan

The POLYVECTOR approach Wampus suggested is vertex based; so you set the tint for each corner; this allows you to get gradient affects as well by setting different corners to different RGB settings.

BdR

If by "tint" you mean change certain parts of the sprite, like the bomberman sprites or like soccer uniforms, then that can be done with SPRITE2MEM or LOADSPRITEMEM like Wumpus said.
I made a GLBasic example using SPRITE2MEM or LOADSPRITEMEM, you can download here colorize_glb.zip (487kb) or see this forum thread: sprite color change