protected function drawLines()
    {
        for ($line = 0; $line < $this->num_lines; ++ $line) {
            $x = $this->image_width * (1 + $line) / ($this->num_lines + 1);
            $x += (0.5 - $this->frand()) * $this->image_width / $this->num_lines;
            $y = mt_rand($this->image_height * 0.1, $this->image_height * 0.9);

            $theta = ($this->frand() - 0.5) * M_PI * 0.33;
            $w = $this->image_width;
            $len = mt_rand($w * 0.4, $w * 0.7);
            $lwid = mt_rand(0, 2);

            $k = $this->frand() * 0.6 + 0.2;
            $k = $k * $k * 0.5;
            $phi = $this->frand() * 6.28;
            $step = 0.5;
            $dx = $step * cos($theta);
            $dy = $step * sin($theta);
            $n = $len / $step;
            $amp = 1.5 * $this->frand() / ($k + 5.0 / $len);
            $x0 = $x - 0.5 * $len * cos($theta);
            $y0 = $y - 0.5 * $len * sin($theta);

            $ldx = round(- $dy * $lwid);
            $ldy = round($dx * $lwid);

            for ($i = 0; $i < $n; ++ $i) {
                $x = $x0 + $i * $dx + $amp * $dy * sin($k * $i * $step + $phi);
                $y = $y0 + $i * $dy - $amp * $dx * sin($k * $i * $step + $phi);
                imagefilledrectangle($this->im, $x, $y, $x + $lwid, $y + $lwid, $this->gdlinecolor);
            }
        }
    }
protected function drawLines()
    {
        for ($line = 0; $line < $this->num_lines; ++ $line) {
            $x = $this->image_width * (1 + $line) / ($this->num_lines + 1);
            $x += (0.5 - $this->frand()) * $this->image_width / $this->num_lines;
            $y = mt_rand($this->image_height * 0.1, $this->image_height * 0.9);

            $theta = ($this->frand() - 0.5) * M_PI * 0.33;
            $w = $this->image_width;
            $len = mt_rand($w * 0.4, $w * 0.7);
            $lwid = mt_rand(0, 2);

            $k = $this->frand() * 0.6 + 0.2;
            $k = $k * $k * 0.5;
            $phi = $this->frand() * 6.28;
            $step = 0.5;
            $dx = $step * cos($theta);
            $dy = $step * sin($theta);
            $n = $len / $step;
            $amp = 1.5 * $this->frand() / ($k + 5.0 / $len);
            $x0 = $x - 0.5 * $len * cos($theta);
            $y0 = $y - 0.5 * $len * sin($theta);

            $ldx = round(- $dy * $lwid);
            $ldy = round($dx * $lwid);

            for ($i = 0; $i < $n; ++ $i) {
                $x = $x0 + $i * $dx + $amp * $dy * sin($k * $i * $step + $phi);
                $y = $y0 + $i * $dy - $amp * $dx * sin($k * $i * $step + $phi);
                imagefilledrectangle($this->im, $x, $y, $x + $lwid, $y + $lwid, $this->gdlinecolor);
            }
        }
    }
protected function drawLines ( ) { for ( $ line = 0 ; $ line < $ this -> num_lines ; ++ $ line ) { $ x = $ this -> image_width * ( 1 + $ line ) / ( $ this -> num_lines + 1 ) ; $ x += ( 0.5 - $ this -> frand ( ) ) * $ this -> image_width / $ this -> num_lines ; $ y = mt_rand ( $ this -> image_height * 0.1 , $ this -> image_height * 0.9 ) ; $ theta = ( $ this -> frand ( ) - 0.5 ) * M_PI * 0.33 ; $ w = $ this -> image_width ; $ len = mt_rand ( $ w * 0.4 , $ w * 0.7 ) ; $ lwid = mt_rand ( 0 , 2 ) ; $ k = $ this -> frand ( ) * 0.6 + 0.2 ; $ k = $ k * $ k * 0.5 ; $ phi = $ this -> frand ( ) * 6.28 ; $ step = 0.5 ; $ dx = $ step * cos ( $ theta ) ; $ dy = $ step * sin ( $ theta ) ; $ n = $ len / $ step ; $ amp = 1.5 * $ this -> frand ( ) / ( $ k + 5.0 / $ len ) ; $ x0 = $ x - 0.5 * $ len * cos ( $ theta ) ; $ y0 = $ y - 0.5 * $ len * sin ( $ theta ) ; $ ldx = round ( - $ dy * $ lwid ) ; $ ldy = round ( $ dx * $ lwid ) ; for ( $ i = 0 ; $ i < $ n ; ++ $ i ) { $ x = $ x0 + $ i * $ dx + $ amp * $ dy * sin ( $ k * $ i * $ step + $ phi ) ; $ y = $ y0 + $ i * $ dy - $ amp * $ dx * sin ( $ k * $ i * $ step + $ phi ) ; imagefilledrectangle ( $ this -> im , $ x , $ y , $ x + $ lwid , $ y + $ lwid , $ this -> gdlinecolor ) ; } } }
Draws distorted lines on the image
Draws distorted lines on the image