abstract-image 3.3.2 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +44 -38
  2. package/LICENSE +21 -21
  3. package/README.md +73 -73
  4. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-ellipse.js +379 -379
  5. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-group.js +123 -123
  6. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-line.js +55 -55
  7. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polygon.js +89 -89
  8. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polyline.js +79 -79
  9. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-rectangle.js +99 -99
  10. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text-growth-directions.js +135 -135
  11. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text.js +63 -63
  12. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-ellipse.js +24 -24
  13. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-empty-text.js +26 -26
  14. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-group.js +31 -31
  15. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-line.js +20 -20
  16. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-polygon.js +34 -34
  17. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-polyline.js +26 -26
  18. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-rectangle.js +20 -20
  19. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-text-growth-directions.js +59 -59
  20. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-text.js +26 -26
  21. package/package.json +4 -2
  22. package/src/__stories__/react-svg-export/example-1.stories.tsx +54 -54
  23. package/src/__stories__/svg-export/example-1.stories.tsx +42 -42
  24. package/src/exporters/__tests__/dxf2d-export-image/export-test-def.ts +11 -11
  25. package/src/exporters/__tests__/dxf2d-export-image/export.test.tsx +13 -13
  26. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-ellipse.ts +405 -405
  27. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-group.ts +166 -166
  28. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-line.ts +80 -80
  29. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polygon.ts +114 -114
  30. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polyline.ts +103 -103
  31. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-rectangle.ts +125 -125
  32. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text-growth-directions.ts +214 -214
  33. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text.ts +97 -97
  34. package/src/exporters/__tests__/eps-export-image/export-test-def.ts +11 -11
  35. package/src/exporters/__tests__/eps-export-image/export.test.tsx +13 -13
  36. package/src/exporters/__tests__/eps-export-image/test-defs/eps-ellipse.ts +50 -50
  37. package/src/exporters/__tests__/eps-export-image/test-defs/eps-empty-text.ts +60 -60
  38. package/src/exporters/__tests__/eps-export-image/test-defs/eps-group.ts +74 -74
  39. package/src/exporters/__tests__/eps-export-image/test-defs/eps-line.ts +45 -45
  40. package/src/exporters/__tests__/eps-export-image/test-defs/eps-polygon.ts +65 -65
  41. package/src/exporters/__tests__/eps-export-image/test-defs/eps-polyline.ts +58 -58
  42. package/src/exporters/__tests__/eps-export-image/test-defs/eps-rectangle.ts +46 -46
  43. package/src/exporters/__tests__/eps-export-image/test-defs/eps-text-growth-directions.ts +138 -138
  44. package/src/exporters/__tests__/eps-export-image/test-defs/eps-text.ts +60 -60
  45. package/src/exporters/__tests__/exception/png-unsupported.test.tsx +25 -25
  46. package/src/exporters/__tests__/exception/react-svg-direction-exception.test.tsx +65 -65
  47. package/src/exporters/__tests__/exception/svg-direction-exception.test.tsx +65 -65
  48. package/src/exporters/__tests__/png-export-image/export-test-def.ts +11 -11
  49. package/src/exporters/__tests__/png-export-image/export.test.tsx +13 -13
  50. package/src/exporters/__tests__/png-export-image/test-defs/png-createPNG.tsx +26 -26
  51. package/src/exporters/__tests__/react-svg-export-image/export-test-def.tsx +13 -13
  52. package/src/exporters/__tests__/react-svg-export-image/export.test.tsx +13 -13
  53. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-png.tsx +26 -26
  54. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-url.tsx +26 -26
  55. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary.tsx +25 -25
  56. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-callback.tsx +60 -60
  57. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.tsx +28 -28
  58. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-empty-text.tsx +35 -35
  59. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.tsx +44 -44
  60. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.tsx +26 -26
  61. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.tsx +32 -32
  62. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.tsx +33 -33
  63. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.tsx +27 -27
  64. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-subimage.tsx +36 -36
  65. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-bold.tsx +50 -50
  66. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-growth-directions.tsx +80 -80
  67. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-italic.tsx +65 -65
  68. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-sub.tsx +35 -35
  69. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text.tsx +35 -35
  70. package/src/exporters/__tests__/svg-export-image/export-test-def.ts +11 -11
  71. package/src/exporters/__tests__/svg-export-image/export.test.tsx +13 -13
  72. package/src/exporters/__tests__/svg-export-image/test-defs/svg-binary.tsx +25 -25
  73. package/src/exporters/__tests__/svg-export-image/test-defs/svg-ellipse.ts +27 -27
  74. package/src/exporters/__tests__/svg-export-image/test-defs/svg-empty-text.ts +34 -34
  75. package/src/exporters/__tests__/svg-export-image/test-defs/svg-group.ts +44 -44
  76. package/src/exporters/__tests__/svg-export-image/test-defs/svg-line.ts +26 -26
  77. package/src/exporters/__tests__/svg-export-image/test-defs/svg-polygon.ts +32 -32
  78. package/src/exporters/__tests__/svg-export-image/test-defs/svg-polyline.ts +33 -33
  79. package/src/exporters/__tests__/svg-export-image/test-defs/svg-rectangle.ts +27 -27
  80. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text-bold.ts +50 -50
  81. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text-growth-directions.ts +80 -80
  82. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text-italic.ts +65 -65
  83. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text.ts +35 -35
  84. package/src/exporters/dxf2d-export-image.ts +218 -218
  85. package/src/exporters/eps-export-image.ts +154 -154
  86. package/src/exporters/index.ts +3 -3
  87. package/src/exporters/png-export-image.ts +12 -12
  88. package/src/exporters/react-svg-export-image.tsx +315 -315
  89. package/src/exporters/svg-export-image.ts +309 -309
  90. package/src/index.ts +11 -11
  91. package/src/model/__tests__/color/export-test-def.ts +13 -13
  92. package/src/model/__tests__/color/export.test.tsx +14 -14
  93. package/src/model/__tests__/color/test-defs/color-from-string.ts +46 -46
  94. package/src/model/__tests__/color/test-defs/color-to-string.ts +35 -35
  95. package/src/model/__tests__/color/test-defs/color-undefined-2.ts +8 -8
  96. package/src/model/__tests__/color/test-defs/color-undefined.ts +8 -8
  97. package/src/model/abstract-image.ts +25 -25
  98. package/src/model/color.ts +52 -52
  99. package/src/model/component.ts +279 -279
  100. package/src/model/index.ts +5 -5
  101. package/src/model/point.ts +11 -11
  102. package/src/model/size.ts +11 -11
  103. package/lib/exporters/__tests__/svg-export-image.test.d.ts +0 -2
  104. package/lib/exporters/__tests__/svg-export-image.test.d.ts.map +0 -1
  105. package/lib/exporters/__tests__/svg-export-image.test.js +0 -35
  106. package/lib/exporters/__tests__/svg-export-image.test.js.map +0 -1
