APIDo_​PhotoRenderID

Creates a photorealistic image of the 3D window.

    GSErrCode ACAPI_Automate (
        APIDo_PhotoRenderID,
        API_PhotoRenderPars*     photoRenderPars,
        API_PrintPars*           printPars
    );

 

Parameters

photoRenderPars
[in] Parameters for saving the photorendered picture into image file
 
printPars
[in] Printing options for producing printed output of the photorendered picture. Optional parameter, can be nullptr
 

 

Return Values

NoError
The function has completed with success.
APIERR_BADDATABASE
The current database does not match the current window
APIERR_BADPARS
Either the rendPars parameter is nullptr
or rendPars->fileTypeID is invalid and the printPars parameter is nullptr
APIERR_CANCEL
The photorendering process was stopped by the user
APIERR_GENERAL
Error occured during rendering or writing the image file

 

Remarks

This function is used to generate the photorendered image of the current 3D window, and save the picture into an image file defined in rendPars.
The picture window will be closed automatically before the function returns.
You can also print the rendered picture to the default printer if the printPars parameter is not nullptr. If you need printed output only, set the fileTypeID field of rendPars to APIFType_None.
The photorendering settings can be accessed with the APIEnv_GetRenderingSetsID and APIEnv_ChangeRenderingSetsID environment functions.

 

Example


API_PhotoRenderPars     rendPars;
IO::Location            fileLoc ("c:\\temp\\MyPicture.jpg");
GSErrCode               err;

if (fileLoc.Status () != NoError)
    return APIERR_GENERAL;

BNZeroMemory (&rendPars, sizeof (API_PhotoRenderPars));
rendPars.fileTypeID = APIFType_JPEGFile;
rendPars.file = &fileLoc;

#if defined (macintosh)
rendPars.colorDepth = ColorDepth_Million_Colors;
#endif
#if defined (WINDOWS)
rendPars.colorDepth = ColorDepth_24bit_TrueColor;
#endif

err = ACAPI_Automate (APIDo_PhotoRenderID, &rendPars, nullptr);

Requirements

Version: API 4.1 or later
Header: APIdefs_Automate.h

 

See Also

API_PhotoRenderPars
API_PrintPars
APIEnv_GetRenderingSetsID
APIEnv_ChangeRenderingSetsID
ACAPI_Automate
API Functions