feat(proxy): add offset param to inset or outset traced shapes

Trace results can now be inset (negative) or outset (positive) by a
pixel amount. Offset the outline and holes in opposite directions with
clipper-lib's miter joins, then recombine with a boolean difference so
holes grow on inset and shrink on outset. Collapsed shapes return an
empty outline; a split outline keeps the largest ring. Document the
parameter and the new dependency.
This commit is contained in:
2026-08-08 15:37:27 +08:00
parent c7f4bd03fd
commit 9094ad58e0
12 changed files with 284 additions and 17 deletions
+2
View File
@@ -65,4 +65,6 @@ export const traceRequestSchema = z.object({
format: traceFormatSchema.default('shape'),
simplify: z.coerce.number().min(0).optional(),
maxColors: z.coerce.number().int().min(1).optional(),
/** Inset (negative) or outset (positive) the traced shape, in pixels. */
offset: z.coerce.number().optional(),
});