Flash 中的旋转导致图像边框看起来“像素化”,如何修复?
我在 Flash 中加载了一个用于 2D 游戏的位图。 位图代表一个字符,并在用户使用 A(左)或 D(右)键时旋转。 我遇到的问题是图像的边框在旋转时变得丑陋,你可以看到“像素”(你总是可以看到像素,但我希望你明白我的意思)。
我怎样才能在actionscript 3中解决这个问题,也许改变旋转算法或“修复”旋转后的图像? 或者我应该以不同的方式保存/渲染图像,例如。 在将 Photoshop 与 Flash 一起使用之前?
更新:请注意,游戏的背景是不断变化的。
提前致谢。
I have a bitmap loaded in flash, for a 2D game. The bitmap represents a character and is rotating when the user uses the A (left) or D (right) keys. The problem I have is that the border of the image becomes ugly while rotating, you can see "pixels" (you can always see pixels, but I hope you understand what I mean).
How can I fix this in actionscript 3, maybe change the rotation algorithm or "fix" the image after rotation? Or should I save/render the image differently in eg. Photoshop before using it with Flash?
Update: note that the background of the game is constantly changing.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
快速说明:位图旋转速度很慢,因此在加载游戏时,最好采用经常旋转或常见的角色,将它们旋转到游戏中可能的每 1 度,使用 BitmapData.draw ,并将其推入数组(或 FP10 中的向量,如果可能),然后使用这些位图。
是的,连续的句子!
快乐编码! :-)
A quick note: Bitmap rotation is slow, so while loading the game, it might be a good idea to take characters that are often rotating, or are common, rotate them to every 1 degree that is possible in the game, use BitmapData.draw, and push it onto an Array (or a Vector in FP10, if possible), and then use those Bitmaps.
YAY, run-on sentences!
Happy Coding! :-)
使用 flash.display.Bitmap::smoothing 属性 ... langref 指定,缩放时它很平滑,但它也适用于旋转...
greetz
back2dos
use the flash.display.Bitmap::smoothing property ... the langref specifies, it smooth's when scaling, but it works for rotation as well ...
greetz
back2dos
如果图像是外部加载的(Loader类),那么你可以这样写:
如果是内部的(它在库中)你需要右键单击库位图> > 属性并启用“平滑”。 另外,如果您将其实例化为 BitmapData,那么您需要执行以下操作:
干杯...
If the image is an external load (Loader class), then you can write:
If it's internal (its in the library) you need to right click the library bitmap > properties and enable "Smoothing". Plus, if you are instantiating it as a BitmapData, then you need to do this:
Cheers...
您可以通过将那里的像素与您将要覆盖的像素相加来尝试沿着边缘进行简单的抗锯齿。 您可以查看 Wu 抗锯齿 的 可以用作起点的示例。
You could try a simple antialias along the edges by summing the pixel that is there and the pixel you will be overlaying. You could take a look at Wu antialiasing for an example you could use as a start point.