Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class CellBackgroundDrawer extends BackgroundDrawer
00016 {
00017 private $step = null;
00018
00019 public function __construct($step)
00020 {
00021 $this->step = $step;
00022 }
00023
00027 public function draw()
00028 {
00029 $x = mt_rand(-$this->step, $this->step);
00030 $width = $this->getTuringImage()->getWidth();
00031
00032 while ($x < $width) {
00033 $color = $this->makeColor();
00034 $colorId = $this->getTuringImage()->getColorIdentifier($color);
00035
00036 imageline(
00037 $this->getTuringImage()->getImageId(),
00038 $x,
00039 0,
00040 $x,
00041 $this->getTuringImage()->getHeight(),
00042 $colorId
00043 );
00044
00045 $x += $this->step;
00046 }
00047
00048 $y = mt_rand(-$this->step, $this->step);
00049 $height = $this->getTuringImage()->getHeight();
00050
00051 while ($y < $height) {
00052 $color = $this->makeColor();
00053 $colorId = $this->getTuringImage()->getColorIdentifier($color);
00054
00055 imageline(
00056 $this->getTuringImage()->getImageId(),
00057 0,
00058 $y,
00059 $this->getTuringImage()->getWidth(),
00060 $y,
00061 $colorId
00062 );
00063
00064 $y += $this->step;
00065 }
00066
00067 return $this;
00068 }
00069 }
00070 ?>