circuit-to-canvas 0.0.1 → 0.0.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.
- package/.github/workflows/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-pver-release.yml +77 -0
- package/.github/workflows/bun-test.yml +31 -0
- package/.github/workflows/bun-typecheck.yml +26 -0
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.d.ts +146 -2
- package/dist/index.js +620 -0
- package/lib/drawer/CircuitToCanvasDrawer.ts +138 -1
- package/lib/drawer/elements/index.ts +30 -0
- package/lib/drawer/elements/pcb-board.ts +62 -0
- package/lib/drawer/elements/pcb-copper-pour.ts +84 -0
- package/lib/drawer/elements/pcb-cutout.ts +53 -0
- package/lib/drawer/elements/pcb-hole.ts +90 -0
- package/lib/drawer/elements/pcb-silkscreen.ts +171 -0
- package/lib/drawer/elements/pcb-smtpad.ts +108 -0
- package/lib/drawer/elements/pcb-trace.ts +59 -0
- package/lib/drawer/elements/pcb-via.ts +33 -0
- package/lib/drawer/shapes/index.ts +3 -0
- package/lib/drawer/shapes/line.ts +37 -0
- package/lib/drawer/shapes/path.ts +61 -0
- package/lib/drawer/shapes/polygon.ts +38 -0
- package/lib/drawer/types.ts +16 -0
- package/package.json +2 -2
- package/tests/elements/__snapshots__/board-with-elements.snap.png +0 -0
- package/tests/elements/__snapshots__/bottom-layer-pad.snap.png +0 -0
- package/tests/elements/__snapshots__/bottom-layer-trace.snap.png +0 -0
- package/tests/elements/__snapshots__/circular-cutout.snap.png +0 -0
- package/tests/elements/__snapshots__/circular-pad.snap.png +0 -0
- package/tests/elements/__snapshots__/copper-pour-with-trace.snap.png +0 -0
- package/tests/elements/__snapshots__/custom-outline-board.snap.png +0 -0
- package/tests/elements/__snapshots__/multi-segment-trace.snap.png +0 -0
- package/tests/elements/__snapshots__/multiple-traces.snap.png +0 -0
- package/tests/elements/__snapshots__/multiple-vias.snap.png +0 -0
- package/tests/elements/__snapshots__/oval-hole.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-board.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-copper-pour.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-cutout.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-hole.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-silkscreen.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-smtpad.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-trace.snap.png +0 -0
- package/tests/elements/__snapshots__/pcb-via.snap.png +0 -0
- package/tests/elements/__snapshots__/pill-hole.snap.png +0 -0
- package/tests/elements/__snapshots__/pill-pad.snap.png +0 -0
- package/tests/elements/__snapshots__/polygon-copper-pour.snap.png +0 -0
- package/tests/elements/__snapshots__/polygon-cutout.snap.png +0 -0
- package/tests/elements/__snapshots__/polygon-pad.snap.png +0 -0
- package/tests/elements/__snapshots__/rect-pad-with-border-radius.snap.png +0 -0
- package/tests/elements/__snapshots__/rotated-rect-pad.snap.png +0 -0
- package/tests/elements/__snapshots__/silkscreen-circle.snap.png +0 -0
- package/tests/elements/__snapshots__/silkscreen-line.snap.png +0 -0
- package/tests/elements/__snapshots__/silkscreen-on-component.snap.png +0 -0
- package/tests/elements/__snapshots__/silkscreen-path.snap.png +0 -0
- package/tests/elements/__snapshots__/silkscreen-rect.snap.png +0 -0
- package/tests/elements/__snapshots__/silkscreen-text-bottom.snap.png +0 -0
- package/tests/elements/__snapshots__/square-hole.snap.png +0 -0
- package/tests/elements/pcb-board.test.ts +155 -0
- package/tests/elements/pcb-copper-pour.test.ts +120 -0
- package/tests/elements/pcb-cutout.test.ts +82 -0
- package/tests/elements/pcb-hole.test.ts +105 -0
- package/tests/elements/pcb-silkscreen.test.ts +245 -0
- package/tests/elements/pcb-smtpad.test.ts +198 -0
- package/tests/elements/pcb-trace.test.ts +116 -0
- package/tests/elements/pcb-via.test.ts +75 -0
- package/.claude/settings.local.json +0 -7
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Format Check
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
format-check:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup bun
|
|
18
|
+
uses: oven-sh/setup-bun@v2
|
|
19
|
+
with:
|
|
20
|
+
bun-version: latest
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: bun install
|
|
24
|
+
|
|
25
|
+
- name: Run format check
|
|
26
|
+
run: bun run format:check
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Publish to npm
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
UPSTREAM_REPOS: "" # comma-separated list, e.g. "eval,tscircuit,docs"
|
|
11
|
+
UPSTREAM_PACKAGES_TO_UPDATE: "" # comma-separated list, e.g. "@tscircuit/core,@tscircuit/protos"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
if: ${{ !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'v')) }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
21
|
+
- name: Setup bun
|
|
22
|
+
uses: oven-sh/setup-bun@v2
|
|
23
|
+
with:
|
|
24
|
+
bun-version: latest
|
|
25
|
+
- uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: 20
|
|
28
|
+
registry-url: https://registry.npmjs.org/
|
|
29
|
+
- run: npm install -g pver
|
|
30
|
+
- run: bun install --frozen-lockfile
|
|
31
|
+
- run: bun run build
|
|
32
|
+
- run: pver release --no-push-main
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
35
|
+
GITHUB_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
36
|
+
|
|
37
|
+
- name: Get package version
|
|
38
|
+
id: package-version
|
|
39
|
+
run: |
|
|
40
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
41
|
+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
42
|
+
|
|
43
|
+
- name: Create Pull Request
|
|
44
|
+
id: create-pr
|
|
45
|
+
uses: peter-evans/create-pull-request@v5
|
|
46
|
+
with:
|
|
47
|
+
commit-message: "chore: bump version to ${{ steps.package-version.outputs.version }}"
|
|
48
|
+
title: "chore: bump version to ${{ steps.package-version.outputs.version }}"
|
|
49
|
+
body: "Automated package update"
|
|
50
|
+
branch: bump-version-${{ github.run_number }}
|
|
51
|
+
base: main
|
|
52
|
+
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
53
|
+
committer: tscircuitbot <githubbot@tscircuit.com>
|
|
54
|
+
author: tscircuitbot <githubbot@tscircuit.com>
|
|
55
|
+
|
|
56
|
+
- name: Enable auto-merge
|
|
57
|
+
if: steps.create-pr.outputs.pull-request-number != ''
|
|
58
|
+
run: |
|
|
59
|
+
gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch
|
|
60
|
+
env:
|
|
61
|
+
GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
62
|
+
|
|
63
|
+
# - name: Trigger upstream repo updates
|
|
64
|
+
# if: env.UPSTREAM_REPOS && env.UPSTREAM_PACKAGES_TO_UPDATE
|
|
65
|
+
# run: |
|
|
66
|
+
# IFS=',' read -ra REPOS <<< "${{ env.UPSTREAM_REPOS }}"
|
|
67
|
+
# for repo in "${REPOS[@]}"; do
|
|
68
|
+
# if [[ -n "$repo" ]]; then
|
|
69
|
+
# echo "Triggering update for repo: $repo"
|
|
70
|
+
# curl -X POST \
|
|
71
|
+
# -H "Accept: application/vnd.github.v3+json" \
|
|
72
|
+
# -H "Authorization: token ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}" \
|
|
73
|
+
# -H "Content-Type: application/json" \
|
|
74
|
+
# "https://api.github.com/repos/tscircuit/$repo/actions/workflows/update-package.yml/dispatches" \
|
|
75
|
+
# -d "{\"ref\":\"main\",\"inputs\":{\"package_names\":\"${{ env.UPSTREAM_PACKAGES_TO_UPDATE }}\"}}"
|
|
76
|
+
# fi
|
|
77
|
+
# done
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Bun Test
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 5
|
|
14
|
+
|
|
15
|
+
# Skip test for PRs that not chore: bump version
|
|
16
|
+
if: "${{ github.event_name != 'pull_request' || github.event.pull_request.title != 'chore: bump version' }}"
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Setup bun
|
|
23
|
+
uses: oven-sh/setup-bun@v2
|
|
24
|
+
with:
|
|
25
|
+
bun-version: latest
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: bun install
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: bun test
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Type Check
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
type-check:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup bun
|
|
18
|
+
uses: oven-sh/setup-bun@v2
|
|
19
|
+
with:
|
|
20
|
+
bun-version: latest
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: bun i
|
|
24
|
+
|
|
25
|
+
- name: Run type check
|
|
26
|
+
run: bunx tsc --noEmit
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 tscircuit Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Draw [Circuit JSON](https://github.com/tscircuit/circuit-json) into a Canvas- works with any canvas object (Node/Vanilla)
|
|
4
4
|
|
|
5
|
+
[](https://npmjs.com/package/circuit-to-canvas)
|
|
6
|
+
|
|
5
7
|
```tsx
|
|
6
8
|
const drawer = new CircuitToCanvasDrawer(canvasOrCanvasRenderingContext2d)
|
|
7
9
|
|
|
@@ -28,3 +30,67 @@ There are two "types" of layers:
|
|
|
28
30
|
- Layer groups "top" (includes "top_copper", "top_soldermask")
|
|
29
31
|
|
|
30
32
|
inner layers go by the name inner1, inner2 etc.
|
|
33
|
+
|
|
34
|
+
## Feature Parity with circuit-to-svg
|
|
35
|
+
|
|
36
|
+
This checklist tracks PCB drawing features from [circuit-to-svg](https://github.com/tscircuit/circuit-to-svg) that are implemented in circuit-to-canvas.
|
|
37
|
+
|
|
38
|
+
### PCB Elements
|
|
39
|
+
|
|
40
|
+
- [x] `pcb_board` - Board outline with center/width/height or custom outline
|
|
41
|
+
- [x] `pcb_trace` - PCB traces with route points
|
|
42
|
+
- [x] `pcb_via` - Via holes
|
|
43
|
+
- [x] `pcb_plated_hole` - Plated through-holes (circular, pill, oval shapes)
|
|
44
|
+
- [x] `pcb_hole` - Non-plated holes (circular, square, oval shapes)
|
|
45
|
+
- [x] `pcb_smtpad` - SMT pads (rect, circle, rotated_rect, pill shapes)
|
|
46
|
+
- [x] `pcb_copper_pour` - Copper pour areas (rect, polygon shapes)
|
|
47
|
+
- [x] `pcb_cutout` - Board cutouts (rect, circle, polygon shapes)
|
|
48
|
+
|
|
49
|
+
### Silkscreen Elements
|
|
50
|
+
|
|
51
|
+
- [x] `pcb_silkscreen_text` - Text on silkscreen layer
|
|
52
|
+
- [x] `pcb_silkscreen_rect` - Rectangles on silkscreen
|
|
53
|
+
- [x] `pcb_silkscreen_circle` - Circles on silkscreen
|
|
54
|
+
- [x] `pcb_silkscreen_line` - Lines on silkscreen
|
|
55
|
+
- [x] `pcb_silkscreen_path` - Paths/routes on silkscreen
|
|
56
|
+
|
|
57
|
+
### Copper Text
|
|
58
|
+
|
|
59
|
+
- [ ] `pcb_copper_text` - Text rendered on copper layers (supports knockout mode, mirroring)
|
|
60
|
+
|
|
61
|
+
### Error Visualization
|
|
62
|
+
|
|
63
|
+
- [ ] `pcb_trace_error` - Trace routing error indicators
|
|
64
|
+
- [ ] `pcb_footprint_overlap_error` - Footprint overlap error indicators
|
|
65
|
+
|
|
66
|
+
### Debug/Development Features
|
|
67
|
+
|
|
68
|
+
- [ ] `pcb_component` - Component bounding box visualization
|
|
69
|
+
- [ ] `pcb_group` - PCB group visualization with dashed outlines
|
|
70
|
+
- [ ] `pcb_courtyard_rect` - Component courtyard rectangles
|
|
71
|
+
|
|
72
|
+
### Fabrication Notes
|
|
73
|
+
|
|
74
|
+
- [ ] `pcb_fabrication_note_text` - Fabrication note text
|
|
75
|
+
- [ ] `pcb_fabrication_note_rect` - Fabrication note rectangles
|
|
76
|
+
- [ ] `pcb_fabrication_note_path` - Fabrication note paths
|
|
77
|
+
- [ ] `pcb_fabrication_note_dimension` - Fabrication dimension annotations
|
|
78
|
+
|
|
79
|
+
### Annotation/Notes
|
|
80
|
+
|
|
81
|
+
- [ ] `pcb_note_text` - General note text
|
|
82
|
+
- [ ] `pcb_note_rect` - Note rectangles
|
|
83
|
+
- [ ] `pcb_note_path` - Note paths
|
|
84
|
+
- [ ] `pcb_note_line` - Note lines
|
|
85
|
+
- [ ] `pcb_note_dimension` - Dimension annotations
|
|
86
|
+
|
|
87
|
+
### Panel Support
|
|
88
|
+
|
|
89
|
+
- [ ] `pcb_panel` - PCB panel outlines for panelization
|
|
90
|
+
|
|
91
|
+
### Visualization Features
|
|
92
|
+
|
|
93
|
+
- [ ] Rats nest visualization - Unrouted connection indicators
|
|
94
|
+
- [ ] PCB grid overlay - Configurable grid with major/minor lines
|
|
95
|
+
- [ ] Soldermask rendering - Soldermask layer visualization
|
|
96
|
+
- [ ] Anchor offset indicators - Debug indicators for relative positioning
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCircuitElement, PcbPlatedHole } from 'circuit-json';
|
|
1
|
+
import { AnyCircuitElement, PcbPlatedHole, PCBVia, PCBHole, PcbSmtPad, PCBTrace, PcbBoard, PcbSilkscreenText, PcbSilkscreenRect, PcbSilkscreenCircle, PcbSilkscreenLine, PcbSilkscreenPath, PcbCutout, PcbCopperPour } from 'circuit-json';
|
|
2
2
|
import { Matrix } from 'transformation-matrix';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -12,6 +12,7 @@ interface CanvasContext {
|
|
|
12
12
|
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
13
13
|
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number): void;
|
|
14
14
|
fill(): void;
|
|
15
|
+
stroke(): void;
|
|
15
16
|
rect(x: number, y: number, w: number, h: number): void;
|
|
16
17
|
lineTo(x: number, y: number): void;
|
|
17
18
|
moveTo(x: number, y: number): void;
|
|
@@ -19,11 +20,20 @@ interface CanvasContext {
|
|
|
19
20
|
restore(): void;
|
|
20
21
|
translate(x: number, y: number): void;
|
|
21
22
|
rotate(angle: number): void;
|
|
23
|
+
scale(x: number, y: number): void;
|
|
22
24
|
fillStyle: string | CanvasGradient | CanvasPattern;
|
|
25
|
+
strokeStyle: string | CanvasGradient | CanvasPattern;
|
|
26
|
+
lineWidth: number;
|
|
27
|
+
lineCap: "butt" | "round" | "square";
|
|
28
|
+
lineJoin: "bevel" | "round" | "miter";
|
|
23
29
|
canvas: {
|
|
24
30
|
width: number;
|
|
25
31
|
height: number;
|
|
26
32
|
};
|
|
33
|
+
fillText(text: string, x: number, y: number): void;
|
|
34
|
+
font: string;
|
|
35
|
+
textAlign: "start" | "end" | "left" | "right" | "center";
|
|
36
|
+
textBaseline: "top" | "hanging" | "middle" | "alphabetic" | "ideographic" | "bottom";
|
|
27
37
|
}
|
|
28
38
|
type CopperLayerName = "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
29
39
|
type CopperColorMap = Record<CopperLayerName, string> & {
|
|
@@ -140,6 +150,48 @@ interface DrawPillParams {
|
|
|
140
150
|
}
|
|
141
151
|
declare function drawPill(params: DrawPillParams): void;
|
|
142
152
|
|
|
153
|
+
interface DrawPolygonParams {
|
|
154
|
+
ctx: CanvasContext;
|
|
155
|
+
points: Array<{
|
|
156
|
+
x: number;
|
|
157
|
+
y: number;
|
|
158
|
+
}>;
|
|
159
|
+
fill: string;
|
|
160
|
+
transform: Matrix;
|
|
161
|
+
}
|
|
162
|
+
declare function drawPolygon(params: DrawPolygonParams): void;
|
|
163
|
+
|
|
164
|
+
interface DrawLineParams {
|
|
165
|
+
ctx: CanvasContext;
|
|
166
|
+
start: {
|
|
167
|
+
x: number;
|
|
168
|
+
y: number;
|
|
169
|
+
};
|
|
170
|
+
end: {
|
|
171
|
+
x: number;
|
|
172
|
+
y: number;
|
|
173
|
+
};
|
|
174
|
+
strokeWidth: number;
|
|
175
|
+
stroke: string;
|
|
176
|
+
transform: Matrix;
|
|
177
|
+
lineCap?: "butt" | "round" | "square";
|
|
178
|
+
}
|
|
179
|
+
declare function drawLine(params: DrawLineParams): void;
|
|
180
|
+
|
|
181
|
+
interface DrawPathParams {
|
|
182
|
+
ctx: CanvasContext;
|
|
183
|
+
points: Array<{
|
|
184
|
+
x: number;
|
|
185
|
+
y: number;
|
|
186
|
+
}>;
|
|
187
|
+
fill?: string;
|
|
188
|
+
stroke?: string;
|
|
189
|
+
strokeWidth?: number;
|
|
190
|
+
transform: Matrix;
|
|
191
|
+
closePath?: boolean;
|
|
192
|
+
}
|
|
193
|
+
declare function drawPath(params: DrawPathParams): void;
|
|
194
|
+
|
|
143
195
|
interface DrawPcbPlatedHoleParams {
|
|
144
196
|
ctx: CanvasContext;
|
|
145
197
|
hole: PcbPlatedHole;
|
|
@@ -148,4 +200,96 @@ interface DrawPcbPlatedHoleParams {
|
|
|
148
200
|
}
|
|
149
201
|
declare function drawPcbPlatedHole(params: DrawPcbPlatedHoleParams): void;
|
|
150
202
|
|
|
151
|
-
|
|
203
|
+
interface DrawPcbViaParams {
|
|
204
|
+
ctx: CanvasContext;
|
|
205
|
+
via: PCBVia;
|
|
206
|
+
transform: Matrix;
|
|
207
|
+
colorMap: PcbColorMap;
|
|
208
|
+
}
|
|
209
|
+
declare function drawPcbVia(params: DrawPcbViaParams): void;
|
|
210
|
+
|
|
211
|
+
interface DrawPcbHoleParams {
|
|
212
|
+
ctx: CanvasContext;
|
|
213
|
+
hole: PCBHole;
|
|
214
|
+
transform: Matrix;
|
|
215
|
+
colorMap: PcbColorMap;
|
|
216
|
+
}
|
|
217
|
+
declare function drawPcbHole(params: DrawPcbHoleParams): void;
|
|
218
|
+
|
|
219
|
+
interface DrawPcbSmtPadParams {
|
|
220
|
+
ctx: CanvasContext;
|
|
221
|
+
pad: PcbSmtPad;
|
|
222
|
+
transform: Matrix;
|
|
223
|
+
colorMap: PcbColorMap;
|
|
224
|
+
}
|
|
225
|
+
declare function drawPcbSmtPad(params: DrawPcbSmtPadParams): void;
|
|
226
|
+
|
|
227
|
+
interface DrawPcbTraceParams {
|
|
228
|
+
ctx: CanvasContext;
|
|
229
|
+
trace: PCBTrace;
|
|
230
|
+
transform: Matrix;
|
|
231
|
+
colorMap: PcbColorMap;
|
|
232
|
+
}
|
|
233
|
+
declare function drawPcbTrace(params: DrawPcbTraceParams): void;
|
|
234
|
+
|
|
235
|
+
interface DrawPcbBoardParams {
|
|
236
|
+
ctx: CanvasContext;
|
|
237
|
+
board: PcbBoard;
|
|
238
|
+
transform: Matrix;
|
|
239
|
+
colorMap: PcbColorMap;
|
|
240
|
+
}
|
|
241
|
+
declare function drawPcbBoard(params: DrawPcbBoardParams): void;
|
|
242
|
+
|
|
243
|
+
interface DrawPcbSilkscreenTextParams {
|
|
244
|
+
ctx: CanvasContext;
|
|
245
|
+
text: PcbSilkscreenText;
|
|
246
|
+
transform: Matrix;
|
|
247
|
+
colorMap: PcbColorMap;
|
|
248
|
+
}
|
|
249
|
+
interface DrawPcbSilkscreenRectParams {
|
|
250
|
+
ctx: CanvasContext;
|
|
251
|
+
rect: PcbSilkscreenRect;
|
|
252
|
+
transform: Matrix;
|
|
253
|
+
colorMap: PcbColorMap;
|
|
254
|
+
}
|
|
255
|
+
interface DrawPcbSilkscreenCircleParams {
|
|
256
|
+
ctx: CanvasContext;
|
|
257
|
+
circle: PcbSilkscreenCircle;
|
|
258
|
+
transform: Matrix;
|
|
259
|
+
colorMap: PcbColorMap;
|
|
260
|
+
}
|
|
261
|
+
interface DrawPcbSilkscreenLineParams {
|
|
262
|
+
ctx: CanvasContext;
|
|
263
|
+
line: PcbSilkscreenLine;
|
|
264
|
+
transform: Matrix;
|
|
265
|
+
colorMap: PcbColorMap;
|
|
266
|
+
}
|
|
267
|
+
interface DrawPcbSilkscreenPathParams {
|
|
268
|
+
ctx: CanvasContext;
|
|
269
|
+
path: PcbSilkscreenPath;
|
|
270
|
+
transform: Matrix;
|
|
271
|
+
colorMap: PcbColorMap;
|
|
272
|
+
}
|
|
273
|
+
declare function drawPcbSilkscreenText(params: DrawPcbSilkscreenTextParams): void;
|
|
274
|
+
declare function drawPcbSilkscreenRect(params: DrawPcbSilkscreenRectParams): void;
|
|
275
|
+
declare function drawPcbSilkscreenCircle(params: DrawPcbSilkscreenCircleParams): void;
|
|
276
|
+
declare function drawPcbSilkscreenLine(params: DrawPcbSilkscreenLineParams): void;
|
|
277
|
+
declare function drawPcbSilkscreenPath(params: DrawPcbSilkscreenPathParams): void;
|
|
278
|
+
|
|
279
|
+
interface DrawPcbCutoutParams {
|
|
280
|
+
ctx: CanvasContext;
|
|
281
|
+
cutout: PcbCutout;
|
|
282
|
+
transform: Matrix;
|
|
283
|
+
colorMap: PcbColorMap;
|
|
284
|
+
}
|
|
285
|
+
declare function drawPcbCutout(params: DrawPcbCutoutParams): void;
|
|
286
|
+
|
|
287
|
+
interface DrawPcbCopperPourParams {
|
|
288
|
+
ctx: CanvasContext;
|
|
289
|
+
pour: PcbCopperPour;
|
|
290
|
+
transform: Matrix;
|
|
291
|
+
colorMap: PcbColorMap;
|
|
292
|
+
}
|
|
293
|
+
declare function drawPcbCopperPour(params: DrawPcbCopperPourParams): void;
|
|
294
|
+
|
|
295
|
+
export { type CameraBounds, type CanvasContext, CircuitToCanvasDrawer, type CopperColorMap, type CopperLayerName, DEFAULT_PCB_COLOR_MAP, type DrawCircleParams, type DrawContext, type DrawElementsOptions, type DrawLineParams, type DrawOvalParams, type DrawPathParams, type DrawPcbBoardParams, type DrawPcbCopperPourParams, type DrawPcbCutoutParams, type DrawPcbHoleParams, type DrawPcbPlatedHoleParams, type DrawPcbSilkscreenCircleParams, type DrawPcbSilkscreenLineParams, type DrawPcbSilkscreenPathParams, type DrawPcbSilkscreenRectParams, type DrawPcbSilkscreenTextParams, type DrawPcbSmtPadParams, type DrawPcbTraceParams, type DrawPcbViaParams, type DrawPillParams, type DrawPolygonParams, type DrawRectParams, type DrawerConfig, type PcbColorMap, drawCircle, drawLine, drawOval, drawPath, drawPcbBoard, drawPcbCopperPour, drawPcbCutout, drawPcbHole, drawPcbPlatedHole, drawPcbSilkscreenCircle, drawPcbSilkscreenLine, drawPcbSilkscreenPath, drawPcbSilkscreenRect, drawPcbSilkscreenText, drawPcbSmtPad, drawPcbTrace, drawPcbVia, drawPill, drawPolygon, drawRect };
|