Data Structures | |
struct | _CCDBS |
Macros | |
#define | SDLRGB(x, y) SDL_MapRGB(x->format,(y).r,(y).g,(y).b) |
#define | SCREEN_LEFT dispinfo.left |
#define | SCREEN_TOP dispinfo.top |
#define | SCREEN_RIGHT dispinfo.right |
#define | SCREEN_BOTTOM dispinfo.bottom |
#define | SCRHEIGHT dispinfo.height |
#define | SCRWIDTH dispinfo.width |
#define | bitmap_save_and_backdrop sdl_bitmap_save_and_backdrop |
#define | bitmap_to_backdrop sdl_bitmap_to_backdrop |
#define | bitmap_save sdl_bitmap_save |
#define | Flip(x) while(SDL_Flip(x)<0) |
#define | EXTERNAL_DEV_NONE ((getExButtonStates)0) |
#define | EXTERNAL_DEV_CEDRUS ((getExButtonStates)1) |
#define | EXTERNAL_DEV_SYS_KEYBOARD ((getExButtonStates)2) |
Typedefs | |
typedef struct _CCDBS | CCDBS |
typedef int(* | getExButtonStates) (CCDBS *) |
Functions | |
void | set_calibration_colors (SDL_Color *fg, SDL_Color *bg) |
void | set_target_size (UINT16 diameter, UINT16 holesize) |
void | set_cal_sounds (char *ontarget, char *ongood, char *onbad) |
void | set_dcorr_sounds (char *ontarget, char *ongood, char *onbad) |
INT16 | set_camera_image_position (INT16 left, INT16 top, INT16 right, INT16 bottom) |
int | get_current_display_information (int *csw, int *csh, int *ccd) |
void | get_display_information (DISPLAYINFO *di) |
INT16 | init_expt_graphics (SDL_Surface *hwnd, DISPLAYINFO *info) |
void | close_expt_graphics (void) |
int | sdl_bitmap_save_and_backdrop (SDL_Surface *hbm, INT16 xs, INT16 ys, INT16 width, INT16 height, const char *fname, const char *path, INT16 sv_options, INT16 xd, INT16 yd, UINT16 bx_options) |
int | sdl_bitmap_to_backdrop (SDL_Surface *hbm, INT16 xs, INT16 ys, INT16 width, INT16 height, INT16 xd, INT16 yd, UINT16 bx_options) |
int | sdl_bitmap_save (SDL_Surface *hbm, INT16 xs, INT16 ys, INT16 width, INT16 height, char *fname, char *path, INT16 sv_options) |
void | set_cal_target_surface (SDL_Surface *surface) |
void | set_cal_background_surface (SDL_Surface *surface) |
void | reset_background_surface (void) |
void | disable_custombackground_on_imagemode (void) |
int | set_cal_animation_target (const char *aviName, int playCount, int options) |
void | set_lerp_on_target_move (int animateMove) |
int | enable_external_calibration_device (getExButtonStates buttonStatesfcn, const char *config, void *userData) |
#define bitmap_save sdl_bitmap_save |
#define bitmap_save_and_backdrop sdl_bitmap_save_and_backdrop |
#define bitmap_to_backdrop sdl_bitmap_to_backdrop |
void close_expt_graphics | ( | void | ) |
Call this function at the end of the experiment or before destroying the window registered with init_expt_graphics()
. This call will disable calibration and drift correction until a new window is registered.
int enable_external_calibration_device | ( | getExButtonStates | buttonStatesfcn, |
const char * | config, | ||
void * | userData | ||
) |
Enables non keyboard devices to be used for calibration control.
[in] | buttonStatesfcn | callback function reads the device and returns appropriate data. |
[in] | config | - A character string of the config file content or config file name. Whether the config is the content or a file name is determined by looking for a new line character. If there is a new line character the content is assumed. To use the default config, set the parameter to NULL. The default config will be: |
[in] | userData | user data to pass back in the callback. |
int get_current_display_information | ( | int * | csw, |
int * | csh, | ||
int * | ccd | ||
) |
Returns screen resolution in pixels and colour depth in bits per pixel of the current display mode, and fills the respective pointers to integer arguments accordingly. The main purpose of this function is to obtain the current resolution of the desktop environment before the call to initialize the main window.
csw | Current Screen Width in pixels. |
csh | Current Screen Height in pixels. |
ccd | Current colour depth in bits per pixel. |
1
if success, 0
if failure to detect display mode. Custom initialization of SDL using current display mode can be done in the following manner: <pre>
void get_display_information | ( | DISPLAYINFO * | di | ) |
Measures parameters of the current display mode, and fills a DISPLAYINFO
structure with the data. This process may take over 100 milliseconds, as it measures actual refresh rate. The returned data can be used to compute sizes for drawing, and to check that the current display mode matches the requirements of the experiment. A global DISPLAYINFO
structure called dispinfo should be set up at the start of the program if you wish to use the SCRWIDTH
and SCRHEIGHT
macros.
DISPLAYINFO
structure: If refresh cannot be measured, the "refresh" field will contain a value less than 40.
di | Pointer to DISPLAYINFO structure to fill. |
This is an optional function to get information on video driver and current mode use this to determine if in proper mode for experiment.
[out] | di | A valid pointer to DISPLAYINFO is passed in to return values. |
INT16 init_expt_graphics | ( | SDL_Surface * | hwnd, |
DISPLAYINFO * | info | ||
) |
You must always create a borderless, full-screen window for your experiment. This function registers the window with EXPTSPPT so it may be used for calibration and drift correction. The window should not be destroyed until it is released with close_expt_graphics()
. This window will be subclassed (some messages intercepted) during calibration and drift correction.
hwnd | Handle of window that is to be used for calibration and drift correction. If NULL is passed in, SDL initialized and requested display mode is set. |
info | NULL or pointer to a DISPLAYINFO structure to fill with display mode data. If NULL is passed in, current display mode is used. |
0
if success, -1
if error occurred internally.Default initialization of eyelink_core_library:
Custom initialization of SDL can be done in the following manner.
void reset_background_surface | ( | void | ) |
Removes the custom background. equivalent of calling set_cal_background_surface(NULL);
int sdl_bitmap_save | ( | SDL_Surface * | hbm, |
INT16 | xs, | ||
INT16 | ys, | ||
INT16 | width, | ||
INT16 | height, | ||
char * | fname, | ||
char * | path, | ||
INT16 | sv_options | ||
) |
This function saves the entire bitmap or selected part of a bitmap in an image file (with an extension of .png, .bmp, .jpg, or .tif). It creates the specified file if this file does not exist. If the file exists, it replaces the file unless SV_NOREPLACE
is specified in the field of "sv_options". The directory to which the file will be written is specified in the path field.
hbm | Handle to the bitmap image. |
xs | Specifies the x-coordinate of the upper-left corner of the source bitmap. |
ys | Specifies the y-coordinate of the upper-left corner of the source bitmap. |
width | Specify the width of the source image to be copied (set to 0 to use all). |
height | Specify the height of the source image to be copied (set to 0 to use all). |
fname | Name of the image file to be saved. Currently, only .PNG, .BMP, .JPG, and .TIF files are saved. |
path | Directory or drive path in quotes ("." for current directory). |
sv_options | Use SV_NOREPLACE if not to replace an existing file; use SV_MAKEPATH to create a new path. |
0
if successful, else -1
. int sdl_bitmap_save_and_backdrop | ( | SDL_Surface * | hbm, |
INT16 | xs, | ||
INT16 | ys, | ||
INT16 | width, | ||
INT16 | height, | ||
const char * | fname, | ||
const char * | path, | ||
INT16 | sv_options, | ||
INT16 | xd, | ||
INT16 | yd, | ||
UINT16 | bx_options | ||
) |
This function saves the entire bitmap as a .BMP, .JPG, .PNG, or .TIF file, and transfers the image to tracker as backdrop for gaze cursors (See bitmap_save()
and bitmap_to_backdrop()
for more information).
hbm | Handle to the bitmap image. |
xs | Specifies the x-coordinate of the upper-left corner of the source bitmap. |
ys | Specifies the y-coordinate of the upper-left corner of the source bitmap. |
width | Specify the width of the source image to be copied (set to 0 to use all). |
height | Specify the height of the source image to be copied (set to 0 to use all). |
fname | Name of the image file to be saved. Currently, only .PNG, .BMP, .JPG, and .TIF files are saved. |
path | Directory or drive path in quotes ("." for current directory). |
sv_options | Use SV_NOREPLACE if not to replace an existing file; use SV_MAKEPATH to create a new path. |
xd | Specifies the x-coordinate of the upper-left corner of the tracker screen. |
yd | Specifies the y-coordinate of the upper-left corner of the tracker screen. |
bx_options | Set with a bitwise OR of the following constants: BX_MAXCONTRAST: Maximizes contrast for clearest image; BX_AVERAGE: averages combined pixels; BX_DARKEN: chooses darkest (keep thin dark lines); BX_LIGHTEN: chooses darkest (keep thin white lines); BX_NODITHER: disables dithering to get clearest text; BX_GREYSCALE: converts to grayscale. |
0
if successful, -1
if couldn't save, -2
if couldn't transfer int sdl_bitmap_to_backdrop | ( | SDL_Surface * | hbm, |
INT16 | xs, | ||
INT16 | ys, | ||
INT16 | width, | ||
INT16 | height, | ||
INT16 | xd, | ||
INT16 | yd, | ||
UINT16 | bx_options | ||
) |
This function transfers the bitmap to the tracker PC as backdrop for gaze cursors. The field "bx_options", set with bitwise OR of the following constants, determines how bitmap is processed: BX_AVERAGE
(averaging combined pixels), BX_DARKEN
(choosing darkest and keep thin dark lines), and BX_LIGHTEN
(choosing darkest and keep thin white lines) control how bitmap size is reduced to fit tracker display; BX_MAXCONTRAST
maximizes contrast for clearest image; BX_NODITHER
disables the dithering of the image; BX_GREYSCALE
converts the image to grayscale (grayscale works best for EyeLink I, text, etc.)
hbm | Handle to the bitmap image. |
xs | Specifies the x-coordinate of the upper-left corner of the source bitmap. |
ys | Specifies the y-coordinate of the upper-left corner of the source bitmap. |
width | Specify the width of the source image to be copied (set to 0 to use all). |
height | Specify the height of the source image to be copied (set to 0 to use all). |
xd | Specifies the x-coordinate of the upper-left corner of the tracker screen. |
yd | Specifies the y-coordinate of the upper-left corner of the tracker screen. |
bx_options | Set with a bitwise OR of the following constants: BX_MAXCONTRAST: Maximizes contrast for clearest image; BX_AVERAGE: averages combined pixels; BX_DARKEN: chooses darkest (keep thin dark lines); BX_LIGHTEN: chooses darkest (keep thin white lines); BX_NODITHER: disables dithering to get clearest text; BX_GREYSCALE: converts to grayscale. |
0
if successful, else -1
or -2
int set_cal_animation_target | ( | const char * | aviName, |
int | playCount, | ||
int | options | ||
) |
Allow one to set target with animation. The expected video can be loadable using VFW(type 1 avi) also, both audio and video streams must be present. The audio stream must be of pcm type.
aviname | Name of the avi to use |
playCount | How many time to loop through the video. Specify -1 to loop indefinitely. for future use. |
void set_cal_background_surface | ( | SDL_Surface * | surface | ) |
Allow one to set arbituary background in place of flat background
surface |
void set_cal_sounds | ( | char * | ontarget, |
char * | ongood, | ||
char * | onbad | ||
) |
Selects the sounds to be played during do_tracker_setup()
, including calibration, validation and drift correction. These events are the display or movement of the target, successful conclusion of calibration or good validation, and failure or interruption of calibration or validation.
ontarget | Sets sound to play when target moves. |
ongood | Sets sound to play on successful operation. |
onbad | Sets sound to play on failure or interruption. |
Example: See do_tracker_setup()
do_tracker_setup()
and set_dcorr_sounds()
void set_cal_target_surface | ( | SDL_Surface * | surface | ) |
Allow one to set arbituary target in place of circle target. Eg. a custom cursor.
surface |
void set_calibration_colors | ( | SDL_Color * | fg, |
SDL_Color * | bg | ||
) |
Passes the colors of the display background and fixation target to the EXPTSPPT library. During calibration, camera image display, and drift correction, the display background should match the brightness of the experimental stimuli as closely as possible, in order to maximize tracking accuracy. This function passes the colors of the display background and fixation target to the EXPTSPPT library. This also prevents flickering of the display at the beginning and end of drift correction.
fg | Color used for drawing calibration target. |
bg | Color used for drawing calibration background. |
Example: See do_tracker_setup()
do_tracker_setup()
INT16 set_camera_image_position | ( | INT16 | left, |
INT16 | top, | ||
INT16 | right, | ||
INT16 | bottom | ||
) |
To adjust camera image position. By default the camera is placed at the centre of the screen.
left | Left position. |
top | Top position. |
right | Right position. |
bottom | Bottom position. |
void set_dcorr_sounds | ( | char * | ontarget, |
char * | ongood, | ||
char * | onbad | ||
) |
Selects the sounds to be played during do_drift_correct()
. These events are the display or movement of the target, successful conclusion of drift correction, and pressing the 'ESC' key to start the Setup menu.
ontarget | Sets sound to play when target moves. |
ongood | Sets sound to play on successful operation. |
onbad | Sets sound to play on failure or interruption. |
Example: See do_tracker_setup()
do_tracker_setup()
and set_cal_sounds()
void set_lerp_on_target_move | ( | int | animateMove | ) |
Allow one to set target move animation on or off. If set to non zero integer, target move during cablibration get animated as trace movement.
animateMove | 0 will set to default behavior which is not to animate the target as trace movement. 1 will set to animate the trace movement of target. |
void set_target_size | ( | UINT16 | diameter, |
UINT16 | holesize | ||
) |
The standard calibration and drift correction target is a disk (for peripheral delectability) with a central "hole" target (for accurate fixation). The sizes of these features may be set with this function.
diameter | Size of outer disk, in pixels. |
holesize | Size of central feature. If <holesize> is 0 , no central feature will be drawn. |
Example: See do_tracker_setup()
do_tracker_setup()