Posts Tagged ‘greyscale’

HowTo: Create hexidecimal grayscale integers

Wednesday, November 19th, 2008

This turns out to be outrageously simple. If you wanna create a grayscale somewhere between pure black and pure white all you need is this could-not-be-simpler equation:

var num:int = 1; // any int from 0 to 255
var grayscale:int = num * 65793;

All you need to ensure is that the value of ‘num’ is an integer from 0 (for pure black) to 255 (for pure white) and that’s it!