20 public function __construct(
25 if($height < 0 or $width < 0){
26 throw new \InvalidArgumentException(
"Height and width cannot be negative");
28 if(($expected = $height * $width * 4) !== ($actual = strlen($data))){
29 throw new \InvalidArgumentException(
"Data should be exactly $expected bytes, got $actual bytes");
33 public static function fromLegacy(
string $data) :
SkinImage{
34 switch(strlen($data)){
36 return new self(32, 64, $data);
38 return new self(64, 64, $data);
40 return new self(128, 128, $data);
43 throw new \InvalidArgumentException(
"Unknown size");
46 public function getHeight() :
int{
50 public function getWidth() :
int{
54 public function getData() :
string{