{"id":115089,"date":"2026-10-11T05:41:20","date_gmt":"2026-10-10T21:41:20","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115089.html"},"modified":"2026-10-11T05:41:20","modified_gmt":"2026-10-10T21:41:20","slug":"%e7%a6%bb%e5%b1%8f-canvas-%e6%96%87%e5%ad%97%e6%b8%85%e6%99%b0%e5%ba%a6%e7%bb%88%e6%9e%81%e6%8c%87%e5%8d%97%ef%bc%9a%e8%a7%a3%e5%86%b3-retina-%e5%b1%8f%e5%ad%97%e4%bd%93%e5%8f%91%e8%99%9a%e4%b8%8e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115089.html","title":{"rendered":"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010214115-6acab0fb4b67d.png\" alt=\"\u5c01\u9762\u4fe1\u606f\u56fe\" \/><\/p>\n<p>\u5728\u590d\u6742\u7684\u6570\u636e\u53ef\u89c6\u5316\u770b\u677f\u3001\u91d1\u878d\u4ea4\u6613\u5206\u65f6\u56fe\u3001\u6216\u8005\u56fe\u7f16\u8f91\u5668\u7684\u8282\u70b9\u6e32\u67d3\u4e2d&#xff0c;\u5f88\u591a\u524d\u7aef\u56e2\u961f\u5728\u628a\u6587\u5b57\u4ece DOM \u6807\u7b7e\u8fc1\u79fb\u5230 Canvas 2D \u7ed8\u5236\u65f6&#xff0c;\u51e0\u4e4e\u90fd\u4f1a\u649e\u89c1\u540c\u4e00\u4e2a\u6781\u5176\u523a\u773c\u7684\u89c6\u89c9\u7f3a\u9677&#xff1a;\u5728\u666e\u901a\u7684 1080P \u663e\u793a\u5668\u4e0a\u770b\u6587\u5b57\u8fd8\u7b97\u5de5\u6574&#xff0c;\u4f46\u53ea\u8981\u628a\u9875\u9762\u642c\u5230 MacBook\u3001iPhone \u6216\u9ad8\u5206 4K \u5c4f&#xff08;Retina Display&#xff09;\u4e0a&#xff0c;Canvas \u91cc\u753b\u51fa\u6765\u7684\u6587\u5b57\u77ac\u95f4\u53d8\u5f97\u53c8\u865a\u53c8\u8f6f&#xff0c;\u7b14\u753b\u8fb9\u7f18\u53d1\u7070\u3001\u53d1\u6bdb&#xff0c;\u751a\u81f3\u5e26\u7740\u4e00\u5c42\u6de1\u6de1\u7684\u5f69\u8272\u91cd\u5f71\u3002\u4e0e\u9875\u9762\u65c1\u8fb9\u90a3\u4e9b\u7528\u539f\u751f HTML \u6392\u7248\u7684\u9510\u5229\u6e05\u6670\u7684\u6587\u5b57\u76f8\u6bd4&#xff0c;Canvas \u91cc\u7684\u5b57\u8ff9\u5c31\u50cf\u9694\u4e86\u4e00\u5c42\u6bdb\u73bb\u7483\u3002<\/p>\n<p>\u5f88\u591a\u5f00\u53d1\u540c\u5b66\u5c1d\u8bd5\u628a\u5b57\u53f7\u6539\u5927&#xff0c;\u6216\u8005\u7ed9\u6587\u5b57\u52a0\u6df1\u989c\u8272&#xff0c;\u4f46\u6587\u5b57\u53d1\u865a\u7684\u95ee\u9898\u4f9d\u7136\u5982\u5f71\u968f\u5f62\u3002<\/p>\n<p>\u6839\u672c\u539f\u56e0\u5728\u4e8e&#xff1a;\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Canvas \u7684\u51e0\u4f55\u7f13\u51b2\u533a\u5206\u8fa8\u7387&#xff08;Buffer Dimensions&#xff09;\u662f\u6309\u7167 96DPI \u7684\u5355\u500d\u7269\u7406\u50cf\u7d20\u521d\u59cb\u5316\u7684&#xff0c;\u76f4\u63a5\u88ab\u786c\u4ef6\u663e\u5361\u62c9\u4f38\u5230 2 \u500d\u751a\u81f3 3 \u500d\u7684 Retina \u89c6\u7f51\u819c\u5c4f\u5e55\u4e0a\u5149\u6805\u5316&#xff0c;\u5fc5\u7136\u4f1a\u56e0\u4e3a\u53cc\u7ebf\u6027\u91cd\u91c7\u6837&#xff08;Bilinear Resampling&#xff09;\u53d1\u751f\u4e25\u91cd\u7684\u50cf\u7d20\u6d82\u62b9\u3002<\/p>\n<p>\u8981\u8ba9 Canvas \u91cc\u7684\u6bcf\u4e00\u884c\u6587\u5b57\u62e5\u6709\u50cf\u5370\u5237\u54c1\u4e00\u6837\u7684\u7edd\u5bf9\u9510\u5229\u5ea6&#xff0c;\u5fc5\u987b\u5f7b\u5e95\u5403\u900f**\u8bbe\u5907\u50cf\u7d20\u6bd4&#xff08;Device Pixel Ratio, DPR&#xff09;\u3001\u7269\u7406\u89c6\u53e3\u6620\u5c04\u77e9\u9635\u4e0e\u4e9a\u50cf\u7d20\u6587\u672c\u6297\u952f\u9f7f&#xff08;Subpixel Text Rendering&#xff09;**\u7684\u5e95\u5c42\u6cd5\u5219\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001Retina \u89c6\u7f51\u819c\u5c4f\u6587\u5b57\u6a21\u7cca\u7684\u5e95\u5c42\u6570\u5b66\u8bf1\u56e0<\/h3>\n<p>\u8981\u770b\u900f\u6a21\u7cca\u7684\u672c\u8d28&#xff0c;\u5fc5\u987b\u5206\u6e05\u4e24\u4e2a\u622a\u7136\u4e0d\u540c\u7684\u6982\u5ff5&#xff1a;<\/p>\n<li>CSS \u903b\u8f91\u5c3a\u5bf8&#xff08;CSS Dimensions&#xff09;&#xff1a;\u901a\u8fc7\u6837\u5f0f\u8868\u8bbe\u7f6e\u7684 width: 300px; height: 200px\u3002\u5b83\u4ee3\u8868\u5143\u7d20\u5728\u6d4f\u89c8\u5668\u6392\u7248\u5e03\u5c40\u4e2d\u6240\u5360\u636e\u7684\u903b\u8f91\u5750\u6807\u7a7a\u95f4\u3002<\/li>\n<li>\u753b\u5e03\u7269\u7406\u7f13\u51b2\u533a\u5c3a\u5bf8&#xff08;Internal Buffer Dimensions&#xff09;&#xff1a;\u901a\u8fc7\u5143\u7d20\u5c5e\u6027\u8bbe\u7f6e\u7684 &lt;canvas width&#061;&#034;300&#034; height&#061;&#034;200&#034;&gt;\u3002\u5b83\u4ee3\u8868\u663e\u5361\u771f\u5b9e\u5728\u663e\u5b58\u4e2d\u5f00\u8f9f\u7684\u4f4d\u56fe\u50cf\u7d20\u9635\u5217\u5927\u5c0f\u3002<\/li>\n<p>\u5f53\u7528\u6237\u7684\u8bbe\u5907\u50cf\u7d20\u6bd4 $\\\\text{DPR} &#061; 2$ \u65f6&#xff0c;\u5c4f\u5e55\u4e0a\u957f\u5bbd\u4e3a $300\\\\text{px} \\\\times 200\\\\text{px}$ \u7684\u533a\u57df&#xff0c;\u5b9e\u9645\u4e0a\u7531\u7269\u7406\u786c\u4ef6\u4e0a\u7684 $600 \\\\times 400 &#061; 240,000$ \u4e2a\u53d1\u5149\u7269\u7406\u50cf\u7d20\u70b9 \u6784\u6210&#xff01;<\/p>\n<p>\u5982\u679c\u4f60\u6ca1\u6709\u663e\u5f0f\u914d\u7f6e\u7f13\u51b2\u533a\u500d\u589e&#xff0c;\u6d4f\u89c8\u5668\u5c31\u4f1a\u628a\u539f\u672c\u53ea\u6709 $300 \\\\times 200$ \u7684\u79bb\u6563\u4f4d\u56fe&#xff0c;\u5f3a\u884c\u62c9\u4f38 4 \u500d\u94fa\u6ee1\u5230 24 \u4e07\u4e2a\u7269\u7406\u50cf\u7d20\u4e0a\u3002\u6587\u5b57\u7b14\u753b\u4e2d\u539f\u672c\u9510\u5229\u7684 1px \u9ed1\u8272\u76f4\u7ebf&#xff0c;\u88ab\u5e73\u644a\u5728 2 \u4e2a\u7269\u7406\u50cf\u7d20\u4e4b\u95f4&#xff0c;\u4e24\u8fb9\u5404\u81ea\u6790\u51fa 50% \u900f\u660e\u5ea6\u7684\u7070\u8272\u8fc7\u6e21\u70b9&#xff0c;\u4eba\u773c\u770b\u8fc7\u53bb\u5c31\u4f1a\u7acb\u523b\u611f\u5230\u8fb9\u7f18\u6a21\u7cca\u3001\u53d1\u865a\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u751f\u4ea7\u7ea7 DPR \u52a8\u6001\u9002\u914d\u4e0e\u5750\u6807\u7cfb\u65e0\u611f\u7f29\u653e\u8303\u5f0f<\/h3>\n<p>\u5f7b\u5e95\u6d88\u706d\u6a21\u7cca\u7684\u6807\u51c6\u8303\u5f0f&#xff0c;\u5206\u4e3a\u4e25\u683c\u7684\u4e09\u4e2a\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u663e\u5b58\u7269\u7406\u5c3a\u5bf8\u6269\u5927 DPR \u500d&#xff1a;canvas.width &#061; logicalWidth * dpr&#xff1b;<\/li>\n<li>DOM \u6e32\u67d3\u6837\u5f0f\u9501\u6b7b\u903b\u8f91\u5c3a\u5bf8&#xff1a;canvas.style.width &#061; &#039;${logicalWidth}px&#039;&#xff1b;<\/li>\n<li>\u7ed8\u56fe\u4e0a\u4e0b\u6587\u5168\u5c40\u77e9\u9635\u7f29\u653e&#xff1a;ctx.scale(dpr, dpr)\u3002<\/li>\n<p>\u901a\u8fc7\u8fd9\u4e00\u5957\u7ec4\u5408\u62f3&#xff0c;\u540e\u7eed\u6240\u6709\u7684\u7ed8\u56fe\u4e1a\u52a1\u4ee3\u7801\u4f9d\u7136\u5b8c\u5168\u6309\u7167\u76f4\u89c9\u7684 CSS \u903b\u8f91\u50cf\u7d20\u7f16\u5199&#xff0c;\u800c\u5e95\u5c42 GPU \u5728\u6267\u884c\u5149\u6805\u5316\u65f6&#xff0c;\u6bcf\u4e00\u4e2a\u5b57\u5f62\u90fd\u80fd\u4e25\u683c\u7cbe\u786e\u547d\u4e2d\u5c4f\u5e55\u4e0a\u6bcf\u4e00\u4e2a\u771f\u5b9e\u7684\u7269\u7406\u53d1\u5149\u5fae\u5143&#xff01;<\/p>\n<p>\u770b\u901a\u7528\u7684\u9ad8\u6e05\u9002\u914d\u63a7\u5236\u5668\u5b9e\u73b0&#xff1a;<\/p>\n<p>export class RetinaCanvasAdapter {<br \/>\n  private canvas: HTMLCanvasElement;<br \/>\n  private ctx: CanvasRenderingContext2D;<br \/>\n  private currentDpr &#061; 1;<\/p>\n<p>  constructor(canvas: HTMLCanvasElement) {<br \/>\n    this.canvas &#061; canvas;<br \/>\n    this.ctx &#061; canvas.getContext(&#039;2d&#039;, {<br \/>\n      alpha: true,<br \/>\n      desynchronized: true \/\/ \u5f00\u542f\u4f4e\u5ef6\u8fdf\u901a\u9053<br \/>\n    })!;<br \/>\n    this.setupHighDpi();<br \/>\n    this.listenDprChange();<br \/>\n  }<\/p>\n<p>  public setupHighDpi(): void {<br \/>\n    \/\/ 1. \u83b7\u53d6\u7269\u7406\u786c\u4ef6\u50cf\u7d20\u6bd4&#xff0c;\u6700\u9ad8\u9650\u5236\u5728 3&#xff0c;\u907f\u514d\u5728\u6781\u7aef 4K\/8K \u5c4f\u5e55\u4e0a\u7206\u663e\u5b58<br \/>\n    const dpr &#061; Math.min(window.devicePixelRatio || 1, 3);<br \/>\n    this.currentDpr &#061; dpr;<\/p>\n<p>    \/\/ 2. \u63d0\u53d6\u5f53\u524d CSS \u903b\u8f91\u5c3a\u5bf8<br \/>\n    const rect &#061; this.canvas.getBoundingClientRect();<br \/>\n    const width &#061; rect.width || this.canvas.width;<br \/>\n    const height &#061; rect.height || this.canvas.height;<\/p>\n<p>    \/\/ 3. \u7269\u7406\u7f13\u51b2\u533a\u5c3a\u5bf8\u500d\u589e<br \/>\n    this.canvas.width &#061; Math.round(width * dpr);<br \/>\n    this.canvas.height &#061; Math.round(height * dpr);<\/p>\n<p>    \/\/ 4. CSS \u903b\u8f91\u5c3a\u5bf8\u9501\u5b9a<br \/>\n    this.canvas.style.width &#061; &#096;${width}px&#096;;<br \/>\n    this.canvas.style.height &#061; &#096;${height}px&#096;;<\/p>\n<p>    \/\/ 5. \u5750\u6807\u7cfb\u7f29\u653e&#xff1a;\u5c06\u903b\u8f91\u5750\u6807\u81ea\u52a8\u6295\u5f71\u81f3\u9ad8\u5bc6\u7269\u7406\u663e\u5b58<br \/>\n    this.ctx.scale(dpr, dpr);<\/p>\n<p>    \/\/ 6. \u914d\u7f6e\u73b0\u4ee3\u5b57\u4f53\u6297\u952f\u9f7f\u589e\u5f3a\u53c2\u6570<br \/>\n    \/\/ &#064;ts-ignore Chrome 99&#043; \u5b9e\u9a8c\u6027\u6587\u5b57\u4f18\u5316\u5c5e\u6027<br \/>\n    if (&#039;textRendering&#039; in this.ctx) {<br \/>\n      \/\/ &#064;ts-ignore<br \/>\n      this.ctx.textRendering &#061; &#039;optimizeLegibility&#039;;<br \/>\n    }<br \/>\n    this.ctx.imageSmoothingEnabled &#061; true;<br \/>\n    this.ctx.imageSmoothingQuality &#061; &#039;high&#039;;<br \/>\n  }<\/p>\n<p>  \/**<br \/>\n   * \u76d1\u542c\u7528\u6237\u5728\u591a\u5c4f\u4e4b\u95f4\u62d6\u62fd\u7a97\u53e3\u5f15\u8d77\u7684 DPR \u52a8\u6001\u8de8\u5c4f\u53d8\u66f4<br \/>\n   *\/<br \/>\n  private listenDprChange(): void {<br \/>\n    const mediaQuery &#061; window.matchMedia(&#096;(resolution: ${window.devicePixelRatio}dppx)&#096;);<br \/>\n    mediaQuery.addEventListener(&#039;change&#039;, () &#061;&gt; {<br \/>\n      this.setupHighDpi();<br \/>\n    }, { once: true });<br \/>\n  }<\/p>\n<p>  public get context(): CanvasRenderingContext2D {<br \/>\n    return this.ctx;<br \/>\n  }<br \/>\n}<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u79bb\u5c4f\u6587\u5b57\u56fe\u5143\u5b57\u5f62\u7f13\u5b58&#xff08;Glyph Atlas&#xff09;\u4e0e 0.5px \u7269\u7406\u5bf9\u9f50<\/h3>\n<p>\u5f53\u9700\u8981\u5728\u56fe\u8868\u4e2d\u7ed8\u5236\u6210\u5343\u4e0a\u4e07\u4e2a\u6570\u636e\u6807\u7b7e\u65f6&#xff0c;\u6bcf\u6b21\u90fd\u8c03\u7528 ctx.fillText() \u4f1a\u5728 CPU \u4fa7\u53cd\u590d\u89e3\u6790\u5b57\u4f53\u8f6e\u5ed3\u8d1d\u585e\u5c14\u66f2\u7ebf&#xff0c;\u5f15\u53d1\u4e25\u91cd\u7684\u5b57\u4f53\u6392\u7248\u5f15\u64ce\u74f6\u9888\u3002<\/p>\n<p>\u9ad8\u7ea7\u5de5\u7a0b\u6807\u51c6\u662f\u6784\u5efa\u5b57\u5f62\u7eb9\u7406\u56fe\u96c6&#xff08;Glyph Atlas&#xff09;&#xff1a;\u5728\u79bb\u5c4f\u753b\u5e03\u4e0a\u628a\u5e38\u7528\u5b57\u7b26\u9884\u5148\u6e32\u67d3\u4e3a\u9ad8\u6e05\u4f4d\u56fe\u5207\u7247&#xff0c;\u4e3b\u753b\u5e03\u76f4\u63a5\u901a\u8fc7 drawImage \u96f6\u62f7\u8d1d\u590d\u5236\u3002<\/p>\n<p>\u5728\u7ed8\u5236\u5355\u50cf\u7d20\u5fae\u7ebf\u6846\u4e0e\u7ec6\u5b57\u4f53\u65f6&#xff0c;\u8fd8\u6709\u4e00\u4e2a\u6781\u5176\u5173\u952e\u7684\u7269\u7406\u7ec6\u8282\u2014\u20140.5px \u5750\u6807\u5fae\u5e73\u79fb&#xff08;The Half-pixel Rule&#xff09;&#xff1a;<\/p>\n<p>\u5728 Canvas \u7b1b\u5361\u5c14\u5750\u6807\u7cfb\u4e2d&#xff0c;\u6574\u6570\u5750\u6807\u70b9&#xff08;\u5982 $(10, 10)$&#xff09;\u6307\u7684\u662f\u4e24\u4e2a\u7269\u7406\u50cf\u7d20\u76f8\u4ea4\u7684\u7f51\u683c\u5341\u5b57\u4ea4\u53c9\u70b9\u3002\u5982\u679c\u4f60\u753b\u4e00\u6761\u5bbd\u5ea6\u4e3a 1px \u7684\u76f4\u7ebf&#xff0c;\u753b\u7b14\u4f1a\u4ee5\u8be5\u7ebf\u4e3a\u4e2d\u5fc3\u5411\u4e24\u4fa7\u5404\u5ef6\u4f38 0.5px&#xff0c;\u7ed3\u679c\u6a2a\u8de8\u4e86\u4e24\u4e2a\u50cf\u7d20&#xff0c;\u5bfc\u81f4\u539f\u672c\u9510\u5229\u7684\u7ec6\u7ebf\u53d8\u6210\u4e00\u6761 2px \u5bbd\u7684\u534a\u900f\u660e\u7070\u8272\u6a21\u7cca\u5e26&#xff01;<\/p>\n<p>\/\/ \u7ed8\u5236\u7edd\u5bf9\u9510\u5229\u5fae\u6587\u5b57\u4e0e\u8fb9\u6846\u7684\u9ec4\u91d1\u5fc3\u6cd5&#xff1a;<br \/>\nexport function snapToPhysicalPixel(value: number, dpr: number): number {<br \/>\n  \/\/ \u5f3a\u5236\u4e0e\u7269\u7406\u50cf\u7d20\u4e2d\u5fc3\u5bf9\u9f50&#xff08;\u52a0\u4e0a\u534a\u50cf\u7d20\u504f\u89d2&#xff09;<br \/>\n  return (Math.floor(value * dpr) &#043; 0.5) \/ dpr;<br \/>\n}<\/p>\n<p>\u5728\u8c03\u7528 ctx.fillText(text, x, y) \u65f6&#xff0c;\u786e\u4fdd\u5750\u6807\u7ecf\u8fc7\u5fae\u5bf9\u9f50&#xff0c;\u6587\u5b57\u7684\u6a2a\u7ad6\u7b14\u753b\u4f1a\u77ac\u95f4\u53d8\u5f97\u5b9b\u5982\u523b\u5200\u96d5\u523b\u822c\u6e05\u6670\u521a\u52b2&#xff01;<\/p>\n<hr \/>\n<h3>\u56db\u3001\u751f\u4ea7\u843d\u5730\u7684\u907f\u5751\u7ea2\u7ebf<\/h3>\n<li>\u591a\u5c4f\u62d6\u62fd\u4e0b\u7684\u50cf\u7d20\u584c\u9677&#xff08;Cross-monitor DPR Drift&#xff09;&#xff1a;\u5f53\u7528\u6237\u628a\u7b14\u8bb0\u672c&#xff08;DPR &#061; 2&#xff09;\u4e0a\u7684\u6d4f\u89c8\u5668\u7a97\u53e3\u62d6\u62fd\u5230\u5916\u63a5\u7684\u666e\u901a 1080P \u663e\u793a\u5668&#xff08;DPR &#061; 1&#xff09;\u65f6&#xff0c;\u5982\u679c\u7cfb\u7edf\u6ca1\u6709\u76d1\u542c matchMedia \u7684\u5206\u8fa8\u7387\u53d8\u66f4\u4e8b\u4ef6&#xff0c;Canvas \u7684\u7269\u7406\u7f13\u51b2\u533a\u4e0e\u5c4f\u5e55\u7269\u7406\u50cf\u7d20\u4f1a\u4ea7\u751f\u4e25\u91cd\u9519\u4f4d&#xff0c;\u5bfc\u81f4\u6587\u5b57\u77ac\u95f4\u88ab\u62c9\u626f\u53d8\u5f62\u3002\u524d\u6587\u4ee3\u7801\u4e2d\u7684\u5206\u8fa8\u7387\u5a92\u4f53\u67e5\u8be2\u76d1\u542c\u662f\u7edd\u5bf9\u4e0d\u53ef\u6216\u7f3a\u7684\u4fdd\u62a4\u76fe\u3002<\/li>\n<li>ctx.scale \u7684\u7d2f\u79ef\u81a8\u80c0\u6b7b\u9501&#xff1a;\u5728\u6bcf\u6b21\u89c6\u53e3\u8c03\u6574\u8c03\u7528 setupHighDpi() \u65f6&#xff0c;\u5982\u679c\u76f4\u63a5\u5728\u65e7\u7684\u4e0a\u4e0b\u6587\u4e0a\u8c03\u7528 ctx.scale(dpr, dpr)&#xff0c;\u77e9\u9635\u4f1a\u4e0d\u65ad\u76f8\u4e58\u53e0\u52a0\u4e0a\u53bb&#xff0c;\u5bfc\u81f4\u4e0b\u6b21\u7ed8\u5236\u65f6\u6240\u6709\u6587\u5b57\u88ab\u653e\u5927\u6570\u5341\u500d\u98de\u51fa\u5c4f\u5e55&#xff01;\u5fc5\u987b\u5728\u91cd\u65b0\u7f29\u653e\u524d&#xff0c;\u901a\u8fc7 ctx.setTransform(1, 0, 0, 1, 0, 0) \u91cd\u7f6e\u5355\u4f4d\u77e9\u9635&#xff0c;\u518d\u91cd\u65b0\u8d4b\u4e88\u5355\u6b21\u5168\u5c40\u7f29\u653e\u3002<\/li>\n<p>\u50cf\u7d20\u7684\u6e05\u6670\u5ea6\u662f\u89c6\u89c9\u656c\u754f\u7684\u7b2c\u4e00\u6b65\u3002\u7528\u4e25\u5bc6\u7684\u51e0\u4f55\u5c3a\u5ea6\u9501\u5b9a\u4e49\u6bcf\u4e00\u4e2a\u7269\u7406\u53d1\u5149\u5fae\u5143&#xff0c;Canvas \u753b\u5e03\u4e0a\u7684\u6570\u5b57\u4e16\u754c\u624d\u80fd\u5448\u73b0\u51fa\u5982\u540c\u5b9e\u4f53\u7eb8\u58a8\u822c\u7684\u4f18\u96c5\u5c0a\u4e25\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u590d\u6742\u7684\u6570\u636e\u53ef\u89c6\u5316\u770b\u677f\u3001\u91d1\u878d\u4ea4\u6613\u5206\u65f6\u56fe\u3001\u6216\u8005\u56fe\u7f16\u8f91\u5668\u7684\u8282\u70b9\u6e32\u67d3\u4e2d&#xff0c;\u5f88\u591a\u524d\u7aef\u56e2\u961f\u5728\u628a\u6587\u5b57\u4ece DOM \u6807\u7b7e\u8fc1\u79fb\u5230 Canvas 2D \u7ed8\u5236\u65f6&#xff0c;\u51e0\u4e4e\u90fd\u4f1a\u649e\u89c1\u540c\u4e00\u4e2a\u6781\u5176\u523a\u773c\u7684\u89c6\u89c9\u7f3a\u9677&#xff1a;\u5728\u666e\u901a\u7684 1080P \u663e\u793a\u5668\u4e0a\u770b\u6587\u5b57\u8fd8\u7b97\u5de5\u6574&#xff0c;\u4f46\u53ea\u8981\u628a\u9875\u9762\u642c\u5230 MacBook\u3001iPhone \u6216\u9ad8\u5206 4K \u5c4f&#xff08;Retina Display&#xff09;\u4e0a&#xff0c;Canvas \u91cc\u753b\u51fa\u6765\u7684\u6587\u5b57\u77ac\u95f4\u53d8\u5f97\u53c8\u865a\u53c8\u8f6f&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":115088,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,573,594,50,87],"topic":[],"class_list":["post-115089","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ai","tag-css","tag-web","tag-50","tag-87"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115089.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728\u590d\u6742\u7684\u6570\u636e\u53ef\u89c6\u5316\u770b\u677f\u3001\u91d1\u878d\u4ea4\u6613\u5206\u65f6\u56fe\u3001\u6216\u8005\u56fe\u7f16\u8f91\u5668\u7684\u8282\u70b9\u6e32\u67d3\u4e2d&#xff0c;\u5f88\u591a\u524d\u7aef\u56e2\u961f\u5728\u628a\u6587\u5b57\u4ece DOM \u6807\u7b7e\u8fc1\u79fb\u5230 Canvas 2D \u7ed8\u5236\u65f6&#xff0c;\u51e0\u4e4e\u90fd\u4f1a\u649e\u89c1\u540c\u4e00\u4e2a\u6781\u5176\u523a\u773c\u7684\u89c6\u89c9\u7f3a\u9677&#xff1a;\u5728\u666e\u901a\u7684 1080P \u663e\u793a\u5668\u4e0a\u770b\u6587\u5b57\u8fd8\u7b97\u5de5\u6574&#xff0c;\u4f46\u53ea\u8981\u628a\u9875\u9762\u642c\u5230 MacBook\u3001iPhone \u6216\u9ad8\u5206 4K \u5c4f&#xff08;Retina Display&#xff09;\u4e0a&#xff0c;Canvas \u91cc\u753b\u51fa\u6765\u7684\u6587\u5b57\u77ac\u95f4\u53d8\u5f97\u53c8\u865a\u53c8\u8f6f&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115089.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-10T21:41:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010214115-6acab0fb4b67d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115089.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115089.html\",\"name\":\"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-10T21:41:20+00:00\",\"dateModified\":\"2026-10-10T21:41:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115089.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115089.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115089.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115089.html","og_locale":"zh_CN","og_type":"article","og_title":"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728\u590d\u6742\u7684\u6570\u636e\u53ef\u89c6\u5316\u770b\u677f\u3001\u91d1\u878d\u4ea4\u6613\u5206\u65f6\u56fe\u3001\u6216\u8005\u56fe\u7f16\u8f91\u5668\u7684\u8282\u70b9\u6e32\u67d3\u4e2d&#xff0c;\u5f88\u591a\u524d\u7aef\u56e2\u961f\u5728\u628a\u6587\u5b57\u4ece DOM \u6807\u7b7e\u8fc1\u79fb\u5230 Canvas 2D \u7ed8\u5236\u65f6&#xff0c;\u51e0\u4e4e\u90fd\u4f1a\u649e\u89c1\u540c\u4e00\u4e2a\u6781\u5176\u523a\u773c\u7684\u89c6\u89c9\u7f3a\u9677&#xff1a;\u5728\u666e\u901a\u7684 1080P \u663e\u793a\u5668\u4e0a\u770b\u6587\u5b57\u8fd8\u7b97\u5de5\u6574&#xff0c;\u4f46\u53ea\u8981\u628a\u9875\u9762\u642c\u5230 MacBook\u3001iPhone \u6216\u9ad8\u5206 4K \u5c4f&#xff08;Retina Display&#xff09;\u4e0a&#xff0c;Canvas \u91cc\u753b\u51fa\u6765\u7684\u6587\u5b57\u77ac\u95f4\u53d8\u5f97\u53c8\u865a\u53c8\u8f6f&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/115089.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-10T21:41:20+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010214115-6acab0fb4b67d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115089.html","url":"https:\/\/www.wsisp.com\/helps\/115089.html","name":"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-10T21:41:20+00:00","dateModified":"2026-10-10T21:41:20+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115089.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115089.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115089.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u79bb\u5c4f Canvas \u6587\u5b57\u6e05\u6670\u5ea6\u7ec8\u6781\u6307\u5357\uff1a\u89e3\u51b3 Retina \u5c4f\u5b57\u4f53\u53d1\u865a\u4e0e\u8fb9\u7f18\u6297\u952f\u9f7f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115089"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115089\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/115088"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115089"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}