23 private const Y_INDEX_MULTIPLIER = 128;
25 public function __construct(
31 public function getColor() :
Color{
return $this->color; }
33 public function getX() :
int{
return $this->x; }
35 public function getY() :
int{
return $this->y; }
41 $x = $index % self::Y_INDEX_MULTIPLIER;
42 $y = intdiv($index, self::Y_INDEX_MULTIPLIER);
44 return new self(Color::fromRGBA($color), $x, $y);
48 $out->putLInt($this->color->toRGBA());
49 $out->putLShort($this->x + ($this->y * self::Y_INDEX_MULTIPLIER));