Skip to content

Commit

Permalink
Revert "Getting applyMask to work"
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron committed Feb 9, 2017
1 parent 6178ee8 commit 7bf4e4a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Imagine/Gd/Image.php
Expand Up @@ -461,8 +461,7 @@ public function applyMask(ImageInterface $mask)
$position = new Point($x, $y);
$color = $this->getColorAt($position);
$maskColor = $mask->getColorAt($position);
$blackAmount = 1 - ($maskColor->getValue(ColorInterface::COLOR_RED) + $maskColor->getValue(ColorInterface::COLOR_GREEN) + $maskColor->getValue(ColorInterface::COLOR_BLUE)) / 3 / 255;
$round = (int) round($color->getAlpha() * $blackAmount);
$round = (int) round(max($color->getAlpha(), (100 - $color->getAlpha()) * $maskColor->getRed() / 255));

if (false === imagesetpixel($this->resource, $x, $y, $this->getColor($color->dissolve($round - $color->getAlpha())))) {
throw new RuntimeException('Apply mask operation failed');
Expand Down

0 comments on commit 7bf4e4a

Please sign in to comment.