Click or drag to resize
SoWinGLWidgetSaveSnapshot Method (String, Boolean)

Save a snapshot of the current image displayed in the viewer.

Namespace: OIV.Inventor.Win
Assembly: OIV.Inventor.Win (in OIV.Inventor.Win.dll) Version: 2023.1.3.0 (2023.1.3)
Syntax
public bool SaveSnapshot(
	string filename,
	bool overwrite
)

Parameters

filename
Type: SystemString

Fully qualified file path for the snapshot file. The specified filename must end with one of the extensions supported by OIV.Inventor.Image.SoJPEGImageRW (jpg, jpeg, ...), OIV.Inventor.Image.SoPNGImageRW (png), OIV.Inventor.Image.SoBMPImageRW (bmp), or OIV.Inventor.Image.SoTIFFImageRW (tif, ...).

overwrite
Type: SystemBoolean

If true, overwrite any existing file with the same name (default is true).

Return Value

Type: Boolean
Remarks

The image is read back from the OpenGL framebuffer and will be the same size as the viewer's drawing window. Returns true if successful.

Notes:

  • Depending on the operating system and graphics hardware, it is possible that the image could be incomplete if the viewer window is overlapped by other windows.

  • The supported image file formats are: BMP (Windows only), JPEG, PNG and TIFF. The image file format to write is determined by the extension of the specified filename, e.g. ".png" for PNG format.

  • For BMP and JPEG formats an RGB image is written.

  • For PNG and TIFF formats, an RGBA (RGB plus alpha channel) image is always written.

  • Writing an RGBA image means the image background is transparent. Actually an RGBA snapshot can not be saved without transparency. To get the displayed image without transparency, use the BMP or the JPEG format.

  • To generate an image with a different size or different options, use OIV.Inventor.SoOffscreenRenderArea instead.

  • The specified filename must include a directory or nothing will be written. Can be simply "./filename.png", but just "filename.png" won't work.

See Also