Package colorblind
Class ColorUtilities
java.lang.Object
colorblind.ColorUtilities
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic floatapplyGammaCorrection(float s, float gamma) Apply Gamma Correctionstatic floatapplyGammaCorrectionStandardRGB(float s) Apply Standard Gamma Correctionstatic floatclip(float x) Simple utility function that is used in a couple of places.static floatclip(float x, float min, float max) Simple utility function that is used in a couple of places.static intconfusingDeuteranopiaColor(int color, float x) static intconfusingDichromaticColor(Deficiency colorBlindness, int color, float x) Intentionally generate colors that would be confusing to a colorblind person.static intconfusingMonochromaticColor(Deficiency colorBlindness, int color, float x1, float x2) Intentionally generate colors that would be confusing to someone with monochromatic vision.static intconfusingProtanopiaColor(int color, float x) static intconfusingTritanopiaColor(int color, float x) static VectorconvertLinearRGB2LMS(Vector rgbColor) static intconvertLinearRGB2PColor(Vector rgbColor) static VectorconvertLMS2LinearRGB(Vector lmsColor) static intconvertLMS2PColor(Vector lmsColor) static VectorconvertPColor2LinearRGB(int color) static VectorconvertPColor2LMS(int color) static floatlmsFeasibleBisectionSearch(Vector lms, int index, int direction) Search the LMS color space for the feasibility edge.static floatremoveGammaCorrection(float s, float gamma) Remove Gamma Correctionstatic floatremoveGammaCorrectionStandardRGB(float s) Remove Standard Gamma Correction
- 
Field Details- 
protanopiaSim
- 
deuteranopiaSim
- 
tritanopiaSim
- 
achromatopsiaSim
- 
blueConeMonochromacySim
- 
customSim
- 
shiftTowardsVisible
- 
rgb2lms
- 
lms2rgb
 
- 
- 
Constructor Details- 
ColorUtilitiespublic ColorUtilities()
 
- 
- 
Method Details- 
clippublic static float clip(float x) Simple utility function that is used in a couple of places.- Parameters:
- x-
- Returns:
- x constrained to [0, 1]
 
- 
clippublic static float clip(float x, float min, float max) Simple utility function that is used in a couple of places.- Parameters:
- x-
- min-
- max-
- Returns:
- x constrained to [min, max]
 
- 
applyGammaCorrectionpublic static float applyGammaCorrection(float s, float gamma) Apply Gamma Correction- Parameters:
- s- = value [0, 1]
- Returns:
 
- 
removeGammaCorrectionpublic static float removeGammaCorrection(float s, float gamma) Remove Gamma Correction- Parameters:
- s- = value [0, 1]
- Returns:
 
- 
applyGammaCorrectionStandardRGBpublic static float applyGammaCorrectionStandardRGB(float s) Apply Standard Gamma Correction- Parameters:
- s- = value [0, 1]
- Returns:
 
- 
removeGammaCorrectionStandardRGBpublic static float removeGammaCorrectionStandardRGB(float s) Remove Standard Gamma Correction- Parameters:
- s- = value [0, 1]
- Returns:
 
- 
convertLinearRGB2LMS
- 
convertLMS2LinearRGB
- 
convertPColor2LinearRGB
- 
convertPColor2LMS
- 
convertLinearRGB2PColor
- 
convertLMS2PColor
- 
confusingDichromaticColorIntentionally generate colors that would be confusing to a colorblind person. If a plot of all possible colors were a 3D space, there would be lines of colors in the 3D space that would look identical to a colorblind person. This code attempts to pick multiple colors along those lines.- Parameters:
- colorBlindness- color deficiency
- color- initial color
- x- float [0, 1]
- Returns:
- new color that is determined by x
 
- 
confusingProtanopiaColorpublic static int confusingProtanopiaColor(int color, float x) 
- 
confusingDeuteranopiaColorpublic static int confusingDeuteranopiaColor(int color, float x) 
- 
confusingTritanopiaColorpublic static int confusingTritanopiaColor(int color, float x) 
- 
lmsFeasibleBisectionSearchSearch the LMS color space for the feasibility edge. If I convert a Processing color to LMS color space, how far can I adjust one of the 3 values until it can no longer be converted back to a valid Processing color? This function answers that question. Using a bisection search, find the min or max value of one value in the lms vector that is on the edge of the range that converts back to a feasible vector in linear RGB space.- Parameters:
- lms- Vector of color in LMS space
- index- index into lms vector to change
- direction- 1 or -1 to search in bigger or smaller direction
- Returns:
- feasible value on edge of feasibility
 
- 
confusingMonochromaticColorpublic static int confusingMonochromaticColor(Deficiency colorBlindness, int color, float x1, float x2) Intentionally generate colors that would be confusing to someone with monochromatic vision. If a plot of all possible colors were a 3D space, there would be planes of colors in the 3D space that would look identical to a monochromat person. This code attempts to pick multiple colors on those planes.- Parameters:
- color- initial color
- x1- float [0, 1]
- x2- float [0, 1]
- Returns:
- new color that is determined by x1 and x2
 
 
-