Node / Canvas · guide
Canvas paint order (reference)
Current Apexify.js 6.0.0 documentation for Canvas paint order (reference).
This page describes CanvasCreator.createCanvas so you can predict what covers what.
Steps
- Validate
CanvasConfig(sizes, selectors,bgLayers, primary-background mutex). - If
videoBgis active, extract the selected frame once. - If
customBg.inheritorvideoBg.inheritis true, adopt the decoded still-image dimensions. - Defaults:
width/heightfall back to 500 if still unset. shadowpaints first, outside the background clip, so offsets can extend beyond the background while the background itself remains above the shadow.- Context: canvas opacity, rotation,
buildPath+ clip, internal zoom, translate, blendMode. - Primary background:
videoBg→ extracted still → shared image-background pipeline (inherit / fit / align / filters / opacity)- else
customBg→ the same shared image-background pipeline - else
gradientBg→drawBackgroundGradient - else
colorBgdefined →drawBackgroundColor - else
transparentBase→ skip fill - else →
drawBackgroundColorwith#000
bgLayers→drawBackgroundLayersin order.patternBg→EnhancedPatternRenderer.renderPatternnoiseBg→applyNoise- Restore the clipped background group.
strokepaints around the final canvas shape.toBuffer('image/png')
Design takeaway
Later background steps paint on top: noiseBg beats patternBg beats bgLayers beats the primary fill. The canvas shadow is an underlay painted before the background; the stroke is the final edge treatment.