Expand/Shrink

cdContextRegisterCallback

Definition: include pGUI.e

integer res = cdContextRegisterCallback(cdContext context, integer cb, atom cbFunc)
Description: Used to customize the behavior of the cdCanvasPlay() function.
pwa/p2js: Not supported.
Comments: If you register a known callback function, it will be called during the processing loop of cdCanvasPlay.

Returns CD_OK if the specified callback is supported or CD_ERROR otherwise.

The callback itself should return CD_CONTINUE, if it returns CD_ABORT, the cdCanvasPlay function is aborted.
The callback identifiers of a given driver must be in the header file relative to that driver, with prefix "CD_XXYYYCB", where XX identifies that driver and YYY identifies the callback name.

There is a default callback common to all implementations of cdPlay, CD_SIZECB. Its definition is:

int cdResizeCB(cdCanvas* canvas, int width, int height, double mm_width, double mm_height)

It returns the size of the image in the file before any function in the CD library is called, so that you can call the cdCanvasPlay function without an active canvas and create the canvas inside the callback.
Its values are the same as returned by the cdCanvasGetSize() function.

Note: pGUI.e does not yet define any callback identifiers other than CD_SIZECB.