Last active
August 29, 2015 14:06
-
-
Save oscarcs/4fc7df646f6d10b9a5d7 to your computer and use it in GitHub Desktop.
Testing color blind functions with HaxeFlixel / OpenFL and nxColor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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