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

DrawSurfImage() public static method

Draw an image for surface, which has a bitmap in surface.
public static DrawSurfImage ( Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpegfx.Surface surf, Color bgcolor, Bitmap pic, RDPGFX_POINT16 picPos ) : Bitmap
surf Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpegfx.Surface Indicate the size of surface image
bgcolor Color Indicate the background color of surface image
pic System.Drawing.Bitmap The bitmap to be drawn in surface image
picPos Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpegfx.RDPGFX_POINT16 The bitmap position in surface
return System.Drawing.Bitmap
        public static Bitmap DrawSurfImage(Surface surf, Color bgcolor, Bitmap pic, RDPGFX_POINT16 picPos)
        {
            Bitmap bitmap = new Bitmap(surf.Width, surf.Height);
            Graphics g = Graphics.FromImage(bitmap);
            SolidBrush pixelBrush = new SolidBrush(bgcolor);
            g.FillRectangle(pixelBrush, 0, 0, surf.Width, surf.Height);
            for (int x = picPos.x; (x < surf.Width) && (x < (picPos.x + pic.Width)); x++)
            {
                for (int y = picPos.y; (y < surf.Height) && (y < (picPos.y + pic.Height)); y++)
                {
                    Color c = pic.GetPixel(x - picPos.x, y - picPos.y);
                    bitmap.SetPixel(x, y, c);
                }
            }

            return bitmap;
        }