slider - Inverting alpha value java -


i writing game slider controls alpha value of color. seems working fine except want invert alpha value. example if value 0 value become 255, , if value 255 become 0. unfortunately google searches turned no easy way or built in methods doing this. appreciated thanks.

do simple math :

int alphavalue = 255 - slidervalue 

for example:

when slidervalue = 0, alphavalue = 255 - 0 = 255

when slidervalue = 255, alphavalue = 255 - 255 = 0


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -