src/Leevel/Seccode/Seccode.php
protected function makeBackgroundDefault(&$resImage): void
    {
        $width = $this->normalizeWidth();
        $height = $this->normalizeHeight();

        for ($i = 0; $i < 3; $i++) {
            $start[$i] = $this->mtRand(200, 255);
            $end[$i] = $this->mtRand(100, 150);
            $step[$i] = ($end[$i] - $start[$i]) / $width;
            $color[$i] = $start[$i];
        }

        for ($i = 0; $i < $width; $i++) {
            $resColor = imagecolorallocate(
                $resImage,
                (int) ($color[0]),
                (int) ($color[1]),
                (int) ($color[2])
            );

            imageline(
                $resImage,
                $i,
                0,
                $i - ($this->option['tilt'] ? $this->mtRand(-30, 30) : 0),
                $height,
                $resColor
            );

            $color[0] += $step[0];
            $color[1] += $step[1];
            $color[2] += $step[2];
        }

        $color[0] -= 20;
        $color[1] -= 20;
        $color[2] -= 20;

        $color[0] = (int) ($color[0]);
        $color[1] = (int) ($color[1]);
        $color[2] = (int) ($color[2]);

        $this->fontColor = $color;

        unset($color);
    }
protected function makeBackgroundDefault(&$resImage): void
    {
        $width = $this->normalizeWidth();
        $height = $this->normalizeHeight();

        for ($i = 0; $i < 3; $i++) {
            $start[$i] = $this->mtRand(200, 255);
            $end[$i] = $this->mtRand(100, 150);
            $step[$i] = ($end[$i] - $start[$i]) / $width;
            $color[$i] = $start[$i];
        }

        for ($i = 0; $i < $width; $i++) {
            $resColor = imagecolorallocate(
                $resImage,
                (int) ($color[0]),
                (int) ($color[1]),
                (int) ($color[2])
            );

            imageline(
                $resImage,
                $i,
                0,
                $i - ($this->option['tilt'] ? $this->mtRand(-30, 30) : 0),
                $height,
                $resColor
            );

            $color[0] += $step[0];
            $color[1] += $step[1];
            $color[2] += $step[2];
        }

        $color[0] -= 20;
        $color[1] -= 20;
        $color[2] -= 20;

        $color[0] = (int) ($color[0]);
        $color[1] = (int) ($color[1]);
        $color[2] = (int) ($color[2]);

        $this->fontColor = $color;

        unset($color);
    }
创建默认背景图像.

@param resource $resImage