imgCreateBuffer

NI IMAQ Function

imgCreateBuffer

Usage

rval imgCreateBuffer(SESSION_ID sid, uInt32 where, uInt32 bufferSize, void** bufPtrAddr);

Purpose

Creates a frame buffer based on the region of interest (ROI) in the associated session. Passing NULL or zero for the SESSION_ID is valid. In this case, you must pass a buffer size. If bufferSize is zero, the buffer size is computed as follows:

[ROI height] x [rowPixels] x [number of bytes per pixel]

The function returns an error if the buffer size is smaller than the minimum buffer size required for the session.

Parameters

Name Type Direction
sid SESSION_ID input
where uInt32 input
bufferSize uInt32 input
bufPtrAddr void** output
rval Int32 output

Parameter Discussion

sid: valid SESSION_ID

where: value that indicates if the buffer should be stored in system memory or in onboard memory on the image acquisition device, as specified by the following constants:

IMG_HOST_FRAMESpecifies the new buffer is created in the host computer memory.
IMG_DEVICE_FRAMESpecifies the new buffer is created in onboard memory. This feature is not available on the NI PCI/PXI-1407, NI PCIe-1427, NI PCIe-1429, and NI PCIe-1430 devices.

bufferSize: size of the buffer you want to create, in bytes.

bufPtrAddr: pointer to an area of memory that stores the new buffer address.

Note  If you use IMG_DEVICE_FRAME, do not access the returned value of bufPtrAddr.

Return Value

This function returns 0 on success. On failure, this function returns an error code. For information about the error code, call imgShowError.