Microsoft.Protocols.TestSuites.Rdpegfx.RdpegfxTestUtility.DrawGradientImage C# (CSharp) Method

DrawGradientImage() public static method

Draw an image with gradient color. The image is only used for clearcode subcodec test, and the width of image can't exceed 128.
public static DrawGradientImage ( int w, int h, Color startColor ) : Bitmap
w int Width of an image
h int Height of an image
startColor Color The start color to draw image
return System.Drawing.Bitmap
        public static Bitmap DrawGradientImage(int w, int h, Color startColor)
        {
            Bitmap bitmap = new Bitmap(w, h);

            for (int y = 0; y < h; y++)
            {
                int argb = startColor.ToArgb();
                for (int x = 0; x < w; x++)
                {
                    Color c = Color.FromArgb(argb);
                    bitmap.SetPixel(x, y, c);
                    argb++;         // Change color for next pixel
                }
            }

            return bitmap;
        }