How to render each pixel of a bitmap texture to each native physical pixel of the screen on macOS?

前端 未结 2 1888
旧时难觅i
旧时难觅i 2021-01-21 12:35

As modern macOS devices choose to use a scaled HiDPI resolution by default, bitmap images get blurred on screen. Is there a way to render a bitmap pixel by pixel to the true na

2条回答
  •  囚心锁ツ
    2021-01-21 13:08

    Your best bet is probably Metal. MTKView's drawableSize claims that the default is the view's size "in native pixels". I'm not certain if that means device pixels or backing store pixels. If the latter, you could turn off autoResizeDrawable and set drawableSize directly.

    To obtain the display's physical pixel count, you can use my answer here.

    You can also try using Core Graphics with a CGImage of that size drawn to a rect of the screen size in backing store pixels. It's possible that all of the scaling will be internally cancelled out.

提交回复
热议问题