Removed unfinished Colour implementation.
This commit is contained in:
parent
ac2255d24d
commit
3bcb7781dd
6 changed files with 1 additions and 103 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2202.281831
|
||||
0.2301.11835
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
// Colour.php
|
||||
// Created: 2021-09-09
|
||||
// Updated: 2022-02-02
|
||||
|
||||
namespace Index;
|
||||
|
||||
abstract class Colour extends XObject {
|
||||
abstract public function getRaw(): int;
|
||||
abstract public function getRed(): int;
|
||||
abstract public function getGreen(): int;
|
||||
abstract public function getBlue(): int;
|
||||
|
||||
public function getAlpha(): float {
|
||||
return 1.0;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?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)
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
// ColourLegacy.php
|
||||
// Created: 2021-09-09
|
||||
// Updated: 2022-01-20
|
||||
|
||||
namespace Index;
|
||||
|
||||
class ColourLegacy extends ColourRGB {
|
||||
private const INHERIT = 0x40000000;
|
||||
|
||||
public function shouldInherit(): bool {
|
||||
return ($this->raw & self::INHERIT) > 0;
|
||||
}
|
||||
|
||||
public function toString(): IString {
|
||||
if($this->shouldInherit()) {
|
||||
static $inherit = null;
|
||||
if($inherit === null)
|
||||
$inherit = new AString('inherit');
|
||||
return $inherit;
|
||||
}
|
||||
|
||||
return parent::toString();
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
// ColourRGB.php
|
||||
// Created: 2021-09-09
|
||||
// Updated: 2021-09-09
|
||||
|
||||
namespace Index;
|
||||
|
||||
class ColourRGB extends Colour {
|
||||
protected int $raw;
|
||||
|
||||
public function __construct(int $raw) {
|
||||
$this->raw = $raw;
|
||||
}
|
||||
|
||||
public function getRaw(): int {
|
||||
return $this->raw;
|
||||
}
|
||||
|
||||
public function getRed(): int {
|
||||
return ($this->raw >> 16) & 0xFF;
|
||||
}
|
||||
|
||||
public function getGreen(): int {
|
||||
return ($this->raw >> 8) & 0xFF;
|
||||
}
|
||||
|
||||
public function getBlue(): int {
|
||||
return $this->raw & 0xFF;
|
||||
}
|
||||
|
||||
public function toString(): IString {
|
||||
return new AString('#' . str_pad(dechex($this->raw & 0xFFFFFF), 6, '0', STR_PAD_LEFT));
|
||||
}
|
||||
}
|
0
tools/precommit.sh
Normal file → Executable file
0
tools/precommit.sh
Normal file → Executable file
Loading…
Reference in a new issue