C_SaveModel3DViewBitmapMem

Call C_SaveModel3DViewBitmapMem to save a bitmap containing an OrcaFlex 3D View of the specified model to memory. The format is specified by the FileFormat member of TViewParameters.

The C_SetSimulationDrawTime function can be used to control the way this function behaves. It allows you to produce drawings of the OrcaFlex model at a number of different points of a simulation. See C_SetSimulationDrawTime for details.

void C_SaveModel3DViewBitmapMem(

TOrcFxAPIHandle ModelHandle,

const TViewParameters *lpViewParameters,

TOrcFxAPIHandle *lpBufferHandle,

int64_t *lpBufferLen,

int *lpStatus

);

Parameters

ModelHandle (IN)

The handle of the model.

lpViewParameters (IN)

Points to a structure containing the view parameters.

Before calling the C_SaveModel3DViewBitmapMem function, set the Size member of the TViewParameters data structure to sizeof(TViewParameters).

If this parameter is passed as NULL then default view parameters are used. These default parameters are the same as those returned by C_GetDefaultViewParameters.

lpBufferHandle (OUT)

Points to a variable in which a handle to the saved buffer will be returned.

lpBufferLen (OUT)

Points to a variable in which the length of the saved buffer will be returned.

lpStatus (OUT)

Points to a variable in which the status result for the function call will be returned.

Remarks

In order to extract the contents of the buffer, you must follow the call to C_SaveModel3DViewBitmapMem with calls to C_CopyBuffer and C_FreeBuffer. Use the value returned in lpBufferLen to allocate a suitably sized buffer. Pass this to C_CopyBuffer to perform the copy. Finally, call C_FreeBuffer to free the buffer handle.

Such code typically looks like this:

TOrcFxAPIHandle BufferHandle;

int64_t BufferLen;

int Status;

C_SaveModel3DViewBitmapMem(ModelHandle, &ViewParameters, &BufferHandle, &BufferLen, &Status);

unsigned char *lpBuffer = new unsigned char[BufferLen];

C_CopyBuffer(BufferHandle, lpBuffer, BufferLen, &Status);

C_FreeBuffer(BufferHandle, &Status);

// use lpBuffer

delete[] lpBuffer;

Note that, for the sake of brevity, error checking has been omitted from the above code.

See Also

TViewParameters, C_CreateModel3DViewBitmap, C_GetDefaultViewParameters, C_GetSimulationDrawTime, C_SaveModel3DViewBitmapToFile, C_SetSimulationDrawTime.