Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Node / Images Shapes · guide

Drop shadow & stroke (ShadowOptions, StrokeOptions)

Current Apexify.js 6.0.0 documentation for Drop shadow & stroke (ShadowOptions, StrokeOptions).

apexify.jsRuntime: nodeCURRENTSince 6.0.0

Shadows and strokes are layer-level options on ImageProperties (and on groupTransform for grouped composites). They apply to bitmaps and shapes, with one shadow quirk for complex shapes.

Types ShadowOptions and StrokeOptions are exported from apexify.js (see types/common).


Shadow — shadow?: ShadowOptions

FieldTypeRole
colorstringShadow colour
gradientgradientOptional shadow fill as gradient
offsetX / offsetYnumberPixel offset from the layer
blurnumberBlur radius
opacitynumberOpacity multiplier where supported
borderRadiusnumber | 'circular'Rounded shadow only for the rectangular fast path
roundedCornersborderPositionWhich corners get borderRadius on the shadow rect
borderPositionborderPositionDeprecated alias of roundedCorners

Bitmap shadow

For images, the shadow is cast from the layout box (x, y, width, height) before the image is clipped — so borderRadius / clipPath crop the bitmap but the shadow still reads as a natural drop shadow.

Shape shadow

  • rectangle, circle, triangle, trapezium, polygon, arc, pieSlice, square: use the rectangular shadow (same as bitmaps) for the layout box.
  • heart and star: use a geometry-accurate shadow (outline-based), so borderRadius on shadow does not apply the same way.
SOURCEtypescript
typescript
Studio
await painter.createImage(  {    source: './card.png',    x: 48,    y: 48,    width: 320,    height: 180,    fit: 'cover',    borderRadius: 16,    borderPosition: 'all',    shadow: {      color: '#00000055',      offsetX: 0,      offsetY: 12,      blur: 24,      borderRadius: 16,      roundedCorners: 'all',    },  },  buffer);

Stroke — stroke?: StrokeOptions

FieldTypeRole
colorstringStroke colour
gradientgradientStroke along path with gradient
widthnumberLine width in pixels
positionnumberInset/outset tuning (renderer-specific)
blurnumberExtra softness on stroke
opacitynumberStroke opacity
borderRadiusnumber | 'circular'For box strokes (bitmaps / rect shadow box)
borderPosition / roundedCornersborderPositionWhich edges or corners participate (see Styling & clip)
style'solid' | 'dashed' | …Line style

Bitmap stroke

Strokes run after the image itself, filters, and effects — see Paint order. The stroke follows the layout box (with optional rounded corners), not the alpha silhouette of the PNG.

Shape stroke

Stroke follows the real shape path (star, heart, polygon, arc, …), using the same shape fields as the fill so outline and fill stay aligned.

SOURCEtypescript
typescript
Studio
await painter.createImage(  {    source: 'circle',    x: 100,    y: 80,    width: 160,    height: 160,    shape: { fill: true, color: '#e0e7ff' },    stroke: { color: '#3730a3', width: 6, style: 'solid' },  },  buffer);

Known limitations (bitmaps)

If you use filterOrder: 'pre', distortion, or meshWarp, the bitmap path returns early in the implementation: stroke, effects, and post filters may not run. See Paint order for the exact table.


Next steps