|
Camera API Technical Report:
Example Code |
.
.
Camera camera;
CameraWindow cam_win;
CameraOption *cam_opt;
int cam_val;
Widget option_menu;
int i, current_item;
/* get the x-sampling options and current value */
(void) CameraGetVal( camera, CV_X_SamplingOpt, &cam_opt );
(void) CameraGetVal( camera, CV_X_Sampling, &cam_val );
/* loop through options to make a menu */
for(i=0; cam_opt[i].str != NULL; i++){
/* set up a menu items structure */
/* test for current item */
if( cam_val == cam_opt[i].val )
current_item = i;
}
option_menu = HGU_XmBuildMenu(/* etc etc */);
/* get the current input window, change, check and reset it.
Note the window set may fail unless checked first. If CameraCheckVal
returns a non-zero value then the window has been changed
*/
(void) CameraGetVal( camera, CV_InputWindow, &cam_win );
fprintf(stderr, "Window origin = (%d, %d), width = %d, height = %d\n",
cam_win.x, cam_win.y, cam_win.width, cam_win.height);
cam_win.x += 200;
cam_win.y += 200;
(void) CameraCheckVal( camera, CV_InputWindow, &cam_win );
(void) CameraSetVal( camera, CV_InputWindow, &cam_win );