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

Node / Images Shapes · guide

Bitmap paint order — implementation reference

Current Apexify.js 6.0.0 documentation for Bitmap paint order — implementation reference.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

This section documents ImageCreator.drawImageBitmap so you can predict which combinations silently skip steps.

Legend:

  • ✓ runs in normal circumstances
  • ✗ skipped because the method returns early
  • — not applicable for shapes (source is ShapeType)

Shape layers (source ∈ ShapeType)

Executed via drawShape:

  1. blendMode, rotation, opacity, blur
  2. shadow (heart/star ⇒ shape shadow helper · otherwise rectangular applyShadow)
  3. boxBackground
  4. Optional borderRadius clip (rectangle path, not clipPath)
  5. filters ONCE (no filterIntensity scaling, filterOrder ignored) → applyContextImageFilters over width × height
  6. drawShape fill
  7. stroke via applyShapeStroke following vector geometry

Unsupported on shapes: mask, distortion, meshWarp, clipPath, effects, fit/align (no raster sampling).


Bitmap layers (source path / Buffer)

Inside drawImageBitmap:

StageStep
LayoutResolve inherit, width/height, load bitmap
AtmosphereblendMode · rotation
PlateapplyShadow (box) · drawBoxBackground
ClipclipPath if ≥ 3 pts, else buildPath using borderRadius + borderPosition · clip()
Raster placementfitInto → dx, dy, dw, dh · opacity · blur filter

Branching:

A. filters && filterOrder === 'pre'

  1. Paint cropped bitmap into temp canvas (dw × dh).
  2. Apply filters (with filterIntensity scaling).
  3. drawImage temp onto main canvas inside clip.
  4. RETURN → ✗ distortion, ✗ meshWarp, ✗ mask composite path for main branch, ✗ filterOrder: 'post' filters, ✗ effects, ✗ stroke.

B. distortion.type === 'perspective' with 4 points

Runs applyPerspectiveDistortion → RETURN → same ✗ list as A for downstream stages.

C. distortion.type bulge / pinch

Runs applyBulgeDistortion → RETURN → same ✗ list.

D. meshWarp.controlPoints present

Runs applyMeshWarp → RETURN → same ✗ list.

E. Default raster path

  1. mask ? applyImageMask : drawImage (respecting sx,sy,sw,sh crop).
  2. Reset filter / globalAlpha · restore clip stack frame.

Still outside early returns:

  1. filters && filterOrder === 'post' → snapshots box ImageData, filters (**with **filterIntensity****), clears box, redraws — ✓
  2. effects → vignette / flare direct · chromatic aberration / grain via buffers — ✓
  3. applyStroke on box — ✓

Final restore pops outer save from blendMode.


Cheat sheet table

Feature comboStrokePost filtersEffects
Default bitmap✓✓✓
filterOrder: 'pre'✗✗✗
perspective / bulge / pinch✗✗✗
meshWarp✗✗✗

Grouped composite

See Grouped layers: ordering mixes groupTransform shadows/clips, optional pre-filter early exit, transform stack, post-filter estimation rectangle, effects, then stroke on groupBox.


Next steps