@@ -1,34 +1,34 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createText(
6
- AbstractImage.createPoint(10, 10),
7
- "",
8
- "Arial",
9
- 12,
10
- AbstractImage.black,
11
- "bold",
12
- 0,
13
- "center",
14
- "right",
15
- "down",
16
- 2,
17
- AbstractImage.red,
18
- false
19
- ),
20
- ];
21
- const image = AbstractImage.createAbstractImage(
22
- AbstractImage.createPoint(0, 0),
23
- AbstractImage.createSize(400, 400),
24
- AbstractImage.white,
25
- components
26
- );
27
-
28
- const svg = AbstractImage.createSVG(image);
29
-
30
- export const test: ExportTestDef = {
31
- name: "svg empty text",
32
- abstractImage: svg,
33
- expectedImage: '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"></svg>',
34
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createText(
6
+ AbstractImage.createPoint(10, 10),
7
+ "",
8
+ "Arial",
9
+ 12,
10
+ AbstractImage.black,
11
+ "bold",
12
+ 0,
13
+ "center",
14
+ "right",
15
+ "down",
16
+ 2,
17
+ AbstractImage.red,
18
+ false
19
+ ),
20
+ ];
21
+ const image = AbstractImage.createAbstractImage(
22
+ AbstractImage.createPoint(0, 0),
23
+ AbstractImage.createSize(400, 400),
24
+ AbstractImage.white,
25
+ components
26
+ );
27
+
28
+ const svg = AbstractImage.createSVG(image);
29
+
30
+ export const test: ExportTestDef = {
31
+ name: "svg empty text",
32
+ abstractImage: svg,
33
+ expectedImage: '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"></svg>',
34
+ };
@@ -1,44 +1,44 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createGroup("group", [
6
- AbstractImage.createText(
7
- AbstractImage.createPoint(200, 200),
8
- "Test",
9
- "Helvetica",
10
- 12,
11
- AbstractImage.black,
12
- "normal",
13
- 0,
14
- "center",
15
- "uniform",
16
- "uniform",
17
- 0,
18
- AbstractImage.black,
19
- false
20
- ),
21
- AbstractImage.createRectangle(
22
- AbstractImage.createPoint(10, 50),
23
- AbstractImage.createPoint(50, 60),
24
- AbstractImage.blue,
25
- 2,
26
- AbstractImage.red
27
- ),
28
- ]),
29
- ];
30
- const image = AbstractImage.createAbstractImage(
31
- AbstractImage.createPoint(0, 0),
32
- AbstractImage.createSize(400, 400),
33
- AbstractImage.white,
34
- components
35
- );
36
-
37
- const svg = AbstractImage.createSVG(image);
38
-
39
- export const test: ExportTestDef = {
40
- name: "svg group",
41
- abstractImage: svg,
42
- expectedImage:
43
- '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><g name="group"><text style="text-anchor:middle;font-size:12px;font-weight:normal;font-family:Helvetica;fill:rgb(0, 0, 0);fill-opacity:1;" transform="rotate(0 200 200)"><tspan x="200" y="206" height="12px">Test</tspan></text><rect x="10" y="50" width="40" height="10" stroke="rgb(0, 0, 255)" stroke-opacity="1" stroke-width="2" fill="rgb(255, 0, 0)" fill-opacity="1"></rect></g></svg>',
44
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createGroup("group", [
6
+ AbstractImage.createText(
7
+ AbstractImage.createPoint(200, 200),
8
+ "Test",
9
+ "Helvetica",
10
+ 12,
11
+ AbstractImage.black,
12
+ "normal",
13
+ 0,
14
+ "center",
15
+ "uniform",
16
+ "uniform",
17
+ 0,
18
+ AbstractImage.black,
19
+ false
20
+ ),
21
+ AbstractImage.createRectangle(
22
+ AbstractImage.createPoint(10, 50),
23
+ AbstractImage.createPoint(50, 60),
24
+ AbstractImage.blue,
25
+ 2,
26
+ AbstractImage.red
27
+ ),
28
+ ]),
29
+ ];
30
+ const image = AbstractImage.createAbstractImage(
31
+ AbstractImage.createPoint(0, 0),
32
+ AbstractImage.createSize(400, 400),
33
+ AbstractImage.white,
34
+ components
35
+ );
36
+
37
+ const svg = AbstractImage.createSVG(image);
38
+
39
+ export const test: ExportTestDef = {
40
+ name: "svg group",
41
+ abstractImage: svg,
42
+ expectedImage:
43
+ '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><g name="group"><text style="text-anchor:middle;font-size:12px;font-weight:normal;font-family:Helvetica;fill:rgb(0, 0, 0);fill-opacity:1;" transform="rotate(0 200 200)"><tspan x="200" y="206" height="12px">Test</tspan></text><rect x="10" y="50" width="40" height="10" stroke="rgb(0, 0, 255)" stroke-opacity="1" stroke-width="2" fill="rgb(255, 0, 0)" fill-opacity="1"></rect></g></svg>',
44
+ };
@@ -1,26 +1,26 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createLine(
6
- AbstractImage.createPoint(10, 100),
7
- AbstractImage.createPoint(40, 70),
8
- AbstractImage.black,
9
- 2
10
- ),
11
- ];
12
- const image = AbstractImage.createAbstractImage(
13
- AbstractImage.createPoint(0, 0),
14
- AbstractImage.createSize(400, 400),
15
- AbstractImage.white,
16
- components
17
- );
18
-
19
- const svg = AbstractImage.createSVG(image);
20
-
21
- export const test: ExportTestDef = {
22
- name: "svg line",
23
- abstractImage: svg,
24
- expectedImage:
25
- '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><line x1="10" y1="100" x2="40" y2="70" stroke="rgb(0, 0, 0)" stroke-opacity="1" stroke-width="2"></line></svg>',
26
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createLine(
6
+ AbstractImage.createPoint(10, 100),
7
+ AbstractImage.createPoint(40, 70),
8
+ AbstractImage.black,
9
+ 2
10
+ ),
11
+ ];
12
+ const image = AbstractImage.createAbstractImage(
13
+ AbstractImage.createPoint(0, 0),
14
+ AbstractImage.createSize(400, 400),
15
+ AbstractImage.white,
16
+ components
17
+ );
18
+
19
+ const svg = AbstractImage.createSVG(image);
20
+
21
+ export const test: ExportTestDef = {
22
+ name: "svg line",
23
+ abstractImage: svg,
24
+ expectedImage:
25
+ '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><line x1="10" y1="100" x2="40" y2="70" stroke="rgb(0, 0, 0)" stroke-opacity="1" stroke-width="2"></line></svg>',
26
+ };
@@ -1,32 +1,32 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createPolygon(
6
- [
7
- AbstractImage.createPoint(110, 10),
8
- AbstractImage.createPoint(100, 20),
9
- AbstractImage.createPoint(110, 30),
10
- AbstractImage.createPoint(100, 40),
11
- AbstractImage.createPoint(110, 50),
12
- ],
13
- AbstractImage.blue,
14
- 2,
15
- AbstractImage.red
16
- ),
17
- ];
18
- const image = AbstractImage.createAbstractImage(
19
- AbstractImage.createPoint(0, 0),
20
- AbstractImage.createSize(400, 400),
21
- AbstractImage.white,
22
- components
23
- );
24
-
25
- const svg = AbstractImage.createSVG(image);
26
-
27
- export const test: ExportTestDef = {
28
- name: "svg polygon",
29
- abstractImage: svg,
30
- expectedImage:
31
- '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><polygon points="110,10 100,20 110,30 100,40 110,50" stroke="rgb(0, 0, 255)" stroke-opacity="1" stroke-width="2" fill="rgb(255, 0, 0)" fill-opacity="1"></polygon></svg>',
32
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createPolygon(
6
+ [
7
+ AbstractImage.createPoint(110, 10),
8
+ AbstractImage.createPoint(100, 20),
9
+ AbstractImage.createPoint(110, 30),
10
+ AbstractImage.createPoint(100, 40),
11
+ AbstractImage.createPoint(110, 50),
12
+ ],
13
+ AbstractImage.blue,
14
+ 2,
15
+ AbstractImage.red
16
+ ),
17
+ ];
18
+ const image = AbstractImage.createAbstractImage(
19
+ AbstractImage.createPoint(0, 0),
20
+ AbstractImage.createSize(400, 400),
21
+ AbstractImage.white,
22
+ components
23
+ );
24
+
25
+ const svg = AbstractImage.createSVG(image);
26
+
27
+ export const test: ExportTestDef = {
28
+ name: "svg polygon",
29
+ abstractImage: svg,
30
+ expectedImage:
31
+ '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><polygon points="110,10 100,20 110,30 100,40 110,50" stroke="rgb(0, 0, 255)" stroke-opacity="1" stroke-width="2" fill="rgb(255, 0, 0)" fill-opacity="1"></polygon></svg>',
32
+ };
@@ -1,33 +1,33 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createPolyLine(
6
- [
7
- AbstractImage.createPoint(10, 40),
8
- AbstractImage.createPoint(20, 30),
9
- AbstractImage.createPoint(30, 40),
10
- AbstractImage.createPoint(40, 30),
11
- AbstractImage.createPoint(50, 40),
12
- AbstractImage.createPoint(60, 30),
13
- AbstractImage.createPoint(70, 40),
14
- ],
15
- AbstractImage.black,
16
- 2
17
- ),
18
- ];
19
- const image = AbstractImage.createAbstractImage(
20
- AbstractImage.createPoint(0, 0),
21
- AbstractImage.createSize(400, 400),
22
- AbstractImage.white,
23
- components
24
- );
25
-
26
- const svg = AbstractImage.createSVG(image);
27
-
28
- export const test: ExportTestDef = {
29
- name: "svg polyline",
30
- abstractImage: svg,
31
- expectedImage:
32
- '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><polyline fill="none" points="10,40 20,30 30,40 40,30 50,40 60,30 70,40" stroke="rgb(0, 0, 0)" stroke-opacity="1" stroke-width="2"></polyline></svg>',
33
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createPolyLine(
6
+ [
7
+ AbstractImage.createPoint(10, 40),
8
+ AbstractImage.createPoint(20, 30),
9
+ AbstractImage.createPoint(30, 40),
10
+ AbstractImage.createPoint(40, 30),
11
+ AbstractImage.createPoint(50, 40),
12
+ AbstractImage.createPoint(60, 30),
13
+ AbstractImage.createPoint(70, 40),
14
+ ],
15
+ AbstractImage.black,
16
+ 2
17
+ ),
18
+ ];
19
+ const image = AbstractImage.createAbstractImage(
20
+ AbstractImage.createPoint(0, 0),
21
+ AbstractImage.createSize(400, 400),
22
+ AbstractImage.white,
23
+ components
24
+ );
25
+
26
+ const svg = AbstractImage.createSVG(image);
27
+
28
+ export const test: ExportTestDef = {
29
+ name: "svg polyline",
30
+ abstractImage: svg,
31
+ expectedImage:
32
+ '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><polyline fill="none" points="10,40 20,30 30,40 40,30 50,40 60,30 70,40" stroke="rgb(0, 0, 0)" stroke-opacity="1" stroke-width="2"></polyline></svg>',
33
+ };
@@ -1,27 +1,27 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createRectangle(
6
- AbstractImage.createPoint(10, 50),
7
- AbstractImage.createPoint(50, 60),
8
- AbstractImage.blue,
9
- 2,
10
- AbstractImage.red
11
- ),
12
- ];
13
- const image = AbstractImage.createAbstractImage(
14
- AbstractImage.createPoint(0, 0),
15
- AbstractImage.createSize(400, 400),
16
- AbstractImage.white,
17
- components
18
- );
19
-
20
- const svg = AbstractImage.createSVG(image);
21
-
22
- export const test: ExportTestDef = {
23
- name: "svg rectangle",
24
- abstractImage: svg,
25
- expectedImage:
26
- '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><rect x="10" y="50" width="40" height="10" stroke="rgb(0, 0, 255)" stroke-opacity="1" stroke-width="2" fill="rgb(255, 0, 0)" fill-opacity="1"></rect></svg>',
27
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createRectangle(
6
+ AbstractImage.createPoint(10, 50),
7
+ AbstractImage.createPoint(50, 60),
8
+ AbstractImage.blue,
9
+ 2,
10
+ AbstractImage.red
11
+ ),
12
+ ];
13
+ const image = AbstractImage.createAbstractImage(
14
+ AbstractImage.createPoint(0, 0),
15
+ AbstractImage.createSize(400, 400),
16
+ AbstractImage.white,
17
+ components
18
+ );
19
+
20
+ const svg = AbstractImage.createSVG(image);
21
+
22
+ export const test: ExportTestDef = {
23
+ name: "svg rectangle",
24
+ abstractImage: svg,
25
+ expectedImage:
26
+ '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><rect x="10" y="50" width="40" height="10" stroke="rgb(0, 0, 255)" stroke-opacity="1" stroke-width="2" fill="rgb(255, 0, 0)" fill-opacity="1"></rect></svg>',
27
+ };
@@ -1,50 +1,50 @@
1
- import { ExportTestDef } from "../export-test-def";
2
- import * as AbstractImage from "../../../../../src/index";
3
-
4
- const components = [
5
- AbstractImage.createText(
6
- AbstractImage.createPoint(10, 10),
7
- "Hello World",
8
- "Arial",
9
- 12,
10
- AbstractImage.black,
11
- "bold",
12
- 0,
13
- "center",
14
- "right",
15
- "down",
16
- 2,
17
- AbstractImage.red,
18
- false
19
- ),
20
- AbstractImage.createText(
21
- AbstractImage.createPoint(40, 40),
22
- "Hello World",
23
- "Arial",
24
- 12,
25
- AbstractImage.black,
26
- "mediumBold",
27
- 0,
28
- "center",
29
- "right",
30
- "down",
31
- 2,
32
- AbstractImage.red,
33
- false
34
- ),
35
- ];
36
- const image = AbstractImage.createAbstractImage(
37
- AbstractImage.createPoint(0, 0),
38
- AbstractImage.createSize(400, 400),
39
- AbstractImage.white,
40
- components
41
- );
42
-
43
- const svg = AbstractImage.createSVG(image);
44
-
45
- export const test: ExportTestDef = {
46
- name: "svg text bold",
47
- abstractImage: svg,
48
- expectedImage:
49
- '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><text style="text-anchor:start;font-size:12px;font-weight:bold;font-family:Arial;stroke:rgb(255, 0, 0);stroke-opacity:1;stroke-width:2px;" transform="rotate(0 10 10)"><tspan x="10" y="22" height="12px">Hello World</tspan></text>,<text style="text-anchor:start;font-size:12px;font-weight:bold;font-family:Arial;fill:rgb(0, 0, 0);fill-opacity:1;" transform="rotate(0 10 10)"><tspan x="10" y="22" height="12px">Hello World</tspan></text><text style="text-anchor:start;font-size:12px;font-weight:mediumBold;font-family:Arial;stroke:rgb(255, 0, 0);stroke-opacity:1;stroke-width:2px;" transform="rotate(0 40 40)"><tspan x="40" y="52" height="12px">Hello World</tspan></text>,<text style="text-anchor:start;font-size:12px;font-weight:mediumBold;font-family:Arial;fill:rgb(0, 0, 0);fill-opacity:1;" transform="rotate(0 40 40)"><tspan x="40" y="52" height="12px">Hello World</tspan></text></svg>',
50
- };
1
+ import { ExportTestDef } from "../export-test-def";
2
+ import * as AbstractImage from "../../../../../src/index";
3
+
4
+ const components = [
5
+ AbstractImage.createText(
6
+ AbstractImage.createPoint(10, 10),
7
+ "Hello World",
8
+ "Arial",
9
+ 12,
10
+ AbstractImage.black,
11
+ "bold",
12
+ 0,
13
+ "center",
14
+ "right",
15
+ "down",
16
+ 2,
17
+ AbstractImage.red,
18
+ false
19
+ ),
20
+ AbstractImage.createText(
21
+ AbstractImage.createPoint(40, 40),
22
+ "Hello World",
23
+ "Arial",
24
+ 12,
25
+ AbstractImage.black,
26
+ "mediumBold",
27
+ 0,
28
+ "center",
29
+ "right",
30
+ "down",
31
+ 2,
32
+ AbstractImage.red,
33
+ false
34
+ ),
35
+ ];
36
+ const image = AbstractImage.createAbstractImage(
37
+ AbstractImage.createPoint(0, 0),
38
+ AbstractImage.createSize(400, 400),
39
+ AbstractImage.white,
40
+ components
41
+ );
42
+
43
+ const svg = AbstractImage.createSVG(image);
44
+
45
+ export const test: ExportTestDef = {
46
+ name: "svg text bold",
47
+ abstractImage: svg,
48
+ expectedImage:
49
+ '<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="400px" viewBox="0 0 400 400"><text style="text-anchor:start;font-size:12px;font-weight:bold;font-family:Arial;stroke:rgb(255, 0, 0);stroke-opacity:1;stroke-width:2px;" transform="rotate(0 10 10)"><tspan x="10" y="22" height="12px">Hello World</tspan></text>,<text style="text-anchor:start;font-size:12px;font-weight:bold;font-family:Arial;fill:rgb(0, 0, 0);fill-opacity:1;" transform="rotate(0 10 10)"><tspan x="10" y="22" height="12px">Hello World</tspan></text><text style="text-anchor:start;font-size:12px;font-weight:mediumBold;font-family:Arial;stroke:rgb(255, 0, 0);stroke-opacity:1;stroke-width:2px;" transform="rotate(0 40 40)"><tspan x="40" y="52" height="12px">Hello World</tspan></text>,<text style="text-anchor:start;font-size:12px;font-weight:mediumBold;font-family:Arial;fill:rgb(0, 0, 0);fill-opacity:1;" transform="rotate(0 40 40)"><tspan x="40" y="52" height="12px">Hello World</tspan></text></svg>',
50
+ };