Skip to content

你好,请问下canvas 绘制的时候是按照逻辑像素还是物理像素计算的? #452

Answered by domchen
wulizhong asked this question in Q&A
Discussion options

You must be logged in to vote

tgfx都在按照物理像素绘制,区别在于你自己在两个平台创建的Surface大小不一样。iOS不给视图缩放值的话会默认创建更小分辨率的Surface。这个是业务行为,你要给对应的View设置一下pixelRatio一类的值,然后在拿去创建Surface尺寸就对了。iOS上搜索一下contentScale。如果你没有正确设置contentScale,然后我们内部又强制去按照物理像素创建Surface,会被你的View再放大一倍,导致画面显示不全。

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wulizhong
Comment options

Answer selected by domchen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants