コード
var oprtns = new Array(
"source-atop",
"source-in",
"source-out",
"source-over",
"destination-atop",
"destination-in",
"destination-out",
"destination-over",
"lighter",
"copy",
"xor"
);
for(var i=0; i<=10; i++) {
var canvas = document.getElementById('c'+i);
if ( ! canvas || ! canvas.getContext ) { continue; }
var ctx = canvas.getContext('2d');
/* 元となるイメージを描画(青色の矩形) */
ctx.fillStyle = "blue";
ctx.fillRect(10, 10, 60, 60);
/* 合成演算子をセット */
ctx.globalCompositeOperation = oprtns[i];
/* 対象のイメージを描画(赤色の円) */
ctx.beginPath();
ctx.fillStyle = "red";
ctx.arc(60, 60, 30, 0, Math.PI*2, false);
ctx.fill();
/* 補助線 */
ctx.globalCompositeOperation = "source-over";
ctx.strokeStyle = "#aaaaaa";
ctx.strokeRect(10, 10, 60, 60);
ctx.beginPath();
ctx.arc(60, 60, 30, 0, Math.PI*2, false);
ctx.stroke();
}