What happens when the result of (m*x+b) is negative? The result of the casting will be all kinds of whack, no? Do we want to enforce clipping to zero and 255 for the sake of the valid color range?