Created
March 14, 2015 21:55
-
-
Save brunodoamaral/3b03ddd293aab96779e8 to your computer and use it in GitHub Desktop.
Java code to convert a float RGB to int RGB
This file contains hidden or 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
// Convert a float RGB to int RGB. Note: does not check for floats outside range (0..1) | |
public static int rgbFloatToInt(float r, float g, float b) { | |
return ((int) (0xff * b)) | (((int) (0xff * g)) << 8 ) | (((int) (0xff * r)) << 16 ) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment