Example #1
0
 function _GetLED($aLedIdx, $aColor = 0)
 {
     $width = $this->iLED_X * $this->iRad * 2 + ($this->iLED_X + 1) * $this->iMarg + $this->iRad;
     $height = $this->iLED_Y * $this->iRad * 2 + $this->iLED_Y * $this->iMarg + $this->iRad * 2;
     // Adjust radious for supersampling
     $rad = $this->iRad * $this->iSuperSampling;
     // Margin in between "Led" dots
     $marg = $this->iMarg * $this->iSuperSampling;
     $swidth = $width * $this->iSuperSampling;
     $sheight = $height * $this->iSuperSampling;
     $simg = new RotImage($swidth, $sheight, 0, DEFAULT_GFORMAT, false);
     $simg->SetColor($this->iColorSchema[$aColor][2]);
     $simg->FilledRectangle(0, 0, $swidth - 1, $sheight - 1);
     if (array_key_exists($aLedIdx, $this->iLEDSpec)) {
         $d = $this->iLEDSpec[$aLedIdx];
     } else {
         $d = array(0, 0, 0, 0, 0, 0, 0);
     }
     for ($r = 0; $r < 7; ++$r) {
         $dr = $d[$r];
         for ($c = 0; $c < 4; ++$c) {
             if (($dr & pow(2, 3 - $c)) !== 0) {
                 $color = $this->iColorSchema[$aColor][0];
             } else {
                 $color = $this->iColorSchema[$aColor][1];
             }
             $x = 2 * $rad * $c + $rad + ($c + 1) * $marg + $rad;
             $y = 2 * $rad * $r + $rad + ($r + 1) * $marg + $rad;
             $simg->SetColor($color);
             $simg->FilledCircle($x, $y, $rad);
         }
     }
     $img = new Image($width, $height, DEFAULT_GFORMAT, false);
     $img->Copy($simg->img, 0, 0, 0, 0, $width, $height, $swidth, $sheight);
     $simg->Destroy();
     unset($simg);
     return $img;
 }