Created
May 1, 2012 01:39
-
-
Save tqc/2564280 to your computer and use it in GitHub Desktop.
Convert RGBA to 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
function RGBAtoRGB(r, g, b, a, r2,g2,b2){ | |
var r3 = Math.round(((1 - a) * r2) + (a * r)) | |
var g3 = Math.round(((1 - a) * g2) + (a * g)) | |
var b3 = Math.round(((1 - a) * b2) + (a * b)) | |
return "rgb("+r3+","+g3+","+b3+")"; | |
} | |
$("#result").html(RGBAtoRGB(225,110,0,0.5,255,255,255)); | |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment