swf2ass/src/ass/colorTag.php

33 lines
852 B
PHP

<?php
namespace swf2ass\ass;
use swf2ass\Color;
use swf2ass\ColorTransform;
use swf2ass\FillStyleRecord;
use swf2ass\Gradient;
use swf2ass\StyleRecord;
use swf2ass\Utils;
abstract class colorTag implements ASSStyleTag, ASSColorTag {
protected Color $color;
public function __construct(Color $color) {
$this->color = $color;
}
public static abstract function fromStyleRecord(StyleRecord $record): ?colorTag;
public function transitionStyleRecord(StyleRecord $record): ?ASSStyleTag {
return $this::fromStyleRecord($record);
}
public function equals(ASSTag $tag): bool {
return $tag instanceof $this and $this->color->equals($tag->color);
}
public function transitionColor(ColorTransform $transform): ?colorTag {
return new $this($transform->applyToColor($this->color));
}
}