1 | import { SVGPathDataTransformer } from "./SVGPathDataTransformer";
|
---|
2 | import { TransformFunction } from "./types";
|
---|
3 |
|
---|
4 | export abstract class TransformableSVG {
|
---|
5 | round(x?: number) {
|
---|
6 | return this.transform(SVGPathDataTransformer.ROUND(x));
|
---|
7 | }
|
---|
8 |
|
---|
9 | toAbs() {
|
---|
10 | return this.transform(SVGPathDataTransformer.TO_ABS());
|
---|
11 | }
|
---|
12 |
|
---|
13 | toRel() {
|
---|
14 | return this.transform(SVGPathDataTransformer.TO_REL());
|
---|
15 | }
|
---|
16 |
|
---|
17 | normalizeHVZ(a?: boolean, b?: boolean, c?: boolean) {
|
---|
18 | return this.transform(SVGPathDataTransformer.NORMALIZE_HVZ(a, b, c));
|
---|
19 | }
|
---|
20 |
|
---|
21 | normalizeST() {
|
---|
22 | return this.transform(SVGPathDataTransformer.NORMALIZE_ST());
|
---|
23 | }
|
---|
24 |
|
---|
25 | qtToC() {
|
---|
26 | return this.transform(SVGPathDataTransformer.QT_TO_C());
|
---|
27 | }
|
---|
28 |
|
---|
29 | aToC() {
|
---|
30 | return this.transform(SVGPathDataTransformer.A_TO_C());
|
---|
31 | }
|
---|
32 |
|
---|
33 | sanitize(eps?: number) {
|
---|
34 | return this.transform(SVGPathDataTransformer.SANITIZE(eps));
|
---|
35 | }
|
---|
36 |
|
---|
37 | translate(x: number, y?: number) {
|
---|
38 | return this.transform(SVGPathDataTransformer.TRANSLATE(x, y));
|
---|
39 | }
|
---|
40 |
|
---|
41 | scale(x: number, y?: number) {
|
---|
42 | return this.transform(SVGPathDataTransformer.SCALE(x, y));
|
---|
43 | }
|
---|
44 |
|
---|
45 | rotate(a: number, x?: number, y?: number) {
|
---|
46 | return this.transform(SVGPathDataTransformer.ROTATE(a, x, y));
|
---|
47 | }
|
---|
48 |
|
---|
49 | matrix(a: number, b: number, c: number, d: number, e: number, f: number) {
|
---|
50 | return this.transform(SVGPathDataTransformer.MATRIX(a, b, c, d, e, f));
|
---|
51 | }
|
---|
52 |
|
---|
53 | skewX(a: number) {
|
---|
54 | return this.transform(SVGPathDataTransformer.SKEW_X(a));
|
---|
55 | }
|
---|
56 |
|
---|
57 | skewY(a: number) {
|
---|
58 | return this.transform(SVGPathDataTransformer.SKEW_Y(a));
|
---|
59 | }
|
---|
60 |
|
---|
61 | xSymmetry(xOffset?: number) {
|
---|
62 | return this.transform(SVGPathDataTransformer.X_AXIS_SYMMETRY(xOffset));
|
---|
63 | }
|
---|
64 |
|
---|
65 | ySymmetry(yOffset?: number) {
|
---|
66 | return this.transform(SVGPathDataTransformer.Y_AXIS_SYMMETRY(yOffset));
|
---|
67 | }
|
---|
68 |
|
---|
69 | annotateArcs() {
|
---|
70 | return this.transform(SVGPathDataTransformer.ANNOTATE_ARCS());
|
---|
71 | }
|
---|
72 |
|
---|
73 | abstract transform(transformFunction: TransformFunction): this;
|
---|
74 | }
|
---|