
#ifndef MAIN_VIDEO_H
#define MAIN_VIDEO_H

//
// $Id: main_video.h,v 1.2 2004/04/30 07:02:40 duckhunt Exp $
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS OR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston MA
// 02111-1307, USA.
//
// This file uses PERCEPS style comments to facilitate automatic
// documentation generation. More information on PERCEPS can be
// found at "http://starship.python.net/crew/tbryan/PERCEPS".
//
// Author: Ross J. Micheals
//         rmicheals@lehigh.edu
//
// (c) 1999-2001 Ross J. Micheals

#include <SPU-Toolbox/SPU-Toolbox.h>
#include <math.h>
#include <string>
#include <iostream>
#include <sstream>

// Once registered, this callback will be executed when XIH receieves
// a keypress
// This allows dynamic changes in the filtering mode, along with other
// keyboard commands.
void keypress_callback(XIH* xih, const XEvent *xev);

// performs image differencing, given a current image and a previous image
void do_difference(SPU_Image* cur_image, SPU_Image* prev_image);

// threshold eliminates all pixels whose total value does not exceed some
// threshold value
void do_threshold(SPU_Image* image);

// do_box draws a box around where the program thinks the duck is
void do_box(SPU_Image* cur_image);

// checks the currect filtering mode and calls the appropriate function
// to do image operations.
void process_image(SPU_Image* cur_image, SPU_Image* prev_image);

// Called when the main XIH control thread dies.
//
void done_callback(void);
void find_duck(int upperleftx, int upperlefty, int lowerrightx,
			 int lowerrighty, SPU_Image* cur_image, int increment);

void draw_target(SPU_Image* cur_image);
double convert_x(int);
double convert_y(int);
void predict_duck(int, int, int, int);
bool delay_ok(void);
bool round_start(SPU_Image*);
bool near_dog(int, int);
bool should_fire(SPU_Image*);

#endif // MAIN_VIDEO_H

