PixelCommand.php 670 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Intervention\Image\Gd\Commands;
  3. use Intervention\Image\Commands\AbstractCommand;
  4. use Intervention\Image\Gd\Color;
  5. class PixelCommand extends AbstractCommand
  6. {
  7. /**
  8. * Draws one pixel to a given image
  9. *
  10. * @param \Intervention\Image\Image $image
  11. * @return boolean
  12. */
  13. public function execute($image)
  14. {
  15. $color = $this->argument(0)->required()->value();
  16. $color = new Color($color);
  17. $x = $this->argument(1)->type('digit')->required()->value();
  18. $y = $this->argument(2)->type('digit')->required()->value();
  19. return imagesetpixel($image->getCore(), $x, $y, $color->getInt());
  20. }
  21. }