Bitmap sourceBitmap = new Bitmap("source.png"); Bitmap targetBitmap = new Bitmap("target.png"); Graphics graphics = Graphics.FromImage(targetBitmap); graphics.DrawImage(sourceBitmap, 0, 0); graphics.Dispose();
using Microsoft.DirectX.Direct3D; Surface sourceSurface = // create source surface Surface targetSurface = // create target surface SurfaceLoader.FromSurface(targetSurface, sourceSurface, Filter.None, 0);This code uses the DirectX library in C# to load the source surface onto the target surface using SurfaceLoader. The package/library used in the above examples is System.Drawing for the first example and Microsoft.DirectX.Direct3D for the second example.