DocumentationDynamic Media Image Serving and Rendering API

clipPath

Last update: August 31, 2023
  • Topics:
  • Dynamic Media Classic,SDK/API

CREATED FOR:

  • Developer
  • User

Layer Clip Path. Specifies a clip path for the current layer.

clipPath= *pathDefinition*

clipPathE= *pathName**[, *pathName*]

pathDefinitionPath data.
pathNameName of path embedded in layer source image (ASCII only).

Any parts of the layer that falls outside the area defined by clipPath= are rendered transparent.

*pathName* is the name of a path embedded in the layer source image. The path is automatically transformed to maintain relative alignment with the image contents. If more than one *pathName* is specified, the server clips the image to the intersection of these paths. Any *pathName* not found in the source image is ignored.

NOTE
Only ASCII strings are supported for *pathName*.

*pathDefinition* allows specifying explicit path data in layer pixel coordinates.

If size= is specified and not 0,0, the layer is presized. In this case, path coordinates are relative to the upper-left corner of the layer rectangle and the layer is positioned based on origin= or its default. Any regions of the path outside the layer rectangle remain transparent.

If size= is not specified for a solid color or text layer, the layer is considered self-sizing with the extent of the path determining its size. If origin= is not specified, it defaults to (0,0) of the path coordinate space. This workflow process effectively allows path coordinates to be specified relative to the origin of layer 0.

NOTE
scale=, rotate=, and anchor= commands are not permitted for self-sizing solid color layers.

*pathDefinition* accepts a string similar to the value of the d= attribute of the SVG <path> element, except that commas are used instead of spaces to separate values. *pathDefinition* can include one or more closed-loop subpaths.

The following path commands are supported in *pathDefinition*:

CommandNameDescription
M x,ymoveto absoluteStart a new subpath at x,y.
m x,ymoveto relative
L *{ x,y}lineto absoluteDraw a line from the current position to x,y.
l *{ x,y}lineto relative
C *{ x1,y1,x2,y2,x,y}curveto absoluteDraw a Bezier curve from the current position to x,y. x1,y1 is the control point at the beginning of the curve and x2,y2 is the control point at the end of the curve.
c *{ x1,y1,x2,y2,x,y}curveto relative
Z | zclosepathClose the current subpath with a straight line.

Uppercase commands indicate that the coordinate values are in absolute pixel positions (relative to the upper-left of the layer rectangle). Pixel offsets follow lowercase commands relative to the current position.

‘m’ or ‘M’ always starts a new subpath. Subpaths are closed automatically (with a straight line) if ‘Z’ or ‘z’ is not specified at the end.

If a subpath begins with a relative moveto (‘m’), it is relative to one of the following:

  • The starting point of the previous subpath, if it was closed with ‘z’ or ‘Z’.
  • The end point of the previous subpath, if it was not closed explicitly.
  • 0,0, if it is the first subpath.

Properties

Layer attribute. Applies to the current layer or to the composite image if layer=comp. Effect layers ignore it.

The modifier clipPathE= is ignored if no path with the specified name is found in the layer source image, or if the layer source is not an image.

Default

None, for no additional clipping of the layer.

See also

clipXpath= , textFlowPath= , extend=

recommendation-more-help
a26166cd-f2f4-45ce-996d-96a0f0d6cf49