contrast adjustment formula
factor = (259 * (contrast + 255)) / (255 * (259 - contrast))
colour = GetPixelColour(x, y)
newRed = Truncate(factor * (Red(colour) - 128) + 128)
newGreen = Truncate(factor * (Green(colour) - 128) + 128)
newBlue = Truncate(factor * (Blue(colour) - 128) + 128)
PutPixelColour(x, y) = RGB(newRed, newGreen, newBlue)