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:
@@ -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(),
|
||||
});
|
||||
@@ -138,4 +138,6 @@ export interface TraceResult {
|
||||
svg: string;
|
||||
/** Parsed shape, present when `format` is `shape`. */
|
||||
shape?: TracedShape;
|
||||
/** Inset (negative) or outset (positive) applied to the shape, in pixels. */
|
||||
offset?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user