Delphi:具有 alpha 混合功能的图像

发布于 2024-09-05 07:08:46 字数 224 浏览 3 评论 0原文

是否有一些简单的组件可以显示 PNG 32 位图像并在鼠标输入和鼠标离开时将其 alpha 混合到另一个图像?或者甚至只是一个可以加载 32 位 PNG 的简单图像,并且另外还有 Alpha 参数...

我想我可以使用一些皮肤库(alphacontrols?)或一些图形库,但对于一些简单的纯视觉效果来说,这将是相当的杀伤力太大了​​,我似乎找不到一个简单的方法可以为我做到这一点并且也可以在玻璃表面上工作......

Is there some simple component that could display PNG 32-bit images and alpha-blend it to another image on mouse enter and on mouse leave? Or even just a simple image that can load 32-bit PNG and additionally would have Alpha parameter...

I suppose I could use some skin library (alphacontrols?) or some graphics library, but for some simple purely visual effects that would be quite an overkill and I can't seem to find a simple one that does it for me and would work on Glass surface as well...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

无悔心 2024-09-12 07:08:46

它不完全是一个组件,但这里有一篇关于如何自己做的好文章的链接。它只是几行代码:

http://melander.dk/articles/alphasplash/

It is not quite a component, but here is a link to a good article on how to do it yourself. Its just a few lines of code:

http://melander.dk/articles/alphasplash/

我是男神闪亮亮 2024-09-12 07:08:46

基本的 TImage 能够显示 PNG 图像并将其 alpha 混合到其后面的任何内容。您只需将“pngimage”单元添加到表单的使用子句中即可。您没有提到您使用的 Delphi 版本:Delphi 2010 有这个单元,但我不知道他们开始发布它的 Delphi 版本。对于 Delphi 7,我确信您需要找到开源的“pngimage”。

如果您需要在用户移入和移出您的控制时执行此操作,请考虑将状态图像缓存在位图中:运行时速度会更快,并且您可以使用单个 TImage 来显示当前图像,而不需要两个重叠的 TIMage 控件。

The basic TImage is capable of displaying a PNG image and alpha-blend-it to whatever is behind it. You just need to add the "pngimage" unit to the uses clause of your form. You didn't mention the version of Delphi you're on: Delphi 2010 has this unit, but I have no idea with what version of Delphi they started shipping it. For Delphi 7 I know for sure you'll need to find the open source "pngimage".

If you need to do this when the user moves in and out of your control, consider caching the state images in bitmaps: it will be faster at runtime and you can use a single TImage that shows the current image, you don't need two overlapping TIMage controls.

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