Skip to content

Commit a27f6b7

Browse files
committed
Fix svg import
1 parent 86584f5 commit a27f6b7

5 files changed

Lines changed: 619 additions & 130 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,19 @@ Field 12 in the shape protobuf identifies the brush tool. Observed values and th
270270
- **Text types** (6, 16): Text boxes with plain text (field 10) and/or HTML rich text (field 22). See **Text Boxes** section.
271271
- **Geometric shapes** (40): GeoJSON-based vector shapes using field 20. See **Geometric Shapes** section.
272272

273+
### SVG Import: Fill Export Format
274+
275+
When importing SVGs into `.note` format, filled shapes are converted to pen_type 40 (GeoJSON geometric shapes) which supports native fills via the `fillAttr` property. Key lessons:
276+
277+
- **pen_type 0, 1, 17 are NOT used in any observed `.note` files.** Using them results in unfilled outlines.
278+
- **pen_type 40 supports fills natively** via `displayFillColor` and `fillAttr` in the GeoJSON `featureCollection` (protobuf field 20). The device renders these correctly.
279+
- **pen_type 40 does NOT use binary `#points` data.** Geometry is stored entirely in the GeoJSON. The matrix (protobuf field 8) transforms local → page coordinates.
280+
281+
**Conversion pipeline for SVG fills:**
282+
1. Ellipses → pen_type 40 `MultiPoint` with `subType: "Oval"` + `fillAttr`
283+
2. Rectangles → pen_type 40 `Polygon` (4-edge rectangle) + `fillAttr`
284+
3. Polygons → pen_type 40 `Polygon` (edge pairs) + `fillAttr`
285+
273286
### Rendering Pipeline
274287

275288
Each stroke is rendered by:

0 commit comments

Comments
 (0)