Вход Регистрация
Файл: vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPolygonModifier.php
Строк: 52
<?php

declare(strict_types=1);

namespace 
InterventionImageDriversGdModifiers;

use 
RuntimeException;
use 
InterventionImageInterfacesImageInterface;
use 
InterventionImageInterfacesSpecializedInterface;
use 
InterventionImageModifiersDrawPolygonModifier as ModifiersDrawPolygonModifier;

class 
DrawPolygonModifier extends ModifiersDrawPolygonModifier implements SpecializedInterface
{
    
/**
     * {@inheritdoc}
     *
     * @see ModifierInterface::apply()
     * @throws RuntimeException
     */
    
public function apply(ImageInterface $image): ImageInterface
    
{
        foreach (
$image as $frame) {
            if (
$this->drawable->hasBackgroundColor()) {
                
imagealphablending($frame->native(), true);
                
imagesetthickness($frame->native(), 0);
                
imagefilledpolygon(
                    
$frame->native(),
                    
$this->drawable->toArray(),
                    
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
                        
$this->backgroundColor()
                    )
                );
            }

            if (
$this->drawable->hasBorder()) {
                
imagealphablending($frame->native(), true);
                
imagesetthickness($frame->native(), $this->drawable->borderSize());
                
imagepolygon(
                    
$frame->native(),
                    
$this->drawable->toArray(),
                    
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
                        
$this->borderColor()
                    )
                );
            }
        }

        return 
$image;
    }
}
Онлайн: 0
Реклама