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