var n = []; var e = document.createElement('canvas'); var ctx = e.getContext('2d'); e.width = 2e3; e.height = 200; e.style.display = 'inline'; ctx.rect(0, 0, 11, 11); ctx.rect(3, 3, 6, 6); n.push('canvas winding:' + (!1 === ctx.isPointInPath(5, 5, 'evenodd') ? 'yes' : 'no')); ctx.textBaseline = 'alphabetic'; ctx.fillStyle = '#f60'; ctx.fillRect(125, 1, 62, 20); ctx.fillStyle = '#069'; ctx.font = '11pt Arial'; ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 2, 15); ctx.fillStyle = 'rgba(102, 204, 0, 0.7)'; ctx.font = '18pt Arial'; ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 4, 45); ctx.globalCompositeOperation = 'multiply'; ctx.fillStyle = 'rgb(255,0,255)'; ctx.beginPath(); ctx.arc(52, 50, 50, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); ctx.fillStyle = 'rgb(0,255,255)'; ctx.beginPath(); ctx.arc(100, 50, 50, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); ctx.fillStyle = 'rgb(255,255,0)'; ctx.beginPath(); ctx.arc(75, 100, 50, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); ctx.fillStyle = 'rgb(255,0,255)'; ctx.arc(75, 75, 75, 0, Math.PI * 2, true); ctx.arc(75, 75, 25, 0, Math.PI * 2, true); ctx.fill('evenodd'); n.push('canvas fp:' + e.toDataURL()); console.log(n)
标签:fp,canvas,ctx,fillStyle,75,arc,Math,255 From: https://www.cnblogs.com/angdh/p/16871738.html