blob: d4081f1804a7db9817d5505c5c50701169436d9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<!DOCTYPE html>
<html>
<body>
<canvas id="canvas" width="100" height="100"></canvas>
<script>
var c = document.getElementById("canvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.globalCompositeOperation = "copy";
ctx.fillStyle = "green";
ctx.fillRect(0, 0, 50, 50);
</script>
</body>
</html>
|