gpt4 book ai didi

c# - 淡入/淡出图像的最佳方式

转载 作者:太空宇宙 更新时间:2023-11-03 22:24:41 26 4
gpt4 key购买 nike

在 C# 中,在黑色背景(屏幕保护程序)下每 20 秒淡入和淡出图像且持续时间为 1 秒的最佳(资源最少)方法是什么?

(大约 350x130 像素的图像)。

我需要一个简单的屏幕保护程序,它将在一些低级别计算机 (xp) 上运行。

现在我正在对 pictureBox 使用此方法,但它太慢了:

    private Image Lighter(Image imgLight, int level, int nRed, int nGreen, int nBlue)
{
Graphics graphics = Graphics.FromImage(imgLight);
int conversion = (5 * (level - 50));
Pen pLight = new Pen(Color.FromArgb(conversion, nRed,
nGreen, nBlue), imgLight.Width * 2);
graphics.DrawLine(pLight, -1, -1, imgLight.Width, imgLight.Height);
graphics.Save();
graphics.Dispose();
return imgLight;
}

最佳答案

你可能会像 msdn 上的这个例子一样使用颜色矩阵

http://msdn.microsoft.com/en-us/library/w177ax15%28VS.71%29.aspx

关于c# - 淡入/淡出图像的最佳方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1829339/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com