css - Why is the alpha value represented as a float? -



css - Why is the alpha value represented as a float? -

is there particular reason why rgba colors represented 3 8-bit color values , 1 poorly defined floating point value?

i mean, in end, alpha value translate binary. right? don't point in having 3 well-defined values, , 1 can guess how accurate is.

for instance, if utilize value 0.1 - end result really be?

alpha percentage (0.1 alpha = 10% opacity) , it's mutual specify percentage in floats since more precise.

if used integer percent representation specify (int)10 = 10%. works fine numbers, reason want exact, 10,3%. in integer? 103 confused 103%.

the point floats can specify percentage precisely, while ints cant. thus, percentage values represented floats. ex:

0% = 0.0f

105% = 1.05f

74,31985% = 0.7431985f

etc.

even though of doesn't become problem in case of alpha color, it's practice create percentage-representations floats.

css rgba

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -