CanvasCompositeOp

Compositing operation for blending new drawing and old pixels. The sourceCopy, sourceIn, sourceOut, destinationAtop, and destinationIn operations may clear parts of the canvas outside the new drawing but within the clip region. Defaults to: sourceOver.

Values

ValueMeaning
sourceIn1

Replace old with new where old was opaque.

sourceCopy

Replace old with new.

sourceOut

Replace old with new where old is transparent.

destinationIn

Clear old where new is transparent.

destinationAtop7

Show old over new where new is opaque.

add10

Sum old with new.

lighter10

ditto

destinationOver

Show new under old.

destinationOut

Clear old where new is opaque.

sourceAtop

Show new over old where old is opaque.

sourceOver

Show new over old.

exclusiveOr

Show new and old, clear where both are opaque.

Meta