SR Research Support Site
Data Fields
HOOKFCNS Struct Reference

Structure used set and get callback functions. More...

Data Fields

INT16(* setup_cal_display_hook )(void)
 
void(* exit_cal_display_hook )(void)
 
void(* record_abort_hide_hook )(void)
 
INT16(* setup_image_display_hook )(INT16 width, INT16 height)
 
void(* image_title_hook )(INT16 threshold, char *cam_name)
 
void(* draw_image_line_hook )(INT16 width, INT16 line, INT16 totlines, byte *pixels)
 
void(* set_image_palette_hook )(INT16 ncolors, byte r[], byte g[], byte b[])
 
void(* exit_image_display_hook )(void)
 
void(* clear_cal_display_hook )(void)
 
void(* erase_cal_target_hook )(void)
 
void(* draw_cal_target_hook )(INT16 x, INT16 y)
 
void(* cal_target_beep_hook )(void)
 
void(* cal_done_beep_hook )(INT16 error)
 
void(* dc_done_beep_hook )(INT16 error)
 
void(* dc_target_beep_hook )(void)
 
short(* get_input_key_hook )(InputEvent *event)
 
void(* alert_printf_hook )(const char *)
 

Detailed Description

Structure used set and get callback functions.

Structure used set and get callback functions so that the calibration graphics can be drawn.

Field Documentation

void( * alert_printf_hook) (const char *)

This function is called whenever alert_printf is called. In windows, if no callback is set calls MessageBox function. In other platforms, if no call back is set prints out to console.

void( * cal_done_beep_hook) (INT16 error)

This function is called to signal end of calibration.

Parameters
errorif non zero, then the calibration has error.
void( * cal_target_beep_hook) (void)

This function is called to signal new target.

void( * clear_cal_display_hook) (void)

Called to clear the calibration display.

void( * dc_done_beep_hook) (INT16 error)

This function is called to signal the end of drift correct.

Parameters
errorif non zero, then the drift correction failed.
void( * dc_target_beep_hook) (void)

This function is called to signal a new drift correct target.

void( * draw_cal_target_hook) (INT16 x, INT16 y)

This function is responsible for the drawing of the target for calibration,validation and drift correct at the given coordinate.

Parameters
xx coordinate of the target.
yy coordinate of the target.
Remarks
The x and y are relative to what is sent to the tracker for the command screen_pixel_coords.
void( * draw_image_line_hook) (INT16 width, INT16 line, INT16 totlines, byte *pixels)

This function is called to supply the image line by line from top to bottom.

Parameters
widthwidth of the picture. Essentially, number of bytes in pixels.
linecurrent line of the image
totlinestotal number of lines in the image. This will always equal the height of the image.
pixelspixel data.

Eg. Say we want to extract pixel at position (20,20) and print it out as rgb values.

if(line == 20) // y = 20
{
byte pix = pixels[19];
// Note the r,g,b arrays come from the call to set_image_palette
printf("RGB %d %d %d\n",r[pix],g[pix],b[pix]);
}
Remarks
certain display draw the image up side down. eg. GDI.
void( * erase_cal_target_hook) (void)

This function is responsible for erasing the target that was drawn by the last call to draw_cal_target.

void( * exit_cal_display_hook) (void)

This is called to release any resources that are not required beyond calibration. Beyond this call, no calibration functions will be called.

void( * exit_image_display_hook) (void)

This is called to notify that all camera setup things are complete. Any resources that are allocated in setup_image_display can be released in this function.

short( * get_input_key_hook) (InputEvent *event)

This is called to check for keyboard input. In this function:

  • check if there are any input events
  • if there are input events, fill key_input and return 1. otherwise return 0. If 1 is returned this will be called again to check for more events.
Parameters
[out]key_inputfill in the InputEvent structure to return key,modifier values.
Returns
if there is a key, return 1 otherwise return 0.
Remarks
Special keys and modifiers should match the following code.

Special keys:

#define F1_KEY 0x3B00
#define F2_KEY 0x3C00
#define F3_KEY 0x3D00
#define F4_KEY 0x3E00
#define F5_KEY 0x3F00
#define F6_KEY 0x4000
#define F7_KEY 0x4100
#define F8_KEY 0x4200
#define F9_KEY 0x4300
#define F10_KEY 0x4400
#define PAGE_UP 0x4900
#define PAGE_DOWN 0x5100
#define CURS_UP 0x4800
#define CURS_DOWN 0x5000
#define CURS_LEFT 0x4B00
#define CURS_RIGHT 0x4D00
#define ESC_KEY 0x001B
#define ENTER_KEY 0x000D

Modifier: If you are using SDL you do not need to modify the modifier value as they match the value.

#define ELKMOD_NONE 0x0000
#define ELKMOD_LSHIFT 0x0001
#define ELKMOD_RSHIFT 0x0002
#define ELKMOD_LCTRL 0x0040
#define ELKMOD_RCTRL 0x0080
#define ELKMOD_LALT 0x0100
#define ELKMOD_RALT 0x0200
#define ELKMOD_LMETA 0x0400
#define ELKMOD_RMETA 0x0800,
#define ELKMOD_NUM 0x1000
#define ELKMOD_CAPS 0x2000
#define ELKMOD_MODE 0x4000
void( * image_title_hook) (INT16 threshold, char *cam_name)

This function is called to update any image title change.

Parameters
thresholdif -1 the entire tile is in the title string otherwise, the threshold of the current image.
titleif threshold is -1, the title contains the whole title for the image. Otherwise only the camera name is given.
void( * record_abort_hide_hook) (void)

This function is called if abort of record. It is used to hide display from subject.

void( * set_image_palette_hook) (INT16 ncolors, byte r[], byte g[], byte b[])

This function is called after setup_image_display and before the first call to draw_image_line. This is responsible to setup the palettes to display the camera image.

Parameters
ncolorsnumber of colors in the palette.
rred component of rgb.
gblue component of rgb.
bgreen component of rgb.
INT16( * setup_cal_display_hook) (void)

This function is called to setup calibration/validation display. This function called before any calibration routines are called.

INT16( * setup_image_display_hook) (INT16 width, INT16 height)

This function is responsible for initializing any resources that are required for camera setup.

Parameters
widthwidth of the source image to expect.
heightheight of the source image to expect.
Returns
-1 if failed
0 success with flag indicating support for drawing single size camera images
1 success with flag indicating support for drawing variable size camera images, for high resolution global camera images with newer EyeLink tracker models.

Copyright ©2002-2024, SR Research Ltd.