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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -