경로를 사용하여 이러한 문자를 그릴 수 있습니다. 그러나 내가하고 싶은 것은 그 길을 사용하고 글자를 채워 넣는 대신 붉은 색 이미지가 보여주는 것을 채워 넣는 것입니다.경로 외부를 어떻게 채울 수 있습니까?
이 내가하고 싶은 것입니다 :
function mattes_draw_letter(x, y, width, height, letter, position)
{
var canvas = document.createElement('canvas');
canvas.style.position = "absolute";
canvas.style.top = y + "px";
canvas.id = "canvas_opening_" + position;
canvas.style.zIndex = 5;
canvas.width = width;
canvas.height = height;
canvas.style.left = x + "px";
var ctx = canvas.getContext("2d");
ctx.lineWidth = 1;
ctx.fillStyle = '#bfbfbf';
ctx.strokeStyle = '#000000';
ctx.beginPath();
ctx.moveTo(letter[0] * width, letter[1] * height);
for (i = 0; i < letter.length; i+=2)
{
if (typeof letter[i+3] !== 'undefined')
{
ctx.lineTo(letter[i+2] * width, letter[i+3] * height);
}
}
ctx.fill();
ctx.stroke();
ctx.closePath();
$("#mattes").append(canvas);
canvas.addEventListener("drop", function(event) {drop(event, this);}, false);
canvas.addEventListener("dragover", function(event) {allowDrop(event);}, false);
canvas.addEventListener("click", function() {photos_add_selected_fid(this);}, false);
}
이 내가 현재 가지고있는 것입니다 : 여기
내가 사용하고있는 코드입니다
당신이 당신의 HTML 코드를 공유 할 수 있습니다 호프 문자를 가정
는이 같은 HOPE 문자 뒤에 빨간색 사각형을 추가 할 수 있습니다 투명한 배경 위에 그려? [jsfiddle] (http://jsfiddle.net)이 도움이 될 것입니다. –