HTML 캔버스의 fill() 메서드는 현재 그리기 경로를 채우는 데 사용됩니다. 기본값은 검은색입니다.
다음은 구문입니다-
ctx.fill();
이제 캔버스의 fill() 메서드를 구현하는 예를 살펴보겠습니다.
예시
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="450" height="250" style="border:2px solid blue;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.rect(50, 60, 300, 200);
ctx.fillStyle = "green";
ctx.fill();
</script>
</body>
</html> 출력
