circuit-to-canvas 0.0.31 → 0.0.32

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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnyCircuitElement, PcbRenderLayer, NinePointAnchor, PcbPlatedHole, PCBVia, PCBHole, PcbSmtPad, PCBTrace, PcbBoard, PcbSilkscreenText, PcbSilkscreenRect, PcbSilkscreenCircle, PcbSilkscreenLine, PcbSilkscreenPath, PcbSilkscreenPill, PcbCutout, PcbCopperPour, PcbCopperText, PcbFabricationNoteText, PcbFabricationNoteRect, PcbNoteRect, PcbFabricationNotePath, PcbNotePath, PcbNoteText, PcbNoteDimension } from 'circuit-json';
1
+ import { AnyCircuitElement, PcbRenderLayer, NinePointAnchor, PcbPlatedHole, PCBVia, PCBHole, PcbSmtPad, PCBTrace, PcbBoard, PcbSilkscreenText, PcbSilkscreenRect, PcbSilkscreenCircle, PcbSilkscreenLine, PcbSilkscreenPath, PcbSilkscreenPill, PcbSilkscreenOval, PcbCutout, PcbCopperPour, PcbCopperText, PcbFabricationNoteText, PcbFabricationNoteRect, PcbNoteRect, PcbFabricationNotePath, PcbNotePath, PcbNoteText, PcbNoteDimension } from 'circuit-json';
2
2
  import { Matrix } from 'transformation-matrix';
3
3
 
