Share via


SurfaceLoader.Save Method ()

How Do I...?

  • Save a Screenshot

Saves a surface to a file.

Overload List

public static void Save(string, ImageFileFormat, Surface);
public static void Save(string, ImageFileFormat, Surface, out PaletteEntry);
public static void Save(string, ImageFileFormat, Surface, out PaletteEntry, Rectangle);
public static void Save(string, ImageFileFormat, Surface, Rectangle);

Remarks

This method handles conversion to and from compressed texture formats.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

How Do I...?

Save a Screenshot

This example demonstrates how to save a screen shot to a file.

The back buffer is retrieved and saved as a bitmap image.

In the following C# code example, device is assumed to be the rendering Device. This code is called after rendering is complete.

              [C#]
              
using Microsoft.DirectX.Direct3D;

Surface backbuffer = device.GetBackBuffer(0, 0, BackBufferType.Mono);
SurfaceLoader.Save("Screenshot.bmp", ImageFileFormat.Bmp, backbuffer);
backbuffer.Dispose();