public function getPixel($x, $y) { $y = (int) $y; $x = (int) $x; if ($x < $this->width && $y < $this->height) { return [$this->matrix[$x + $y * $this->width], $this->colors[$x + $y * $this->width]]; } else { return false; } }