KernelCAD Documentation

DInsight Home
Skip Navigation Links. Skip Navigation LinksHome Page > KernelCAD Components > Interfaces > Viewing Interfaces > IVirtualView
IVirtualView Interface

IVirtualView Interface

Create
Render
Destroy
CreateModelView

IVirtualView interface allows rendering the current scene off-screen into a memory buffer. It can be used for obtaining snapshots of the 3D scene even of the control is not currently visible. IVirtualView can be queried from IView interface.

To take a snapshot of the current 3D view call Create method. Call IBitmap.GetBitmapData to obtain IBlob of the bitmap. Call Render method to take a snapshot. Use IBlob.Save or IBlob.CopyTo to store the image or use it in memory. Call Destroy to free memory associated with the view when it is no longer needed.

The Render calls can be made repeatedly, most likely after some manual or programmatic manipulations of 3D view. Normally Create method is called once during initialization of the application or  when the first off-screen rendering is required.

Background transparency in dual mode is not supported by IVirtualView, but it is possible to set color of the background which appears in the resulting image by setting the color property BackgrColorVirtualViewDualMode via: KernCAD > GetView() >IView > IKCContext2 > SetColorParam(1, ...)

See also: Capture SampleInterface List


HRESULT Create(PairInt* size, IBitmap** buffer)

Parameters

size - [in] - Dimensions of the memory buffer to be created, or NULL. See remarks.

buffer - [out] Newly created bitmap, which contains image of the current scene

Remarks

The methods creates a new bitmap, which will be used as a virtual memory window to draw into. If size parameter is NULL or size.x and size.y are zero, dimensions of the current control window are used instead. It is not an error to call this method repeatedly. The relevant resources are allocated only on the first call.


HRESULT Render()

Remarks

The methods performs rendering of the current model with the current configuration of 3D view into off-screen bitmap created with the Create method.


HRESULT Destroy()

Remarks

Releases all resources associated with the virtual view. Virtual View is destroyed automatically on closing the application.


HRESULT CreateModelView(IModel* model, PairInt* size, IBitmap** buffer)

Parameters

model - [in] The object to be rendered
size - [in] Dimensions of the output image
buffer - [out] Newly created bitmap, which contains an image of the model normally displayed on load in a window. See Create() above for details