图像透明度
通常我允许用户在主窗体中放置图像。
因为有些图像会产生很多噪音,所以我想对它们进行一些平滑处理。
我通常会对默认提供的图像进行一些透明度处理。
当用户选择新图像或加载新图像时,如何自动执行此操作?
Usually I allow my users to place an image in the main form.
Because some images cause to much noise, I would like to smooth those a bit.
I usually do some transparency in the images that I give as defaults.
How can I do this automatically as the user selects a new image, or as I load it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将轨迹栏添加到设置透明度级别的
TOpenPictureDialog
派生类:创建此对话框以在使用
TransparancyLevel
函数执行后获取用户所需的透明度级别,或将所选图片分配给主表单上的图像:自定义通用对话框的示例图像:
Add a trackbar to a
TOpenPictureDialog
derivative setting the transparancy level:Create this dialog to obtain the user's desired transparancy level after execution with the
TransparancyLevel
function, or assign the chosen picture to the image on your main form:Example image of customized common dialog:
自从我在 Delphi 中这样做以来已经很长时间了(自从我使用 Delphi 以来已经很长时间了!)但是如果我没记错的话,delphi 中的所有 TBitmap 和 TImage 类型都使用图像中最左上角的像素来知道什么透明度的关键是。
基本上,您找到背景颜色(如果不是相同的像素,通常是相邻的),确保左上角的像素是该颜色,然后将图像透明度键设置为该像素的 RGB 值。
就像我说的,已经有一段时间了,你可能需要挖掘一下这些细节,但我相当确定这是类似的东西。
Been a long time since I did this in Delphi (It's been a long time since I used Delphi!!) however if memory serves me right, all TBitmap and TImage types in delphi use the top left most pixel in the image to know what the transparency key is.
Basically, you find the background colour (Usually adjacent if not already the same pixel) make sure the top left pixel is that colour, then set the images transparency key to the RGB value of that pixel.
Like I say it's been a while, you may have to dig a bit with those details, but I'm fairly sure it's something similar.