Skip to content

Instantly share code, notes, and snippets.

@oscarcs
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarcs/4fc7df646f6d10b9a5d7 to your computer and use it in GitHub Desktop.
Save oscarcs/4fc7df646f6d10b9a5d7 to your computer and use it in GitHub Desktop.
Testing color blind functions with HaxeFlixel / OpenFL and nxColor
var ishihara = new FlxSprite(0, 0, "assets/ishihara2.png");
for (x in 0...Std.int(ishihara.width))
{
for (y in 0...Std.int(ishihara.height))
{
var cur = ishihara.framePixels.getPixel(x, y);
var cs = StringTools.hex(cur, 6);
var r = Std.parseInt("0x" + cs.substr(0, 2));
var g = Std.parseInt("0x" + cs.substr(2, 2));
var b = Std.parseInt("0x" + cs.substr(4, 2));
var conv:RGB = new RGB(r, g, b);
var colorblind:RGB = Util.testGreenBlindness(conv);
ishihara.framePixels.setPixel(x, y, colorblind.toNumber());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment