{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/node-canvas/issues/726","repository_url":"https://api.github.com/repos/Automattic/node-canvas","labels_url":"https://api.github.com/repos/Automattic/node-canvas/issues/726/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/node-canvas/issues/726/comments","events_url":"https://api.github.com/repos/Automattic/node-canvas/issues/726/events","html_url":"https://github.com/Automattic/node-canvas/issues/726","id":137072674,"number":726,"title":"canvas how to reset?  it is overlap!","user":{"login":"V-Tom","id":8033489,"avatar_url":"https://avatars.githubusercontent.com/u/8033489?v=3","gravatar_id":"","url":"https://api.github.com/users/V-Tom","html_url":"https://github.com/V-Tom","followers_url":"https://api.github.com/users/V-Tom/followers","following_url":"https://api.github.com/users/V-Tom/following{/other_user}","gists_url":"https://api.github.com/users/V-Tom/gists{/gist_id}","starred_url":"https://api.github.com/users/V-Tom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/V-Tom/subscriptions","organizations_url":"https://api.github.com/users/V-Tom/orgs","repos_url":"https://api.github.com/users/V-Tom/repos","events_url":"https://api.github.com/users/V-Tom/events{/privacy}","received_events_url":"https://api.github.com/users/V-Tom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-28T17:06:05Z","updated_at":"2016-02-29T15:07:22Z","closed_at":null,"body":"here are my code on Node.js\r\n\r\n```\r\nconst Canvas = require('canvas'),\r\n  canvas = new Canvas(1000, 200),\r\n  ctx = canvas.getContext('2d');\r\nclass App {\r\n  constructor(length) {\r\n    this.verifyCodeLength = length || 8;\r\n    this._init();\r\n  };\r\n\r\n  _init() {\r\n  };\r\n\r\n  _getRandomCode() {\r\n    var key = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPRSTUVWXYZ1234567890'.split('');\r\n    var code = '', i, length = key.length;\r\n    for (i = 0; i < this.verifyCodeLength; i++) {\r\n      code += key[Math.round(Math.random() * (length - 1))];\r\n    }\r\n    return code;\r\n  };\r\n\r\n  _setCodeStyle(code) {\r\n   ctx.font = '30px';\r\n    ctx.rotate(.1);\r\n    for (var i = 0; i < this.verifyCodeLength; i++) {\r\n      ctx.fillText(code[i], 65 * i, 100);\r\n    }\r\n    var te = ctx.measureText(code);\r\n    ctx.strokeStyle = 'rgba(0,0,0,0.5)';\r\n    ctx.beginPath();\r\n    ctx.lineTo(50, 102);\r\n    ctx.lineTo(50 + te.width, 102);\r\n    ctx.stroke();\r\n  };\r\n\r\n  getCodeBase64() {\r\n    var code = this._getRandomCode();\r\n    this._setCodeStyle(code);\r\n    return {\r\n      canvas: canvas,\r\n      code: code\r\n    };\r\n  }\r\n}\r\nmodule.exports = App;\r\n```\r\n\r\nI use it to generate a verification code, and then return to the external call out on a canvas base64 and images overlap, how can I eliminate  the overlap portion?\r\n\r\n`canvas.clear()`\r\n `ctx. clearRect()` \r\nboth does not work.\r\n\r\nI hope you can help me.\r\nthanks."},"comment":{"url":"https://api.github.com/repos/Automattic/node-canvas/issues/comments/190250613","html_url":"https://github.com/Automattic/node-canvas/issues/726#issuecomment-190250613","issue_url":"https://api.github.com/repos/Automattic/node-canvas/issues/726","id":190250613,"user":{"login":"zbjornson","id":469365,"avatar_url":"https://avatars.githubusercontent.com/u/469365?v=3","gravatar_id":"","url":"https://api.github.com/users/zbjornson","html_url":"https://github.com/zbjornson","followers_url":"https://api.github.com/users/zbjornson/followers","following_url":"https://api.github.com/users/zbjornson/following{/other_user}","gists_url":"https://api.github.com/users/zbjornson/gists{/gist_id}","starred_url":"https://api.github.com/users/zbjornson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbjornson/subscriptions","organizations_url":"https://api.github.com/users/zbjornson/orgs","repos_url":"https://api.github.com/users/zbjornson/repos","events_url":"https://api.github.com/users/zbjornson/events{/privacy}","received_events_url":"https://api.github.com/users/zbjornson/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T15:07:22Z","updated_at":"2016-02-29T15:07:22Z","body":"My mistake, min and max are switched there. PR coming soon. Thanks."}}