- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/File/Image/Gd.php
- Класс: BitrixMainFileImageGd
- Вызов: Gd::filter
public function filter(Mask $mask)
{
if ($this->resource === null)
{
return false;
}
$transparentColor = -1;
if ($this->format == FileImage::FORMAT_GIF)
{
// Process transparency for GIFs
$transparentColor = $this->getTransparentColor();
}
// Fix left top corner
$newPixel = $this->calculatePixel($mask, 0, 0);
$result = imageconvolution($this->resource, $mask->getValue(), 1, 0);
if ($result)
{
// Fix left top corner
imagealphablending($this->resource, false);
imagesetpixel($this->resource, 0, 0, $newPixel);
// restore transparency
if ($transparentColor >= 0)
{
$this->restoreTransparency($transparentColor);
}
}
return $result;
}