wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
Functions

Save the BGI framebuffer or a DDS camera view directly to a PNG file. More...

Collaboration diagram for PNG Export API:

Functions

BGI_API int BGI_CALL wxbgi_export_png (const char *filePath)
 Export the current visual-page pixel buffer to a PNG file.
 
BGI_API int BGI_CALL wxbgi_export_png_camera_view (const char *camName, const char *filePath)
 Render the DDS scene through a camera and export its viewport to PNG.
 
BGI_API int BGI_CALL wxbgi_export_png_window (const char *filePath)
 Export the full OpenGL window content to a PNG file.
 

Detailed Description

Save the BGI framebuffer or a DDS camera view directly to a PNG file.

All three functions use a self-contained PNG encoder (CRC-32, Adler-32,

deflate stored blocks) - no external image library is required.

Function Documentation

◆ wxbgi_export_png()

BGI_API int BGI_CALL wxbgi_export_png ( const char *  filePath)

Export the current visual-page pixel buffer to a PNG file.

Captures exactly what is currently displayed (the visual page).

Output dimensions match the window size passed to initwindow().

Parameters
filePathDestination file path (e.g. "screenshot.png").
Returns
0 on success, -1 if no window is open or the file cannot be written.

◆ wxbgi_export_png_camera_view()

BGI_API int BGI_CALL wxbgi_export_png_camera_view ( const char *  camName,
const char *  filePath 
)

Render the DDS scene through a camera and export its viewport to PNG.

Calls wxbgi_render_dds internally, then crops the active-page buffer to

the named camera's viewport rectangle and writes the result as a PNG.

Pass NULL as camName to use the active camera.

If the camera has no explicit viewport the full window is exported.

Parameters
camNameName of the camera to render through (or NULL).
filePathDestination file path.
Returns
0 on success, -1 on error.

◆ wxbgi_export_png_window()

BGI_API int BGI_CALL wxbgi_export_png_window ( const char *  filePath)

Export the full OpenGL window content to a PNG file.

For pure BGI contexts equivalent to wxbgi_export_png.

Provided as a distinct entry point for callers that conceptually want

"everything displayed in the window" regardless of page selection.

Parameters
filePathDestination file path.
Returns
0 on success, -1 on error.