|
|
@ -525,11 +525,14 @@ class MatHelper{ |
|
|
|
$g = $value["g"]; |
|
|
|
$b = $value["b"]; |
|
|
|
$a = $value["a"]; |
|
|
|
$maxBrightness = 0; |
|
|
|
$brightness = 0; |
|
|
|
foreach([$r,$g,$b] as $value){ |
|
|
|
$maxBrightness = $value > $maxBrightness ? $value : $maxBrightness; |
|
|
|
$brightness = $value > $brightness ? $value : $brightness; |
|
|
|
} |
|
|
|
$gain = 0; |
|
|
|
if($brightness !== 0){ |
|
|
|
$gain = ((255-$brightness) / $brightness) * ($translucencyIntensity ** (1/2.2)); |
|
|
|
} |
|
|
|
$gain = ((255-$maxBrightness) / $maxBrightness) * ($translucencyIntensity ** (1/2.2)); |
|
|
|
$r = round(($r + $r * $gain) * (1-$translucencyIntensity)); |
|
|
|
$g = round(($g + $g * $gain) * (1-$translucencyIntensity)); |
|
|
|
$b = round(($b + $b * $gain) * (1-$translucencyIntensity)); |
|
|
|