实施.NET或WPF褪色的边界边界、NET、WPF

2023-09-04 22:42:11 作者:姐的高傲ジ你不懂♀

我想实现这一点。NET无论是在WPF或VB.NET

I want to achieve this in .NET either in WPF or VB.NET

我有护照尺寸照片。在此我要实现对图像边界的淡入淡出效果。 我们通过渐变参数将像素宽度,我们需要褪色的图像边界,这样衰落深度由该参数决定。

I have a passport size photograph. In that I want to implement a fade effect on image border. The fade parameter we pass would be the pixel width and we require to fade image border such that fade depth is decided by this parameter.

我怎么能达致这?

注: - 我没有使用任何控件来保存这个形象。客户将上传的图片中得到应用,我们将上面的修改要求,并通过电子邮件,它会是控制台应用程序发送。请不要提出任何WPF或VB控件来实现这一点。

Note:- I am not using any controls to hold this image. Customer will upload the images in the applications and we will modify the above required and send them through email it is going to be console application. Please dont suggest any WPF or VB Controls to implement this.

推荐答案

我会用System.Drawing命名空间,并设置像素的Alpha值。创建位图,然后使用的 SetPixel 方法来设置alpha值(使用getPixel获得当前颜色)。

I would use the System.Drawing namespace and set the alpha value of the pixels. Create a Bitmap and then use the SetPixel method to set the alpha value (using GetPixel to get the current color).

如果你需要一些速度提升看看这篇文章: http://www.bobpowell.net/lockingbits热媒

If you need some speed improvements check out this article: http://www.bobpowell.net/lockingbits.htm