/**
  * Generates circles.
  * @param bool $createBreakCircle
  */
 private function generateCircle($createBreakCircle)
 {
     $min = $this->config->getCircleSize() / 2;
     $this->x = $this->getRandomX($min);
     $this->y = $this->getRandomY($min);
     if (true === $createBreakCircle) {
         $start = 0;
         $end = 360;
     } else {
         // decrease probability of clicking x times same place and hit correct one.
         $this->moveAwayFromLastClick($min);
         // save circle position
         $this->post->save($this->x, $this->y, $min);
         // "move" cut circle
         $z1 = mt_rand(-340, 0);
         $z1_left = 340 + $z1;
         $z2 = mt_rand(0, 340);
         $z2_left = 340 - $z2;
         $z2 += $z1_left;
         $z1 -= $z2_left;
         $start = $z1;
         $end = $z2;
     }
     $this->draw->arc($this->imagine->getPoint($this->x, $this->y), $this->imagine->getBox($this->config->getCircleSize(), $this->config->getCircleSize()), $start, $end, $this->imagine->getRGB()->color($this->config->getCircleColor()));
 }
Beispiel #2
0
 /**
  * @param \Imagine\Draw\DrawerInterface $drawer
  * @param array $commandOptions
  * @return \Imagine\Draw\DrawerInterface
  */
 protected function drawText(\Imagine\Draw\DrawerInterface $drawer, array $commandOptions)
 {
     $string = $commandOptions['string'];
     $font = $this->parseFont($commandOptions['font']);
     $position = $this->parsePoint($commandOptions['position']);
     $angle = (int) $commandOptions['angle'];
     return $drawer->text($string, $font, $position, $angle);
 }