Flash 中的旋转导致图像边框看起来“像素化”,如何修复?

发布于 2024-07-25 21:42:34 字数 286 浏览 5 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

川水往事 2024-08-01 21:42:35

快速说明:位图旋转速度很慢,因此在加载游戏时,最好采用经常旋转或常见的角色,将它们旋转到游戏中可能的每 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! :-)

染年凉城似染瑾 2024-08-01 21:42:34

use the flash.display.Bitmap::smoothing property ... the langref specifies, it smooth's when scaling, but it works for rotation as well ...

greetz

back2dos

只是偏爱你 2024-08-01 21:42:34

如果图像是外部加载的(Loader类),那么你可以这样写:

Bitmap(myLoader.content).smoothing=true;

如果是内部的(它在库中)你需要右键单击库位图> > 属性并启用“平滑”。 另外,如果您将其实例化为 BitmapData,那么您需要执行以下操作:

var bmp:BitmapData=new LibraryBitmap(0,0);
var bitmap:Bitmap=new Bitmap(bmp,"auto",true); //the third argument is smoothing

干杯...

If the image is an external load (Loader class), then you can write:

Bitmap(myLoader.content).smoothing=true;

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:

var bmp:BitmapData=new LibraryBitmap(0,0);
var bitmap:Bitmap=new Bitmap(bmp,"auto",true); //the third argument is smoothing

Cheers...

饮惑 2024-08-01 21:42:34

您可以通过将那里的像素与您将要覆盖的像素相加来尝试沿着边缘进行简单的抗锯齿。 您可以查看 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文