Delphi如何旋转png图像?
如何在 Delphi 中旋转 png 图像并保持其透明度? 我通过 TPNGObject
加载它。 然后我使用 Canvas.StretchDraw(MyRect, the TPNGObject) ,但我不知道如何旋转它。
How can I rotate a png image in Delphi with preserving its transparency?
I loaded it via TPNGObject
.
I'm then using Canvas.StretchDraw(MyRect, the TPNGObject)
but I don't know how to rotate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是,如果您使用 Canvas 进行旋转,您将失去透明度,正如您在 TPNGObject 中注意到的那样。
这是因为 Canvas 不支持 PNG 图像所需级别的透明度。
相反,您必须使用专门的代码来旋转 PNG 图像。以下是支持 TPNGObject 的代码库的链接,包括旋转它的函数:
http://cc.embarcadero.com/Item/25631
The problem is that if you do a rotate using the Canvas, you will lose your transparency, as you noted with TPNGObject.
This is because the Canvas doesn't support transparency at the level required by a PNG image.
Instead, you must use specialized code to rotate the PNG image. Here is a link to a library of code that supports the TPNGObject, including a function to rotate it:
http://cc.embarcadero.com/Item/25631