Soft light blending mode added.

This commit is contained in:
Rubens Mariuzzo
2012-01-24 21:20:10 -04:00
committed by Luke Page
parent 6696368eb3
commit 6e97b8f694
3 changed files with 19 additions and 0 deletions

View File

@@ -237,6 +237,18 @@ tree.functions = {
},
_isa: function (n, Type) {
return (n instanceof Type) ? tree.True : tree.False;
},
/* Blending modes */
softlight: function(color1, color2) {
var t = color2.rgb[0] * color1.rgb[0] / 255;
var r = t + color1.rgb[0] * (255 - (255 - color1.rgb[0]) * (255 - color2.rgb[0]) / 255 - t) / 255;
t = color2.rgb[1] * color1.rgb[1] / 255;
var g = t + color1.rgb[1] * (255 - (255 - color1.rgb[1]) * (255 - color2.rgb[1]) / 255 - t) / 255;
t = color2.rgb[2] * color1.rgb[2] / 255;
var b = t + color1.rgb[2] * (255 - (255 - color1.rgb[2]) * (255 - color2.rgb[2]) / 255 - t) / 255;
return this.rgb(r, g, b);
}
};

View File

@@ -70,3 +70,6 @@
#alpha {
alpha: rgba(153, 94, 51, 0.6);
}
#blendmodes {
softlight: #ff0000;
}

View File

@@ -77,3 +77,7 @@
#alpha {
alpha: darken(hsla(25, 50%, 50%, 0.6), 10%);
}
#blendmodes {
softlight: softlight(#f60000, #ffffff);
}