29 lines
875 B
PHP
29 lines
875 B
PHP
<?php
|
|
|
|
namespace swf2ass;
|
|
|
|
class LineRecord implements Record {
|
|
public Vector2 $start;
|
|
public Vector2 $coord;
|
|
|
|
public function __construct(Vector2 $coord, Vector2 $start) {
|
|
$this->coord = $coord;
|
|
$this->start = $start;
|
|
}
|
|
|
|
public function getStart(): Vector2 {
|
|
return $this->start;
|
|
}
|
|
|
|
public function reverse(): LineRecord {
|
|
return new LineRecord($this->start, $this->coord);
|
|
}
|
|
|
|
public static function fromXML(\DOMElement $element, Vector2 $cursor): LineRecord {
|
|
return new LineRecord($cursor->add(new Vector2((int)$element->getAttribute("x"), (int)$element->getAttribute("y"))), $cursor);
|
|
}
|
|
|
|
public function applyMatrixTransform(MatrixTransform $transform): LineRecord {
|
|
return new LineRecord($transform->applyToVector($this->coord), $transform->applyToVector($this->start));
|
|
}
|
|
} |