Canvas drawing and Retina display: doable?

前端 未结 6 1373
北荒
北荒 2020-12-15 06:13

Working with phoneGap implementing drawing with Canvas. The catch we\'ve run into is that canvas expects specific pixel dimensions. This is fine except that the iPhone 4\'s

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 06:48

    EDIT: Just noticed I posted the wrong link for the demo!

    Retina (or other hdpi display) canvas resolution is definitely possible. There is a working example here:

    http://spencer-evans.com/share/github/canvas-resizer/

    I've also bumped into this a few times. The accepted answer code is essentially correct, but you could also use a library solution. I whipped one up to handle intelligent canvas re-sizing to make the element more responsive and higher resolution (as shown in the demo).

    https://github.com/swevans/canvas-resizer

提交回复
热议问题