protected function drawNoise()
    {
        if ($this->noise_level > 10) {
            $noise_level = 10;
        } else {
            $noise_level = $this->noise_level;
        }

        $t0 = microtime(true);
        $noise_level *= M_LOG2E;

        for ($x = 1; $x < $this->image_width; $x += 20) {
            for ($y = 1; $y < $this->image_height; $y += 20) {
                for ($i = 0; $i < $noise_level; ++$i) {
                    $x1 = mt_rand($x, $x + 20);
                    $y1 = mt_rand($y, $y + 20);
                    $size = mt_rand(1, 3);

                    if ($x1 - $size <= 0 && $y1 - $size <= 0) continue; // dont cover 0,0 since it is used by imagedistortedcopy
                    imagefilledarc($this->im, $x1, $y1, $size, $size, 0, mt_rand(180,360), $this->gdlinecolor, IMG_ARC_PIE);
                }
            }
        }

        $t = microtime(true) - $t0;

        /*
        // DEBUG
        imagestring($this->im, 5, 25, 30, "$t", $this->gdnoisecolor);
        header('content-type: image/png');
        imagepng($this->im);
        exit;
        */
    }
protected function drawNoise()
    {
        if ($this->noise_level > 10) {
            $noise_level = 10;
        } else {
            $noise_level = $this->noise_level;
        }

        $t0 = microtime(true);
        $noise_level *= M_LOG2E;

        for ($x = 1; $x < $this->image_width; $x += 20) {
            for ($y = 1; $y < $this->image_height; $y += 20) {
                for ($i = 0; $i < $noise_level; ++$i) {
                    $x1 = mt_rand($x, $x + 20);
                    $y1 = mt_rand($y, $y + 20);
                    $size = mt_rand(1, 3);

                    if ($x1 - $size <= 0 && $y1 - $size <= 0) continue; // dont cover 0,0 since it is used by imagedistortedcopy
                    imagefilledarc($this->im, $x1, $y1, $size, $size, 0, mt_rand(180,360), $this->gdlinecolor, IMG_ARC_PIE);
                }
            }
        }

        $t = microtime(true) - $t0;

        /*
        // DEBUG
        imagestring($this->im, 5, 25, 30, "$t", $this->gdnoisecolor);
        header('content-type: image/png');
        imagepng($this->im);
        exit;
        */
    }
protected function drawNoise ( ) { if ( $ this -> noise_level > 10 ) { $ noise_level = 10 ; } else { $ noise_level = $ this -> noise_level ; } $ t0 = microtime ( true ) ; $ noise_level *= M_LOG2E ; for ( $ x = 1 ; $ x < $ this -> image_width ; $ x += 20 ) { for ( $ y = 1 ; $ y < $ this -> image_height ; $ y += 20 ) { for ( $ i = 0 ; $ i < $ noise_level ; ++ $ i ) { $ x1 = mt_rand ( $ x , $ x + 20 ) ; $ y1 = mt_rand ( $ y , $ y + 20 ) ; $ size = mt_rand ( 1 , 3 ) ; if ( $ x1 - $ size <= 0 && $ y1 - $ size <= 0 ) continue ; // dont cover 0,0 since it is used by imagedistortedcopy imagefilledarc ( $ this -> im , $ x1 , $ y1 , $ size , $ size , 0 , mt_rand ( 180 , 360 ) , $ this -> gdlinecolor , IMG_ARC_PIE ) ; } } } $ t = microtime ( true ) - $ t0 ; /*
        // DEBUG
        imagestring($this->im, 5, 25, 30, "$t", $this->gdnoisecolor);
        header('content-type: image/png');
        imagepng($this->im);
        exit;
        */ }
Draws random noise on the image
Draws random noise on the image