コード例 #1
0
ファイル: Grayscale.php プロジェクト: sergiimazurok/koziuck
 public function __construct()
 {
     parent::__construct(function (ImageInterface $image, Point $point) {
         $color = $image->getColorAt($point);
         $image->draw()->dot($point, $color->grayscale());
     });
 }
コード例 #2
0
ファイル: Grayscale.php プロジェクト: noorafree/makmakan
 public function __construct()
 {
     parent::__construct(function (ImageInterface $image, Point $point) {
         $color = $image->getColorAt($point);
         $gray = min(255, round(($color->getRed() + $color->getBlue() + $color->getGreen()) / 3));
         $image->draw()->dot($point, new Color(array('red' => $gray, 'green' => $gray, 'blue' => $gray)));
     });
 }