1
이 간단한 사각형 설정 코드가 있습니다.캔버스 테두리 선에 실제 색상을 설정 하시겠습니까?
검은 색 테두리가 있습니다.
그러나 검은 색은 보이지 않지만 회색은 보지 않습니다.
<!doctype html>
<html lang="en">
<canvas id="canvas" width=300 height=300></canvas>
<script>
function draw()
{
ctx.beginPath();
ctx.strokeStyle = "#000000";
ctx.strokeRect(rect.x, rect.y, rect.w, rect.h);
}
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
var rect = {
x: 10,
y: 10,
w: 40,
h: 100
};
draw();
</script>
</html>
질문 : 내가 잘못 뭐하는 거지
나는 색상을 설정할 수 있습니다 어떻게 정의로 될?
가능한 복제본 [html5 캔버스에서 단일 픽셀 선 그리기] (http://stackoverflow.com/questions/9311428/draw-single-pixel-line-in-html5- 캔버스) –
중복 중 - http://stackoverflow.com/questions/9311428/draw-single-pixel-line-in-html5-canvas –