-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting applyMask to work #449
Conversation
Shouldn't the white parts of the mask stay visible and the black parts disappear ? While this seems to fix applyMask(), the mask seems to be applied backwards. The following seems more appropriate:
|
I guess I can only curse at the lack of standardisation regarding image masking. This really feels counter-intuitive. |
Found this fix really usefull, should be merged |
Does this resolve the bug that |
@@ -376,7 +376,8 @@ public function applyMask(ImageInterface $mask) | |||
$position = new Point($x, $y); | |||
$color = $this->getColorAt($position); | |||
$maskColor = $mask->getColorAt($position); | |||
$round = (int) round(max($color->getAlpha(), (100 - $color->getAlpha()) * $maskColor->getRed() / 255)); | |||
$blackAmount = 1 - ($maskColor->getValue(ColorInterface::COLOR_RED) + $maskColor->getValue(ColorInterface::COLOR_GREEN) + $maskColor->getValue(ColorInterface::COLOR_BLUE)) / 3 / 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be tested
I could not make GD\Image::applyMask() to work as described in Reflection example in http://www.slideshare.net/avalanche123/introduction-toimagine so I made some fixes.