gpt4 book ai didi

dart - Flutter 如何计算不同分辨率的像素?

转载 作者:IT老高 更新时间:2023-10-28 12:43:59 26 4
gpt4 key购买 nike

Flutter 应用可以在各种硬件、操作系统和外形尺寸上运行。不同分辨率的“像素”是如何计算的?

最佳答案

来自 https://api.flutter.dev/flutter/dart-ui/FlutterView/devicePixelRatio.html :

The number of device pixels for each logical pixel. This number mightnot be a power of two. Indeed, it might not even be an integer. Forexample, the Nexus 6 has a device pixel ratio of 3.5.

Device pixels are also referred to as physical pixels. Logical pixelsare also referred to as device-independent or resolution-independentpixels.

By definition, there are roughly 38 logical pixels per centimeter, orabout 96 logical pixels per inch, of the physical display. The valuereturned by devicePixelRatio is ultimately obtained either from thehardware itself, the device drivers, or a hard-coded value stored inthe operating system or firmware, and may be inaccurate, sometimes bya significant margin.

The Flutter framework operates in logical pixels, so it is rarelynecessary to directly deal with this property.

关于dart - Flutter 如何计算不同分辨率的像素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44572330/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com