Codesnippets > Code Snippets

Change a sprite's hue, saturation and brightness

(1/4) > >>


The function ShiftColorValue has been improved. The calculations have been optimised and it only does the minimum  work needed to get its result. You can now also saturate and brighten the original sprite more than the original values. All round a better approach. The new routine has been attached to this post.

See my second post below on this thread for an explanation of the ShiftColorValue function

Back to OP:-


Wrote a routine to see how I could use SPRITE2MEM and MEM2SPRITE to create new sprites with different colour schemes. This sort of thing was seen a lot in the 16-bit era. Example screenshot:-

In this demo you can adjust the hue (rainbow bar), the brightness (dark to light bar) and saturation (gray to red bar) of Sagat's flesh, bandages, belt and shorts. Click 'Change' to have a look at the new sprite you've created with your settings and 'Default' to return to default  ;/

Just compile HueShiftExample.gbap to have a look.

[attachment deleted by admin]

Kitty Hello:
Wow, that's handy!

Exactly what I need.

Nice, just what we were discussing last year :-)



[0] Message Index

[#] Next page

Go to full version