Esempio n. 1
0
 /**
  * @param resource $resource
  * @param int $width
  * @param int $height
  */
 private function __construct($resource, $width, $height)
 {
     $this->resource = $resource;
     $this->width = $width;
     $this->height = $height;
     $this->lastCoords = new Coords(0, 0);
     $this->backgroundColor = Color::createWhite();
 }
Esempio n. 2
0
 /**
  * @param $color
  * @return $this
  */
 public function colorify($color)
 {
     $this->checkFinalized();
     $color = Color::parse($color);
     $this->red($color->getRed());
     $this->green($color->getGreen());
     $this->blue($color->getBlue());
     $this->alpha($color->getAlpha());
     return $this;
 }
Esempio n. 3
0
 /**
  * @param $color
  * @return $this
  * @throws \Exception
  */
 public function fill($color)
 {
     $this->checkFinalized();
     $command = new Command(__TRAIT__, function (Command $command) {
         return ' -fill "' . $command->color->getHEXAString() . '"';
     });
     $command->color = Color::parse($color);
     $this->addCommand($command);
     return $this;
 }
Esempio n. 4
0
 /**
  * @param string $background
  * @return $this
  */
 public function background($background = 'none')
 {
     $this->checkFinalized();
     $command = new Command(__TRAIT__, function (Command $command) {
         return ' -background ' . ($command->background->isNone() ? 'none' : '"' . $command->background->getHEXAString() . '"');
     });
     $command->background = Color::parse($background);
     $this->addCommand($command);
     return $this;
 }
Esempio n. 5
0
 /**
  * @param $width
  * @param $height
  * @param string $background
  * @return $this
  * @throws \Exception
  */
 public function create($width, $height, $background = 'none')
 {
     $this->checkFinalized();
     $command = new Command(__TRAIT__, function (Command $command) {
         return ' -size ' . $command->width . 'x' . $command->height . ' xc:' . ($command->background->isNone() ? 'none' : '"' . $command->background->getHEXAString() . '"');
     });
     $command->width = $width;
     $command->height = $height;
     $command->background = Color::parse($background);
     $this->addCommand($command);
     return $this;
 }