Appearance
Function: clipPath() ​
clipPath(
shape,w,h):GeometryPoint[]
Resolve a ClipShape to a freeform points path filling a w × h box, ready to hand to addImage({ points }).
w/h are the image box's size in inches and must match the w/h the picture is drawn at — the path is emitted in the box's own coordinate space, not normalized (see the module note above).
Parameters ​
| Parameter | Type | Description |
|---|---|---|
shape | ClipShape | the named silhouette and its options |
w | number | image box width (inches) |
h | number | image box height (inches) |
Returns ​
the freeform path, for addImage({ points })
Throws ​
clip/invalid-shape when kind, flat or preset is not one the silhouette names. From JavaScript an unknown preset used to fail reading a field off undefined, an unknown kind returned nothing and an unknown flat side traced the right-flat path.
Example ​
ts
const w = 5.22, h = 7.5
slide.addImage({
path: 'cover.jpg', x: 0, y: 0, w, h,
points: clipPath({ kind: 'half-disc', flat: 'right' }, w, h),
sizing: { type: 'cover' }, // center-crop the photo into the "D"
})