Not sure if this is possible, but is there an automatic way using mod or something similar to automatically fix bad input values? For instance:
If r>255, then set r=255 and
if r<0, then set r=0
So basically what I ask is a smart math way to fix this and not use
if(r>255)
r=255;
if(r<0)
r=0;
source
share