index/src/ColourARGB.php

27 lines
577 B
PHP

<?php
// ColourARGB.php
// Created: 2021-09-08
// Updated: 2022-01-03
namespace Index;
class ColourARGB extends ColourRGB {
public function getAlphaRaw(): int {
return ($this->raw >> 24) & 0xFF;
}
public function getAlpha(): float {
return ((float)$this->getAlphaRaw() / 0xFF);
}
public function toString(): IString {
return new AString(sprintf(
'rgba(%d,%d,%d,%F)',
$this->getRed(),
$this->getGreen(),
$this->getBlue(),
round($this->getAlpha(), 3)
));
}
}