ass_transform_drawing
Transform ASS subtitle vector
Instructions
Transform a drawing and return the new path data (or write it back).
Coordinates in and out are the drawing's own scale-space units (see the module docstring); results are serialised with integer coordinates.
action and the parameters it uses:
translate dx, dy -- shift every point.
scale factor about (origin_x, origin_y); the origin
defaults to the drawing's bbox centre so it stays put.
scale_to_size dx, dy = target width/height; uniform scale
(aspect ratio kept), drawing moved into (0,0,w,h).
stretch_to_bbox dx, dy = target width/height; independent axes
(aspect ratio deliberately broken).
rotate angle_deg clockwise on screen about the origin
(bbox centre by default).
mirror axis="x" flips left/right, axis="y" top/bottom
about the origin (bbox centre by default).
center/centre_at_origin move the bbox centre to (origin_x, origin_y), default (0, 0).
reverse reverse the winding of every subpath.
flatten replace Bézier/B-spline curves with polylines.
simplify Douglas-Peucker with tolerance factor (default 1.0).
round snap coordinates to the nearest multiple of factor
(factor=1.0 = integers, the default).
in_place=True with index writes the result back into the line (after
workspace.snapshot) and returns the new line text; otherwise no document
is touched and drawing holds the new path data.
Returns {source, doc_id, index, action, drawing, bbox, size, center, centre, changed, written} (centre duplicates center).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dx | No | ||
| dy | No | ||
| axis | No | x | |
| text | No | ||
| index | No | ||
| action | No | translate | |
| doc_id | No | ||
| factor | No | ||
| in_place | No | ||
| origin_x | No | ||
| origin_y | No | ||
| angle_deg | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||