gpt4 book ai didi

flutter - 如何将真实像素值转换为抖动逻辑像素(密度无关像素)

转载 作者:行者123 更新时间:2023-12-04 23:02:12 25 4
gpt4 key购买 nike

我正在使用flutter-ffmpeg包将图像叠加到视频上,叠加后我在该图像上绘制一个矩形,但问题是,ffmpeg使用真实像素数据覆盖图像并使用逻辑像素 flutter 绘制矩形,所以我怎么能将 ffmpeg 的真实像素转换为 flutter 的逻辑像素,以便我可以更改图像的叠加尺寸以匹配矩形。

最佳答案

您可以使用devicePixelRatio .这是 Flutter 文档中的定义:

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

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



所以, devicePixels / WidgetsBinding.instance.window.devicePixelRatio应该给你逻辑像素。

关于flutter - 如何将真实像素值转换为抖动逻辑像素(密度无关像素),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60900250/

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