我正在使用 Corona SDK,它最近禁用了抗锯齿功能,并且无法重新启用它。我有几个使用旋转矩形和线条的应用程序,并且想要一种不看起来锯齿状的方法。此图显示了差异:
有没有办法在 Corona 中为这些矩形添加某种抗锯齿功能?我更喜欢抗锯齿黑客,并且能够使用新的 Corona 功能和修复,而不是使用具有抗锯齿功能的旧版本。]
Thanks!
您可以使用masks http://docs.coronalabs.com/api/type/DisplayObject/setMask.html对于您的矩形或图像,它可以最大限度地减少锯齿,并且是抗锯齿的一个很好的选择
我在没有遮罩的情况下测试了矩形,它很丑,当我添加遮罩时,它改善了矩形
display.newRect(0,0,320,480) --Background
local rmask = graphics.newMask( "mask.png" ) --Mask
local w = math.random(100,300) --Your random width of your rect
local h = math.random(100,300) --Your random height of your rect
local r = display.newRect(100,100,w,h) --Rect
r:setFillColor(0,0,0)
r:setMask(rmask)
--This will resize the mask to your rect's dimensions, make sure you know your mask's width and height
r.maskScaleX = w/200 --the 200 is the mask's width
r.maskScaleY = h/200 --the 200 is the mask's height
transition.to(r,{time = 100000, rotation = 360*10}) --To test the aliasing when it rotates
我用过这个面膜,你可以自己测试一下
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)