36 lines
912 B
PHP
36 lines
912 B
PHP
<?php
|
|
|
|
namespace swf2ass\ass;
|
|
|
|
use swf2ass\Constants;
|
|
use swf2ass\MatrixTransform;
|
|
use swf2ass\StyleRecord;
|
|
use swf2ass\Vector2;
|
|
|
|
class shearingTag implements ASSPositioningTag {
|
|
|
|
private Vector2 $shear;
|
|
|
|
public function __construct(Vector2 $shear) {
|
|
$this->shear = $shear;
|
|
}
|
|
|
|
public function transitionMatrixTransform(MatrixTransform $transform): ?shearingTag {
|
|
return self::fromMatrixTransform($transform);
|
|
}
|
|
|
|
public function encode(): string {
|
|
return "\\fax{$this->shear->x}\\fay{$this->shear->y}";
|
|
}
|
|
|
|
public function equals(ASSTag $tag): bool {
|
|
return $tag instanceof $this and $this->shear->equals($tag->shear);
|
|
}
|
|
|
|
public static function fromMatrixTransform(MatrixTransform $transform): ?shearingTag {
|
|
$skew = $transform->getRotateSkew();
|
|
//TODO? maybe have to split this
|
|
|
|
return new shearingTag($skew);
|
|
}
|
|
} |