CellBackgroundDrawer.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2004-2007 by Dmitry E. Demidov                          *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: CellBackgroundDrawer.class.php 4687 2007-12-09 18:57:18Z voxus $ */
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 ?>

Generated on Sun Dec 9 21:56:24 2007 for onPHP by  doxygen 1.5.4