inlaytrace 0.1.3 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # inlaytrace
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d37e56b: `stacked: true` now works for flat art too: shapes come back to front, each whole, with the parts hidden behind other shapes completed (a disc behind a bar traces as a whole disc). Which shape is in front is read from the junctions where two shapes' shared edge ends. Photos (`photo: true`) stack as before.
8
+ - b1c2494: Flat outline illustrations (thin coloured outlines on white, pale tinted fills) now trace. Speck clean-up folds a speck into its nearest colour, and no longer dissolves a thin stroke that lossy compression split into two shades of its ink. `peakPalette` takes a new `width` option: given it, pale tints are found by their flatness (new options `minTint`, `minFlat`), and a colour that is only ever an anti-aliased edge is left out. Slivers under 2 px wide fold into a neighbour of nearly the same colour. New option `photo` keeps the old clean-up for photos (specks join the colour they share the most edge with, no sliver pass), which is what a stacked `quantizePalette` trace wants. Binary and centerline modes take `threshold: 'auto'` (Otsu, falling back to 128 on a page with nothing to split). A thin closed shape (a 3 px letter stem) no longer collapses to a line, and the fitter no longer grows spikes on thin letters. On a new outline fixture, Logo went from 13.0% to 2.1% of pixels wrong; the badge, emblems and photos (with `photo`) score the same.
9
+ - 1d9df88: New `strokes` option for flat outline art: in palette mode, the colours drawn mostly as thin, long lines are traced down their middle as one stroked path each (`InlayPath.stroke` is the width measured from the ink), with their anti-aliased edges and darker shades joined in, and the shapes either side meet beneath them. Small lettering, short marks and solid shapes stay shapes. `scale` says how far the image was enlarged, so the line widths scale with it. Off by default; output without it is unchanged.
10
+
11
+ `toSvg` and `centerlineToSvg` now escape the attribute values they write, so a palette colour given with a quote in it can't end its attribute.
12
+ - 1719316: `peakPalette` finds colours spread over several histogram bins (a photo's red lettering, a small decal) instead of stopping at the greys; flat art's palettes are unchanged. New option `minDetail`. Stacked shapes now reach under the neighbours painted after them, so no hairline seam shows where two shapes meet (12% closer on photos, about a third more path data).
13
+ - 2cf20c5: Lines within a degree of horizontal, vertical or 45° are now exactly that, so a square stays square after JPEG and lines either side of a junction line up. `fitChain` takes `snap: false` to keep lines as fitted.
14
+
15
+ ### Patch Changes
16
+
17
+ - 56f4604: `centerline(rgba, width, height, options)` (and `traceCenterline`, `centerlineToSvg`): single strokes down the middle of the ink, for pen plotters and engraving, with the stroke width measured from the ink or set.
18
+ - b7fa938: Add a funding link (Ko-fi) to the package metadata.
19
+ - fb90904: New `gradients` option: soft shading that a palette splits into bands of tints is traced as one shape with a linear or radial gradient (`path.gradient`, written by `toSvg` as `<linearGradient>` / `<radialGradient>`), when the gradient fits much better than a flat colour. Off by default.
20
+ - e462e9b: Lines about a pixel wide stay in one piece at a slant, instead of breaking into dashes or vanishing.
21
+ - 1ff571f: Centerline and outline-art strokes run straight through junctions. Thinning bends the skeleton toward each junction, so an X of thick strokes came out pinched at its crossing and a T's stem bent to meet the bar; within a stroke width of a junction the arms are now cut back and drawn straight on to where their own lines meet.
22
+ - 6e9a2d0: Small text and dots beside flat art now trace. Thin anti-aliased strokes (1.5 px grey letters) were labelled as the paper, pale edges as a nearby colour, and each letter then cleared as a speck. In flat art (not `photo`), a pixel between colours and close to none of them is now read as a mix of the pair that explains it best; one next to only one other colour keeps its own; and a speck that stands well apart from every colour around it stays from an eighth of the speck area up, so raising `speckle` still clears it. Poster output is unchanged.
23
+ - 3660a64: In images with exactly flat colours, such as most PNG exports, edges are placed between pixels from their anti-aliasing instead of on the pixel grid: straight sides land where they really are, and small shapes come out cleaner (2–16% fewer wrong pixels on the PNG fixtures, for the same nodes). Whether an image qualifies is judged from its pixels, so typical JPEG and WebP traces and Poster are unchanged.
24
+ - 62d79d3: `toSvg` escapes the drawing's width and height like every other value it writes.
25
+ - 4b20b95: Lines one or two pixels wide keep their width to their ends. Where such a line's outline turned back at its end inside one fitted run (an arm of a T or a Y), its two sides were joined at a point, so each arm tapered to nothing and thin outlines looked broken.
26
+
3
27
  ## 0.1.3
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -42,7 +42,8 @@ const result = trace(rgba, width, height, {
42
42
  cornerAngle: 45, // turns sharper than this stay corners
43
43
  })
44
44
 
45
- result.paths // [{ d: 'M…Z', fill: '#rrggbb' }, …] largest first, nonzero fill
45
+ result.paths // [{ d: 'M…Z', fill: '#rrggbb' }, …] largest first, nonzero fill;
46
+ // with `strokes`, lines last: { d, fill, stroke: width }, stroked in `fill`, unfilled
46
47
  toSvg(result) // '<svg …>…</svg>'
47
48
  ```
48
49
 
@@ -50,11 +51,14 @@ toSvg(result) // '<svg …>…</svg>'
50
51
 
51
52
  | Options | For |
52
53
  | --- | --- |
53
- | `mode: 'palette', palette` | Flat colour art. `palette` is the colours to label pixels with: `peakPalette(rgba, n)` takes the sharp peaks of the histogram (flat art's real colours); `exactPalette(rgba, n)` takes the image's exact colours, most-used first. |
54
+ | `mode: 'palette', palette` | Flat colour art. `palette` is the colours to label pixels with: `peakPalette(rgba, n, { width })` takes the sharp peaks of the histogram (flat art's real colours), and given the image's width also pale tints found by their flatness (a light fill on white); `exactPalette(rgba, n)` takes the image's exact colours, most-used first. |
54
55
  | `mode: 'palette', palette, merge` | Fold colours together before regions are built, so the edge between them disappears: `{ '#from': '#into' }`. |
55
56
  | `mode: 'palette', palette: exactPalette(…), pixels: true` | Pixel art: no clean-up of lone pixels, no curve fitting; every boundary is its pixel staircase with straight runs joined. |
56
- | `mode: 'palette', palette: quantizePalette(…), stacked: true` | Photos as flat colour bands. `quantizePalette(rgba, n)` clusters the image's colours (k-means in OKLab, deterministic); `stacked` draws each shape whole, larger first, instead of cutting holes. |
57
- | `mode: 'binary', threshold` | Line art: ink darker than `threshold` (0–255), or adaptive per neighbourhood when `null`. Only the ink is drawn. |
57
+ | `mode: 'palette', palette, strokes: true` | Outline art: colours drawn mostly as thin, long lines (2.5–8 px wide; give `scale` if the image was enlarged) are traced down their middle as round-capped strokes at the measured width, and the shapes either side meet beneath them. Short marks, small lettering and solid shapes stay shapes. |
58
+ | `mode: 'palette', palette, gradients: true` | Soft shading as gradients: neighbouring tints that are bands of one smooth shade become one shape with a linear or radial gradient (`path.gradient`; `fill` is its average colour), when the gradient fits far better than a flat colour. For screens and print, not cutters. |
59
+ | `mode: 'palette', palette, stacked: true` | Flat art as layers: each shape whole, back to front. Which of two touching shapes is in front comes from the junctions where their edge ends, and a shape partly hidden is completed underneath (a circle, a corner, or a smooth continuation), so a disc behind a bar is a whole disc. |
60
+ | `mode: 'palette', palette: quantizePalette(…), stacked: true, photo: true` | Photos as flat colour bands. `quantizePalette(rgba, n)` clusters the image's colours (k-means in OKLab, deterministic); `stacked` draws each shape whole, larger first, instead of cutting holes. |
61
+ | `mode: 'binary', threshold` | Line art: ink darker than `threshold` (0–255), the image's own ink/paper split when `'auto'` (Otsu; coloured ink works too), or adaptive per neighbourhood when `null`. Only the ink is drawn. |
58
62
 
59
63
  ### Also exported
60
64
 
@@ -63,6 +67,9 @@ toSvg(result) // '<svg …>…</svg>'
63
67
  Béziers between them).
64
68
  - `parsePath(d)` / `serializePath(subpaths)`: path data as editable nodes with
65
69
  absolute handles, and back. Round trips are idempotent after the first pass.
70
+ - `centerline(rgba, width, height, options)` / `traceCenterline(…)`: single
71
+ strokes down the middle of the ink, for pen plotters and engraving, with the
72
+ stroke width measured from the ink (or set).
66
73
  - `detectSymmetry(rgba, width, height)`: the likeliest mirror axes and
67
74
  rotational orders in an image, each scored by how much of the drawing
68
75
  matches (the app offers to enforce one at 95% or more).
package/dist/index.d.ts CHANGED
@@ -47,6 +47,11 @@ type FitOptions = {
47
47
  * or a regular polygon as that exact shape (see shapes.ts). Default false.
48
48
  */
49
49
  shapes?: boolean;
50
+ /**
51
+ * Make lines within 1° of horizontal, vertical or 45° exactly that (see
52
+ * `snapLines`). Default true; exact shapes are never snapped.
53
+ */
54
+ snap?: boolean;
50
55
  };
51
56
  /** A cubic Bézier: start, two handles, end. A straight line has handles on the chord. */
52
57
  type Cubic = [Pt, Pt, Pt, Pt];
@@ -55,11 +60,101 @@ export declare function isFlat([p0, c1, c2, p3]: Cubic): boolean;
55
60
  /**
56
61
  * Fit a chain. Open: from points[0] to the last point, which stay fixed.
57
62
  * Closed: points[0] is not repeated at the end; the result is a loop that starts
58
- * at a corner if there is one.
63
+ * at a corner if there is one. `fine`, if given, is the same chain placed more
64
+ * exactly (between pixels) and is what gets fitted, exact shapes included;
65
+ * `points` stays the pixel outline that the area check measures.
59
66
  */
60
- export declare function fitChain(points: Pt[], closed: boolean, o: FitOptions): Cubic[];
67
+ export declare function fitChain(points: Pt[], closed: boolean, o: FitOptions, fine?: Pt[]): Cubic[];
61
68
  export declare function pointAt(b: Cubic, t: number): Pt;
62
69
  //#endregion
70
+ //#region src/palette.d.ts
71
+ /**
72
+ * Palette extraction for flat artwork.
73
+ *
74
+ * VTracer's own quantizer averages each cluster, so a flat colour that borders
75
+ * a lighter one drifts towards it: on the sample badge the gold sun (#e9a23b)
76
+ * came out pale peach (#e9c38f) — wrong enough to break a brand colour. Flat
77
+ * art has a property quantizers ignore: its real colours are sharp *peaks* in
78
+ * the histogram, and everything between them (anti-aliasing, JPEG ringing) is
79
+ * a thin spread of low-count shades. So instead of clustering, take the peaks:
80
+ *
81
+ * 1. Histogram at 5 bits per channel, keeping each bin's true mean colour.
82
+ * 2. Weigh each bin by the pixels within half the distinct-colour distance of
83
+ * it (OKLab), so a colour spread over several bins counts in full.
84
+ * 3. Walk bins from heaviest to lightest; accept a bin as a new colour only
85
+ * if it is perceptually distinct (OKLab distance) from every colour already
86
+ * accepted, and its weight is a meaningful share of the image. A smaller
87
+ * share (a decal, lettering) is still a colour if it isn't a blend of two
88
+ * colours already accepted (an anti-aliased edge between them).
89
+ * 4. Stop at the requested count.
90
+ * 5. Given the image's `width`, fill what's left of the count with pale tints:
91
+ * light flat colours (pixels that match their four neighbours) too close to a
92
+ * picked colour for step 3. A light-blue fill on white is 0.03 from it in
93
+ * OKLab and lies on the line from white to the blue ink, so step 3 calls
94
+ * it an edge between the two; but an edge is never flat, and a fill is.
95
+ *
96
+ * This is for logos and illustrations. Photos have no peaks (on a photo the
97
+ * peaks raised mean error from 9.9 to 15.3), so they use `quantizePalette`.
98
+ */
99
+ type Rgb = [number, number, number];
100
+ export declare function peakPalette(rgba: ArrayLike<number>, maxColors: number, { minDistance, minShare, minDetail, width, minTint, minFlat }?: {
101
+ minDistance?: number;
102
+ minShare?: number;
103
+ minDetail?: number;
104
+ width?: number;
105
+ minTint?: number;
106
+ minFlat?: number;
107
+ }): string[];
108
+ export declare function oklab([r, g, b]: Rgb): Rgb;
109
+ /**
110
+ * A photo's palette: `maxColors` colours that best summarise it, by k-means in
111
+ * OKLab (so the clusters are perceptual, not RGB boxes).
112
+ *
113
+ * It clusters a 5-bit-per-channel histogram, each bin weighted by its pixel
114
+ * count, rather than the pixels themselves: the same answer to within a bin,
115
+ * at a fraction of the work. It's deterministic: the first centre is the most
116
+ * common colour, and each next one is the colour farthest from those chosen,
117
+ * weighted by how common it is (k-means++ without the dice), so a photo traces
118
+ * the same way every time. Each colour returned is the true mean of the pixels
119
+ * in its cluster, most common first. `maxColors` is rounded and taken as at
120
+ * least 1 (so 0 or NaN gives one colour); fewer come back when the image has
121
+ * fewer distinct colours, and none when every pixel is transparent.
122
+ */
123
+ export declare function quantizePalette(rgba: ArrayLike<number>, maxColors: number, { iterations }?: {
124
+ iterations?: number;
125
+ }): string[];
126
+ /**
127
+ * Pixel art's palette: its colours exactly, most-used first. Pixel art has a
128
+ * handful of deliberate colours, and a one-pixel eye matters as much as the
129
+ * sky, so nothing is merged or dropped for being rare or close to another.
130
+ * Beyond `maxColors` distinct colours (a photo picked as pixel art), the
131
+ * rarest ones take their nearest kept colour when pixels are labelled.
132
+ */
133
+ export declare function exactPalette(rgba: ArrayLike<number>, maxColors: number): string[];
134
+ //#endregion
135
+ //#region src/gradient.d.ts
136
+ type GradientStop = {
137
+ offset: number;
138
+ color: string;
139
+ };
140
+ /** Coordinates in the trace's pixels (gradientUnits="userSpaceOnUse"). */
141
+ type Gradient = {
142
+ type: 'linear';
143
+ x1: number;
144
+ y1: number;
145
+ x2: number;
146
+ y2: number;
147
+ stops: GradientStop[];
148
+ } | {
149
+ type: 'radial';
150
+ cx: number;
151
+ cy: number;
152
+ r: number;
153
+ stops: GradientStop[];
154
+ };
155
+ /** A gradient's colour at a point. */
156
+ export declare const colorAt: (g: Gradient, x: number, y: number) => Rgb;
157
+ //#endregion
63
158
  //#region src/inlay.d.ts
64
159
  type InlayOptions = FitOptions & {
65
160
  /** Regions smaller than speckle × speckle pixels are merged into their surroundings. */
@@ -72,15 +167,51 @@ type InlayOptions = FitOptions & {
72
167
  pixels?: boolean;
73
168
  /**
74
169
  * Stacked shapes, for photos: each region is drawn whole, without the holes
75
- * other regions sit in, and larger shapes come first so smaller ones paint
76
- * over them. Every hole's outline is exactly the outline of what fills it,
77
- * so the picture is the same as cut-out shapes, with less path data (each
78
- * hole isn't drawn a second time) and no hairline seams where anti-aliased
79
- * edges meet. A hole with transparency anywhere inside it, however deep, is
170
+ * other regions sit in, larger shapes first so smaller ones paint over them,
171
+ * and reaching under every neighbour painted after it. So each shared edge
172
+ * is drawn once, by the later shape over the earlier one's colour, and no
173
+ * hairline seam shows where anti-aliased edges meet (on photos, 12% closer
174
+ * to the photo than without, for about a third more path data). A hole with transparency anywhere inside it, however deep, is
80
175
  * kept, so transparency stays transparent. Default: cut out, which is what a
81
176
  * vinyl cutter or a screen printer wants.
177
+ *
178
+ * For flat art (not `photo`) it means layers instead: shapes in front-to-back
179
+ * order, each whole. Which of two touching shapes is in front is read from
180
+ * the junctions where their boundary ends, and a shape behind another is
181
+ * completed under it (its circle, its corner, or a smooth continuation),
182
+ * so a moon behind a bar is one disc. Holes that later shapes fill are
183
+ * dropped, as for photos.
82
184
  */
83
185
  stacked?: boolean;
186
+ /**
187
+ * Photos: specks join the colour they share the most edge with, and slivers
188
+ * are left alone. Flat art's clean-up (specks join the nearest colour, and
189
+ * slivers of one ink's two shades fold together) keeps thin strokes whole,
190
+ * but on photos it kept so many real regions that files grew by half.
191
+ */
192
+ photo?: boolean;
193
+ /**
194
+ * Outline art: draw thin lines of ink as lines. A colour that is mostly
195
+ * thin, long regions (outlines, small lettering) is traced down its middle
196
+ * as round-capped strokes of the width measured from it, and the shapes
197
+ * around each line grow to meet under it, so a line can be moved or
198
+ * restyled without a gap opening. Palette mode only; ignored for photos
199
+ * and pixel art.
200
+ */
201
+ strokes?: boolean;
202
+ /**
203
+ * How many times the drawing was enlarged before tracing (an upscaled small
204
+ * image, or a full-size trace of one usually traced smaller). The widths
205
+ * `strokes` takes as lines (2.5–8 px) grow with it. Default 1.
206
+ */
207
+ scale?: number;
208
+ /**
209
+ * Soft shading as gradients: neighbouring tints that are bands of one
210
+ * smooth shade become one shape with a linear or radial gradient, when it
211
+ * fits much better than a flat colour (gradient.ts). Palette mode only, not
212
+ * pixel art. Off by default: a cutter or a plotter can't draw a gradient.
213
+ */
214
+ gradients?: boolean;
84
215
  } & (
85
216
  /**
86
217
  * `merge` folds colours together before any region is built, so the edge
@@ -93,18 +224,28 @@ type InlayOptions = FitOptions & {
93
224
  merge?: Record<string, string>;
94
225
  } |
95
226
  /**
96
- * Ink is darker than `threshold` (0–255). When null, each pixel is compared
97
- * with its neighbourhood instead, for photos of paper under uneven light.
227
+ * Ink is darker than `threshold` (0–255). With 'auto', the threshold is
228
+ * the image's own split between ink and paper (Otsu's), so coloured ink
229
+ * works as well as black (a page with no clear ink, such as a blank
230
+ * scan, falls back to 128). When null, each pixel is compared with its
231
+ * neighbourhood instead, for photos of paper under uneven light.
98
232
  * Only ink is drawn.
99
233
  */
100
234
  {
101
235
  mode: 'binary';
102
- threshold: number | null;
236
+ threshold: number | 'auto' | null;
103
237
  });
104
- /** One filled shape: path data (M/L/C/Z, absolute, nonzero fill) and its colour. */
238
+ /**
239
+ * One filled shape: path data (M/L/C/Z, absolute, nonzero fill) and its
240
+ * colour. With `stroke` (a width in px), a line drawn in that colour instead,
241
+ * with round caps and joins. With `gradient`, the shape is filled with it, and
242
+ * `fill` is its average colour, for anything that can only draw flat colour.
243
+ */
105
244
  type InlayPath = {
106
245
  d: string;
107
246
  fill: string;
247
+ stroke?: number;
248
+ gradient?: Gradient;
108
249
  };
109
250
  /** A trace: the drawing's size in pixels and its shapes, largest first (paint order). */
110
251
  type InlayResult = {
@@ -133,57 +274,38 @@ export declare function mergeLabels(labels: Int32Array, colors: string[], merge:
133
274
  /** Otsu's threshold over opaque pixels: the split that best separates two populations. */
134
275
  export declare function otsu(lum: Uint8Array, alpha: Uint8Array): number;
135
276
  //#endregion
136
- //#region src/palette.d.ts
137
- /**
138
- * Palette extraction for flat artwork.
139
- *
140
- * VTracer's own quantizer averages each cluster, so a flat colour that borders
141
- * a lighter one drifts towards it: on the sample badge the gold sun (#e9a23b)
142
- * came out pale peach (#e9c38f) — wrong enough to break a brand colour. Flat
143
- * art has a property quantizers ignore: its real colours are sharp *peaks* in
144
- * the histogram, and everything between them (anti-aliasing, JPEG ringing) is
145
- * a thin spread of low-count shades. So instead of clustering, take the peaks:
146
- *
147
- * 1. Histogram at 5 bits per channel, keeping each bin's true mean colour.
148
- * 2. Walk bins from most to least frequent; accept a bin as a new colour only
149
- * if it is perceptually distinct (OKLab distance) from every colour already
150
- * accepted, and holds a meaningful share of the image.
151
- * 3. Stop at the requested count.
152
- *
153
- * This is for logos and illustrations. Photos have no peaks (on a photo the
154
- * peaks raised mean error from 9.9 to 15.3), so they use `quantizePalette`.
155
- */
156
- type Rgb = [number, number, number];
157
- export declare function peakPalette(rgba: ArrayLike<number>, maxColors: number, { minDistance, minShare }?: {
158
- minDistance?: number;
159
- minShare?: number;
160
- }): string[];
161
- export declare function oklab([r, g, b]: Rgb): Rgb;
162
- /**
163
- * A photo's palette: `maxColors` colours that best summarise it, by k-means in
164
- * OKLab (so the clusters are perceptual, not RGB boxes).
165
- *
166
- * It clusters a 5-bit-per-channel histogram, each bin weighted by its pixel
167
- * count, rather than the pixels themselves: the same answer to within a bin,
168
- * at a fraction of the work. It's deterministic: the first centre is the most
169
- * common colour, and each next one is the colour farthest from those chosen,
170
- * weighted by how common it is (k-means++ without the dice), so a photo traces
171
- * the same way every time. Each colour returned is the true mean of the pixels
172
- * in its cluster, most common first. `maxColors` is rounded and taken as at
173
- * least 1 (so 0 or NaN gives one colour); fewer come back when the image has
174
- * fewer distinct colours, and none when every pixel is transparent.
175
- */
176
- export declare function quantizePalette(rgba: ArrayLike<number>, maxColors: number, { iterations }?: {
177
- iterations?: number;
178
- }): string[];
179
- /**
180
- * Pixel art's palette: its colours exactly, most-used first. Pixel art has a
181
- * handful of deliberate colours, and a one-pixel eye matters as much as the
182
- * sky, so nothing is merged or dropped for being rare or close to another.
183
- * Beyond `maxColors` distinct colours (a photo picked as pixel art), the
184
- * rarest ones take their nearest kept colour when pixels are labelled.
185
- */
186
- export declare function exactPalette(rgba: ArrayLike<number>, maxColors: number): string[];
277
+ //#region src/centerline.d.ts
278
+ type CenterlineOptions = {
279
+ /** Ink is darker than this (0–255); 'auto' splits ink from paper by the image's histogram (Otsu); null compares each pixel with its neighbourhood instead. */
280
+ threshold: number | 'auto' | null;
281
+ /** Ink and paper regions smaller than speckle × speckle pixels are folded into their surroundings. */
282
+ speckle: number;
283
+ /** Max distance in pixels between the skeleton and the fitted stroke. */
284
+ tolerance: number;
285
+ /** Turns sharper than this (degrees from straight) are corners. */
286
+ cornerAngle: number;
287
+ /** The stroke width in pixels; measured from the ink when left out. */
288
+ strokeWidth?: number;
289
+ /** The stroke colour. Default black. */
290
+ color?: string;
291
+ };
292
+ /** One stroked path: open subpaths (and closed loops), drawn with round caps and joins. */
293
+ type CenterlinePath = {
294
+ d: string;
295
+ stroke: string;
296
+ strokeWidth: number;
297
+ };
298
+ type CenterlineResult = {
299
+ width: number;
300
+ height: number;
301
+ paths: CenterlinePath[];
302
+ /** The stroke width measured from the ink, in pixels (whatever `strokeWidth` asked for). */
303
+ measuredWidth: number;
304
+ };
305
+ /** Trace to an SVG string; `centerline` gives the strokes as data. */
306
+ export declare const traceCenterline: (rgba: ArrayLike<number>, w: number, h: number, o: CenterlineOptions) => string;
307
+ export declare function centerlineToSvg(r: CenterlineResult): string;
308
+ export declare function centerline(rgba: ArrayLike<number>, w: number, h: number, o: CenterlineOptions): CenterlineResult;
187
309
  //#endregion
188
310
  //#region src/symmetry.d.ts
189
311
  /**
@@ -234,4 +356,4 @@ type SymmetryOptions = {
234
356
  */
235
357
  export declare function detectSymmetry(rgba: ArrayLike<number>, w: number, h: number, options?: SymmetryOptions): Symmetry[];
236
358
  //#endregion
237
- export type { Cubic, FitOptions, InlayOptions, InlayPath, InlayResult, MirrorSymmetry, PathNode, Pt, Rgb, RotationalSymmetry, Subpath, Symmetry, SymmetryOptions };
359
+ export type { CenterlineOptions, CenterlinePath, CenterlineResult, Cubic, FitOptions, Gradient, GradientStop, InlayOptions, InlayPath, InlayResult, MirrorSymmetry, PathNode, Pt, Rgb, RotationalSymmetry, Subpath, Symmetry, SymmetryOptions };