4
4
  /**
@@ -139,9 +139,11 @@ interface DrawOvalParams {
139
139
  x: number;
140
140
  y: number;
141
141
  };
142
- width: number;
143
- height: number;
144
- fill: string;
142
+ radius_x: number;
143
+ radius_y: number;
144
+ fill?: string;
145
+ stroke?: string;
146
+ strokeWidth?: number;
145
147
  realToCanvasMat: Matrix;
146
148
  rotation?: number;
147
149
  }
@@ -377,6 +379,14 @@ interface DrawPcbSilkscreenPillParams {
377
379
  }
378
380
  declare function drawPcbSilkscreenPill(params: DrawPcbSilkscreenPillParams): void;
379
381
 
382
+ interface DrawPcbSilkscreenOvalParams {
383
+ ctx: CanvasContext;
384
+ oval: PcbSilkscreenOval;
385
+ realToCanvasMat: Matrix;
386
+ colorMap: PcbColorMap;
387
+ }
388
+ declare function drawPcbSilkscreenOval(params: DrawPcbSilkscreenOvalParams): void;
389
+
380
390
  interface DrawPcbCutoutParams {
381
391
  ctx: CanvasContext;
382
392
  cutout: PcbCutout;
@@ -457,4 +467,4 @@ interface DrawPcbNoteDimensionParams {
457
467
  }
458
468
  declare function drawPcbNoteDimension(params: DrawPcbNoteDimensionParams): void;
459
469
 
460
- export { type AlphabetLayout, type AnchorAlignment, type CameraBounds, type CanvasContext, CircuitToCanvasDrawer, type CopperColorMap, type CopperLayerName, DEFAULT_PCB_COLOR_MAP, type DrawArrowParams, type DrawCircleParams, type DrawContext, type DrawElementsOptions, type DrawLineParams, type DrawOvalParams, type DrawPathParams, type DrawPcbBoardParams, type DrawPcbCopperPourParams, type DrawPcbCopperTextParams, type DrawPcbCutoutParams, type DrawPcbFabricationNotePathParams, type DrawPcbFabricationNoteRectParams, type DrawPcbFabricationNoteTextParams, type DrawPcbHoleParams, type DrawPcbNoteDimensionParams, type DrawPcbNotePathParams, type DrawPcbNoteRectParams, type DrawPcbNoteTextParams, type DrawPcbPlatedHoleParams, type DrawPcbSilkscreenCircleParams, type DrawPcbSilkscreenLineParams, type DrawPcbSilkscreenPathParams, type DrawPcbSilkscreenPillParams, type DrawPcbSilkscreenRectParams, type DrawPcbSilkscreenTextParams, type DrawPcbSmtPadParams, type DrawPcbTraceParams, type DrawPcbViaParams, type DrawPillParams, type DrawPolygonParams, type DrawRectParams, type DrawTextParams, type DrawerConfig, type PcbColorMap, drawArrow, drawCircle, drawLine, drawOval, drawPath, drawPcbBoard, drawPcbCopperPour, drawPcbCopperText, drawPcbCutout, drawPcbFabricationNotePath, drawPcbFabricationNoteRect, drawPcbFabricationNoteText, drawPcbHole, drawPcbNoteDimension, drawPcbNotePath, drawPcbNoteRect, drawPcbNoteText, drawPcbPlatedHole, drawPcbSilkscreenCircle, drawPcbSilkscreenLine, drawPcbSilkscreenPath, drawPcbSilkscreenPill, drawPcbSilkscreenRect, drawPcbSilkscreenText, drawPcbSmtPad, drawPcbTrace, drawPcbVia, drawPill, drawPolygon, drawRect, drawSoldermaskRingForCircle, drawSoldermaskRingForPill, drawSoldermaskRingForRect, drawText, getAlphabetLayout, getTextStartPosition, strokeAlphabetText };
470
+ export { type AlphabetLayout, type AnchorAlignment, type CameraBounds, type CanvasContext, CircuitToCanvasDrawer, type CopperColorMap, type CopperLayerName, DEFAULT_PCB_COLOR_MAP, type DrawArrowParams, type DrawCircleParams, type DrawContext, type DrawElementsOptions, type DrawLineParams, type DrawOvalParams, type DrawPathParams, type DrawPcbBoardParams, type DrawPcbCopperPourParams, type DrawPcbCopperTextParams, type DrawPcbCutoutParams, type DrawPcbFabricationNotePathParams, type DrawPcbFabricationNoteRectParams, type DrawPcbFabricationNoteTextParams, type DrawPcbHoleParams, type DrawPcbNoteDimensionParams, type DrawPcbNotePathParams, type DrawPcbNoteRectParams, type DrawPcbNoteTextParams, type DrawPcbPlatedHoleParams, type DrawPcbSilkscreenCircleParams, type DrawPcbSilkscreenLineParams, type DrawPcbSilkscreenOvalParams, type DrawPcbSilkscreenPathParams, type DrawPcbSilkscreenPillParams, type DrawPcbSilkscreenRectParams, type DrawPcbSilkscreenTextParams, type DrawPcbSmtPadParams, type DrawPcbTraceParams, type DrawPcbViaParams, type DrawPillParams, type DrawPolygonParams, type DrawRectParams, type DrawTextParams, type DrawerConfig, type PcbColorMap, drawArrow, drawCircle, drawLine, drawOval, drawPath, drawPcbBoard, drawPcbCopperPour, drawPcbCopperText, drawPcbCutout, drawPcbFabricationNotePath, drawPcbFabricationNoteRect, drawPcbFabricationNoteText, drawPcbHole, drawPcbNoteDimension, drawPcbNotePath, drawPcbNoteRect, drawPcbNoteText, drawPcbPlatedHole, drawPcbSilkscreenCircle, drawPcbSilkscreenLine, drawPcbSilkscreenOval, drawPcbSilkscreenPath, drawPcbSilkscreenPill, drawPcbSilkscreenRect, drawPcbSilkscreenText, drawPcbSmtPad, drawPcbTrace, drawPcbVia, drawPill, drawPolygon, drawRect, drawSoldermaskRingForCircle, drawSoldermaskRingForPill, drawSoldermaskRingForRect, drawText, getAlphabetLayout, getTextStartPosition, strokeAlphabetText };
package/dist/index.js CHANGED
@@ -138,24 +138,34 @@ function drawOval(params) {
138
138
  const {
139
139
  ctx,
140
140
  center,
141
- width,
142
- height,
141
+ radius_x,
142
+ radius_y,
143
143
  fill,
144
+ stroke,
145
+ strokeWidth = 0.1,
144
146
  realToCanvasMat,
145
147
  rotation = 0
146
148
  } = params;
147
149
  const [cx, cy] = applyToPoint3(realToCanvasMat, [center.x, center.y]);
148
- const scaledWidth = width * Math.abs(realToCanvasMat.a);
149
- const scaledHeight = height * Math.abs(realToCanvasMat.a);
150
+ const scaledRadiusX = radius_x * Math.abs(realToCanvasMat.a);
151
+ const scaledRadiusY = radius_y * Math.abs(realToCanvasMat.a);
152
+ const scaledStrokeWidth = strokeWidth * Math.abs(realToCanvasMat.a);
150
153
  ctx.save();
151
154
  ctx.translate(cx, cy);
152
155
  if (rotation !== 0) {
153
156
  ctx.rotate(-rotation * (Math.PI / 180));
154
157
  }
155
158
  ctx.beginPath();
156
- ctx.ellipse(0, 0, scaledWidth / 2, scaledHeight / 2, 0, 0, Math.PI * 2);
157
- ctx.fillStyle = fill;
158
- ctx.fill();
159
+ ctx.ellipse(0, 0, scaledRadiusX, scaledRadiusY, 0, 0, Math.PI * 2);
160
+ if (fill) {
161
+ ctx.fillStyle = fill;
162
+ ctx.fill();
163
+ }
164
+ if (stroke) {
165
+ ctx.strokeStyle = stroke;
166
+ ctx.lineWidth = scaledStrokeWidth;
167
+ ctx.stroke();
168
+ }
159
169
  ctx.restore();
160
170
  }
161
171
 
@@ -263,8 +273,8 @@ function drawPcbPlatedHole(params) {
263
273
  drawOval({
264
274
  ctx,
265
275
  center: { x: hole.x, y: hole.y },
266
- width: hole.outer_width,
267
- height: hole.outer_height,
276
+ radius_x: hole.outer_width / 2,
277
+ radius_y: hole.outer_height / 2,
268
278
  fill: colorMap.copper.top,
269
279
  realToCanvasMat,
270
280
  rotation: hole.ccw_rotation
@@ -272,8 +282,8 @@ function drawPcbPlatedHole(params) {
272
282
  drawOval({
273
283
  ctx,
274
284
  center: { x: hole.x, y: hole.y },
275
- width: hole.hole_width,
276
- height: hole.hole_height,
285
+ radius_x: hole.hole_width / 2,
286
+ radius_y: hole.hole_height / 2,
277
287
  fill: colorMap.drill,
278
288
  realToCanvasMat,
279
289
  rotation: hole.ccw_rotation
@@ -397,8 +407,8 @@ function drawPcbPlatedHole(params) {
397
407
  drawOval({
398
408
  ctx,
399
409
  center: { x: holeX, y: holeY },
400
- width: hole.hole_width ?? 0,
401
- height: hole.hole_height ?? 0,
410
+ radius_x: (hole.hole_width ?? 0) / 2,
411
+ radius_y: (hole.hole_height ?? 0) / 2,
402
412
  fill: colorMap.drill,
403
413
  realToCanvasMat
404
414
  });
@@ -472,8 +482,8 @@ function drawPcbHole(params) {
472
482
  drawOval({
473
483
  ctx,
474
484
  center: { x: hole.x, y: hole.y },
475
- width: hole.hole_width,
476
- height: hole.hole_height,
485
+ radius_x: hole.hole_width / 2,
486
+ radius_y: hole.hole_height / 2,
477
487
  fill: colorMap.drill,
478
488
  realToCanvasMat
479
489
  });
@@ -1275,13 +1285,32 @@ function drawPcbSilkscreenPath(params) {
1275
1285
  }
1276
1286
  }
1277
1287
 
1278
- // lib/drawer/elements/pcb-silkscreen-pill.ts
1288
+ // lib/drawer/elements/pcb-silkscreen-oval.ts
1279
1289
  function layerToSilkscreenColor6(layer, colorMap) {
1280
1290
  return layer === "bottom" ? colorMap.silkscreen.bottom : colorMap.silkscreen.top;
1281
1291
  }
1292
+ function drawPcbSilkscreenOval(params) {
1293
+ const { ctx, oval, realToCanvasMat, colorMap } = params;
1294
+ const color = layerToSilkscreenColor6(oval.layer, colorMap);
1295
+ drawOval({
1296
+ ctx,
1297
+ center: oval.center,
1298
+ radius_x: oval.radius_x,
1299
+ radius_y: oval.radius_y,
1300
+ stroke: color,
1301
+ strokeWidth: 0.1,
1302
+ realToCanvasMat,
1303
+ rotation: oval.ccw_rotation ?? 0
1304
+ });
1305
+ }
1306
+
1307
+ // lib/drawer/elements/pcb-silkscreen-pill.ts
1308
+ function layerToSilkscreenColor7(layer, colorMap) {
1309
+ return layer === "bottom" ? colorMap.silkscreen.bottom : colorMap.silkscreen.top;
1310
+ }
1282
1311
  function drawPcbSilkscreenPill(params) {
1283
1312
  const { ctx, pill, realToCanvasMat, colorMap } = params;
1284
- const color = layerToSilkscreenColor6(pill.layer, colorMap);
1313
+ const color = layerToSilkscreenColor7(pill.layer, colorMap);
1285
1314
  const strokeWidth = 0.2;
1286
1315
  drawPill({
1287
1316
  ctx,
@@ -2002,6 +2031,14 @@ var CircuitToCanvasDrawer = class {
2002
2031
  colorMap: this.colorMap
2003
2032
  });
2004
2033
  }
2034
+ if (element.type === "pcb_silkscreen_oval") {
2035
+ drawPcbSilkscreenOval({
2036
+ ctx: this.ctx,
2037
+ oval: element,
2038
+ realToCanvasMat: this.realToCanvasMat,
2039
+ colorMap: this.colorMap
2040
+ });
2041
+ }
2005
2042
  if (element.type === "pcb_cutout") {
2006
2043
  drawPcbCutout({
2007
2044
  ctx: this.ctx,
@@ -2115,6 +2152,7 @@ export {
2115
2152
  drawPcbPlatedHole,
2116
2153
  drawPcbSilkscreenCircle,
2117
2154
  drawPcbSilkscreenLine,
2155
+ drawPcbSilkscreenOval,
2118
2156
  drawPcbSilkscreenPath,
2119
2157
  drawPcbSilkscreenPill,
2120
2158
  drawPcbSilkscreenRect,
@@ -10,6 +10,7 @@ import type {
10
10
  PcbSilkscreenRect,
11
11
  PcbSilkscreenCircle,
12
12
  PcbSilkscreenLine,
13
+ PcbSilkscreenOval,
13
14
  PcbSilkscreenPath,
14
15
  PcbSilkscreenPill,
15
16
  PcbCutout,
@@ -54,6 +55,7 @@ import { drawPcbSilkscreenRect } from "./elements/pcb-silkscreen-rect"
54
55
  import { drawPcbSilkscreenCircle } from "./elements/pcb-silkscreen-circle"
55
56
  import { drawPcbSilkscreenLine } from "./elements/pcb-silkscreen-line"
56
57
  import { drawPcbSilkscreenPath } from "./elements/pcb-silkscreen-path"
58
+ import { drawPcbSilkscreenOval } from "./elements/pcb-silkscreen-oval"
57
59
  import { drawPcbSilkscreenPill } from "./elements/pcb-silkscreen-pill"
58
60
  import { drawPcbCutout } from "./elements/pcb-cutout"
59
61
  import { drawPcbCopperPour } from "./elements/pcb-copper-pour"
@@ -373,6 +375,15 @@ export class CircuitToCanvasDrawer {
373
375
  })
374
376
  }
375
377
 
378
+ if (element.type === "pcb_silkscreen_oval") {
379
+ drawPcbSilkscreenOval({
380
+ ctx: this.ctx,
381
+ oval: element as PcbSilkscreenOval,
382
+ realToCanvasMat: this.realToCanvasMat,
383
+ colorMap: this.colorMap,
384
+ })
385
+ }
386
+
376
387
  if (element.type === "pcb_cutout") {
377
388
  drawPcbCutout({
378
389
  ctx: this.ctx,
@@ -48,6 +48,11 @@ export {
48
48
  type DrawPcbSilkscreenPillParams,
49
49
  } from "./pcb-silkscreen-pill"
50
50
 
51
+ export {
52
+ drawPcbSilkscreenOval,
53
+ type DrawPcbSilkscreenOvalParams,
54
+ } from "./pcb-silkscreen-oval"
55
+
51
56
  export { drawPcbCutout, type DrawPcbCutoutParams } from "./pcb-cutout"
52
57
 
53
58
  export {
@@ -43,8 +43,8 @@ export function drawPcbHole(params: DrawPcbHoleParams): void {
43
43
  drawOval({
44
44
  ctx,
45
45
  center: { x: hole.x, y: hole.y },
46
- width: hole.hole_width,
47
- height: hole.hole_height,
46
+ radius_x: hole.hole_width / 2,
47
+ radius_y: hole.hole_height / 2,
48
48
  fill: colorMap.drill,
49
49
  realToCanvasMat,
50
50
  })
@@ -43,8 +43,8 @@ export function drawPcbPlatedHole(params: DrawPcbPlatedHoleParams): void {
43
43
  drawOval({
44
44
  ctx,
45
45
  center: { x: hole.x, y: hole.y },
46
- width: hole.outer_width,
47
- height: hole.outer_height,
46
+ radius_x: hole.outer_width / 2,
47
+ radius_y: hole.outer_height / 2,
48
48
  fill: colorMap.copper.top,
49
49
  realToCanvasMat,
50
50
  rotation: hole.ccw_rotation,
@@ -54,8 +54,8 @@ export function drawPcbPlatedHole(params: DrawPcbPlatedHoleParams): void {
54
54
  drawOval({
55
55
  ctx,
56
56
  center: { x: hole.x, y: hole.y },
57
- width: hole.hole_width,
58
- height: hole.hole_height,
57
+ radius_x: hole.hole_width / 2,
58
+ radius_y: hole.hole_height / 2,
59
59
  fill: colorMap.drill,
60
60
  realToCanvasMat,
61
61
  rotation: hole.ccw_rotation,
@@ -201,8 +201,8 @@ export function drawPcbPlatedHole(params: DrawPcbPlatedHoleParams): void {
201
201
  drawOval({
202
202
  ctx,
203
203
  center: { x: holeX, y: holeY },
204
- width: hole.hole_width ?? 0,
205
- height: hole.hole_height ?? 0,
204
+ radius_x: (hole.hole_width ?? 0) / 2,
205
+ radius_y: (hole.hole_height ?? 0) / 2,
206
206
  fill: colorMap.drill,
207
207
  realToCanvasMat,
208
208
  })
@@ -0,0 +1,35 @@
1
+ import type { PcbSilkscreenOval } from "circuit-json"
2
+ import type { Matrix } from "transformation-matrix"
3
+ import type { PcbColorMap, CanvasContext } from "../types"
4
+ import { drawOval } from "../shapes/oval"
5
+
6
+ export interface DrawPcbSilkscreenOvalParams {
7
+ ctx: CanvasContext
8
+ oval: PcbSilkscreenOval
9
+ realToCanvasMat: Matrix
10
+ colorMap: PcbColorMap
11
+ }
12
+
13
+ function layerToSilkscreenColor(layer: string, colorMap: PcbColorMap): string {
14
+ return layer === "bottom"
15
+ ? colorMap.silkscreen.bottom
16
+ : colorMap.silkscreen.top
17
+ }
18
+
19
+ export function drawPcbSilkscreenOval(
20
+ params: DrawPcbSilkscreenOvalParams,
21
+ ): void {
22
+ const { ctx, oval, realToCanvasMat, colorMap } = params
23
+ const color = layerToSilkscreenColor(oval.layer, colorMap)
24
+
25
+ drawOval({
26
+ ctx,
27
+ center: oval.center,
28
+ radius_x: oval.radius_x,
29
+ radius_y: oval.radius_y,
30
+ stroke: color,
31
+ strokeWidth: 0.1,
32
+ realToCanvasMat,
33
+ rotation: oval.ccw_rotation ?? 0,
34
+ })
35
+ }
@@ -5,9 +5,11 @@ import type { CanvasContext } from "../types"
5
5
  export interface DrawOvalParams {
6
6
  ctx: CanvasContext
7
7
  center: { x: number; y: number }
8
- width: number
9
- height: number
10
- fill: string
8
+ radius_x: number
9
+ radius_y: number
10
+ fill?: string
11
+ stroke?: string
12
+ strokeWidth?: number
11
13
  realToCanvasMat: Matrix
12
14
  rotation?: number
13
15
  }
@@ -16,16 +18,19 @@ export function drawOval(params: DrawOvalParams): void {
16
18
  const {
17
19
  ctx,
18
20
  center,
19
- width,
20
- height,
21
+ radius_x,
22
+ radius_y,
21
23
  fill,
24
+ stroke,
25
+ strokeWidth = 0.1,
22
26
  realToCanvasMat,
23
27
  rotation = 0,
24
28
  } = params
25
29
 
26
30
  const [cx, cy] = applyToPoint(realToCanvasMat, [center.x, center.y])
27
- const scaledWidth = width * Math.abs(realToCanvasMat.a)
28
- const scaledHeight = height * Math.abs(realToCanvasMat.a)
31
+ const scaledRadiusX = radius_x * Math.abs(realToCanvasMat.a)
32
+ const scaledRadiusY = radius_y * Math.abs(realToCanvasMat.a)
33
+ const scaledStrokeWidth = strokeWidth * Math.abs(realToCanvasMat.a)
29
34
 
30
35
  ctx.save()
31
36
  ctx.translate(cx, cy)
@@ -35,8 +40,18 @@ export function drawOval(params: DrawOvalParams): void {
35
40
  }
36
41
 
37
42
  ctx.beginPath()
38
- ctx.ellipse(0, 0, scaledWidth / 2, scaledHeight / 2, 0, 0, Math.PI * 2)
39
- ctx.fillStyle = fill
40
- ctx.fill()
43
+ ctx.ellipse(0, 0, scaledRadiusX, scaledRadiusY, 0, 0, Math.PI * 2)
44
+
45
+ if (fill) {
46
+ ctx.fillStyle = fill
47
+ ctx.fill()
48
+ }
49
+
50
+ if (stroke) {
51
+ ctx.strokeStyle = stroke
52
+ ctx.lineWidth = scaledStrokeWidth
53
+ ctx.stroke()
54
+ }
55
+
41
56
  ctx.restore()
42
57
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "circuit-to-canvas",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.31",
4
+ "version": "0.0.32",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup-node ./lib/index.ts --format esm --dts",
@@ -17,9 +17,9 @@
17
17
  "@tscircuit/math-utils": "^0.0.29",
18
18
  "@types/bun": "latest",
19
19
  "bun-match-svg": "^0.0.14",
20
- "circuit-json": "^0.0.346",
20
+ "circuit-json": "^0.0.348",
21
21
  "circuit-json-to-connectivity-map": "^0.0.23",
22
- "circuit-to-svg": "^0.0.297",
22
+ "circuit-to-svg": "^0.0.303",
23
23
  "looks-same": "^10.0.1",
24
24
  "schematic-symbols": "^0.0.202",
25
25
  "tsup": "^8.5.1"
@@ -0,0 +1,37 @@
1
+ import { expect, test } from "bun:test"
2
+ import type { AnyCircuitElement, PcbSilkscreenOval } from "circuit-json"
3
+ import { getStackedPngSvgComparison } from "../fixtures/getStackedPngSvgComparison"
4
+
5
+ test("draw silkscreen oval", async () => {
6
+ const oval: PcbSilkscreenOval = {
7
+ type: "pcb_silkscreen_oval",
8
+ layer: "top" as const,
9
+ pcb_component_id: "pcb_component_1",
10
+ pcb_silkscreen_oval_id: "oval_1",
11
+ center: { x: 0, y: 0 },
12
+ radius_x: 2,
13
+ radius_y: 1,
14
+ ccw_rotation: 45,
15
+ }
16
+
17
+ const circuitJson: AnyCircuitElement[] = [
18
+ {
19
+ type: "pcb_board",
20
+ pcb_board_id: "board1",
21
+ center: { x: 0, y: 0 },
22
+ width: 10,
23
+ height: 10,
24
+ thickness: 1.6,
25
+ num_layers: 2,
26
+ material: "fr4",
27
+ },
28
+ oval,
29
+ ]
30
+
31
+ const stackedPng = await getStackedPngSvgComparison(circuitJson, {
32
+ width: 400,
33
+ height: 800,
34
+ })
35
+
36
+ await expect(stackedPng).toMatchPngSnapshot(import.meta.path)
37
+ })
@@ -13,10 +13,11 @@ test("draw oval", async () => {
13
13
  drawOval({
14
14
  ctx,
15
15
  center: { x: 50, y: 50 },
16
- width: 70,
17
- height: 40,
16
+ radius_x: 50,
17
+ radius_y: 25,
18
18
  fill: "#0000ff",
19
19
  realToCanvasMat: identity(),
20
+ rotation: 45,
20
21
  })
21
22
 
22
23
  await expect(canvas.toBuffer("image/png")).toMatchPngSnapshot(