Fix PHP's blend colour block.

This commit is contained in:
Neil Fraser
2015-06-04 15:41:09 -07:00
parent c95865a181
commit 760d203c06
2 changed files with 8 additions and 8 deletions

View File

@@ -84,12 +84,12 @@ Blockly.PHP['colour_blend'] = function(block) {
[ 'function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
'($c1, $c2, $ratio) {',
' $ratio = max(min($ratio, 1), 0);',
' $r1 = hexdec(substr($c1,0,2));',
' $g1 = hexdec(substr($c1,2,2));',
' $b1 = hexdec(substr($c1,4,2));',
' $r2 = hexdec(substr($c2,0,2));',
' $g2 = hexdec(substr($c2,2,2));',
' $b2 = hexdec(substr($c2,4,2));',
' $r1 = hexdec(substr($c1, 1, 2));',
' $g1 = hexdec(substr($c1, 3, 2));',
' $b1 = hexdec(substr($c1, 5, 2));',
' $r2 = hexdec(substr($c2, 1, 2));',
' $g2 = hexdec(substr($c2, 3, 2));',
' $b2 = hexdec(substr($c2, 5, 2));',
' $r = round($r1 * (1 - $ratio) + $r2 * $ratio);',
' $g = round($g1 * (1 - $ratio) + $g2 * $ratio);',
' $b = round($b1 * (1 - $ratio) + $b2 * $ratio);',