PixelCommand.php 651 B

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