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

        $lineNum = $height / 10;

        for ($i = 0; $i <= $lineNum; $i++) {
            $resColor = $this->option['color'] ?
                imagecolorallocate(
                    $resImage,
                    $this->mtRand(0, 255),
                    $this->mtRand(0, 255),
                    $this->mtRand(0, 255)
                ) :
                imagecolorallocate(
                    $resImage,
                    $this->fontColor[0],
                    $this->fontColor[1],
                    $this->fontColor[2]
                );

            $x = $this->mtRand(0, $width);
            $y = $this->mtRand(0, $height);

            if (mt_rand(0, 1)) {
                imagearc(
                    $resImage,
                    $x,
                    $y,
                    $this->mtRand(0, $width),
                    $this->mtRand(0, $height),
                    $this->mtRand(0, 360),
                    $this->mtRand(0, 360),
                    $resColor
                );
            } else {
                imageline(
                    $resImage,
                    $x,
                    $y,
                    0 + $this->mtRand(0, 0),
                    0 + $this->mtRand(0, $this->mtRand($height, $width)),
                    $resColor
                );
            }
        }
    }
protected function makeAdulterate(&$resImage): void
    {
        $width = $this->normalizeWidth();
        $height = $this->normalizeHeight();

        $lineNum = $height / 10;

        for ($i = 0; $i <= $lineNum; $i++) {
            $resColor = $this->option['color'] ?
                imagecolorallocate(
                    $resImage,
                    $this->mtRand(0, 255),
                    $this->mtRand(0, 255),
                    $this->mtRand(0, 255)
                ) :
                imagecolorallocate(
                    $resImage,
                    $this->fontColor[0],
                    $this->fontColor[1],
                    $this->fontColor[2]
                );

            $x = $this->mtRand(0, $width);
            $y = $this->mtRand(0, $height);

            if (mt_rand(0, 1)) {
                imagearc(
                    $resImage,
                    $x,
                    $y,
                    $this->mtRand(0, $width),
                    $this->mtRand(0, $height),
                    $this->mtRand(0, 360),
                    $this->mtRand(0, 360),
                    $resColor
                );
            } else {
                imageline(
                    $resImage,
                    $x,
                    $y,
                    0 + $this->mtRand(0, 0),
                    0 + $this->mtRand(0, $this->mtRand($height, $width)),
                    $resColor
                );
            }
        }
    }
创建随机背景图形.

@param resource $resImage