Cropping Capability
C Reference » Production Nodes Functionality » Map Generator

## Functions

XN_C_API XnStatus XN_C_DECL | xnSetCropping (XnNodeHandle hInstance, const XnCropping *pCropping)
XN_C_API XnStatus XN_C_DECL | xnGetCropping (XnNodeHandle hInstance, XnCropping *pCropping)
XN_C_API XnStatus XN_C_DECL | xnRegisterToCroppingChange (XnNodeHandle hInstance, XnStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromCroppingChange (XnNodeHandle hInstance, XnCallbackHandle hCallback)

## Detailed Description

The Cropping capability (XN_CAPABILITY_CROPPING) allows a Map Generator to output a selected area of the frame instead of the entire frame. When cropping is turned on, the data buffer looks just like resolution is smaller, meaning data is packed. For example if the MapGenerator is working in VGA resolution (640x480) and the application chose a cropping of 300x200, then after first 300 pixels the next pixel row begins. Pixels outside the cropping area are not returned in the buffer (and not just being blacked out). This is very useful for performance boost.

## Function Documentation

## xnGetCropping()

XN_C_API XnStatus XN_C_DECL xnGetCropping | ( | XnNodeHandle | hInstance,
|  | XnCropping * | pCropping )

Gets current cropping configuration.

Parameters

  hInstance | [in] A handle to the instance.
  pCropping | [out] Current cropping configuration.

Returns
  XN_STATUS_INVALID_OPERATION if this production node does not support the Cropping capability.

## xnRegisterToCroppingChange()

XN_C_API XnStatus XN_C_DECL xnRegisterToCroppingChange | ( | XnNodeHandle | hInstance,
|  | XnStateChangedHandler | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers a callback function to cropping changes.

Parameters

  hInstance | [in] A handle to the instance.
  handler | [in] A pointer to a function that will be called when cropping changes.
  pCookie | [in] A user cookie that will be passed to the callback function.
  phCallback | [out] Optional. Will be filled with a handle to be passed to xnUnregisterFromCroppingChange().

## xnSetCropping()

XN_C_API XnStatus XN_C_DECL xnSetCropping | ( | XnNodeHandle | hInstance,
|  | const XnCropping * | pCropping )

Sets the cropping.

Parameters

  hInstance | [in] A handle to the instance.
  pCropping | [in] The cropping configuration to be set.

Returns
  XN_STATUS_INVALID_OPERATION if this production node does not support the Cropping capability.

## xnUnregisterFromCroppingChange()

XN_C_API void XN_C_DECL xnUnregisterFromCroppingChange | ( | XnNodeHandle | hInstance,
|  | XnCallbackHandle | hCallback )

Unregisters a callback function which was registered using xnRegisterToCroppingChange().

Parameters

  hInstance | [in] A handle to the instance.
  hCallback | [in] The handle to the callback returned from xnRegisterToCroppingChange().