/*
    bomb - automatic interactive visual stimulation
    Copyright (C) 1994  Scott Draves <spot@cs.cmu.edu>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifdef __cplusplus
extern "C" {
#endif

#define sym_one          0
#define sym_tile4        1
#define sym_mirror4      2
#define sym_mirror2      3
#define sym_frame_buffer 4
#define sym_tile4_stack2 5

#define fill_hramp  0
#define fill_vramp  1
#define fill_grid   2
#define fill_noise  3
#define fill_vnoise 4    /* vert sym */
#define fill_sparse 5    /* each bit 1/(2^4) */
#define nfills      6


#define rule_rug            0
#define rule_rug2           1
#define rule_static         2
#define rule_rotorug        3
#define rule_acidlife1      4
#define rule_acidlife2      5
#define rule_rug_anneal     6
#define rule_rug_anneal2    7
#define rule_rug_rug        8
#define rule_rug_brain      9
#define rule_shade         10
#define rule_wave          11
#define rule_rug_image     12
#define rule_slip          13
#define rule_fuse          14
#define rule_rug_multi     15
#define rule_rd            16
#define rule_rd2           17
#define nrules             18

#define cmap_mono   0
#define cmap_mono4  1
#define cmap_loop   2
#define cmap_path   3
#define cmap_heat   4
#define cmap_plain  5
#define cmap_split  6
#define cmap_noise  7
#define cmap_black  8


#define distrib_original   0
#define distrib_new        1
#define distrib_continuous 2
#define distrib_rule_lock  4

#define grad_none -1

#define use_mpeg 0

#if use_mpeg
#include "mpeg2/src/mpeg2enc/mpeg.h"
#endif

extern int grad_state;
extern rule_t rule;
extern int current_cmap[256 * 3];

void fill_board(fill_t *p);
void pix2heat(image8_t *fb, board_t *dst);
void change_rules2(int old_sym, int new_sym, board_t *dst);
void pix2heat2(image8_t *fb, board_t *dst,
	       int x0, int y0, int x1, int y1);
void double_board(int vh, board_t *dst, int sym);
void write_fb_mpeg(image8_t *fb);
void write_fb_ppm(image8_t *fb);
int run_hist(image8_t *fb);
void cool(image8_t *fb);
void warm(image8_t *fb);
void image8_set_cmap(int i, int n, int *cmap);
double adjust_speed(double);
void image8_flush();
void blur(board_t *from, board_t *to);
void image2grad(board_t *from, board_t *to, int s, int n, int m);
void spiral(board_t *to, double angle, int n, int m);
void hex_tile(board_t *to, double angle, int *pattern, int pat_len, int n, int m);
void do_mouse(int x, int y);
void pen(board_t *dboard, int mask, int x, int y, int bsize);
void bomb_exit();
void init();
#ifdef win_bomb
int win_init();
void read_registry();
void write_registry();
extern int rule_mask;
int win_exit();
void work();
#endif

void begin_timer();
double end_timer();

#ifdef __cplusplus
}
#endif





#if mac_bomb
/* if pix_rep is 0 then write directly on the screen */
#define pix_rep 0
#define use_sioux 0
#endif


#if xws_bomb
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#define pix_rep 1
extern char *image_buf;
extern Display *disp;
extern Window win;
extern GC gc;
extern XImage *xws_image;
extern Colormap xws_cmap;
#endif

#if ogl_bomb
#include <GL/gl.h>
#include <GL/glx.h>
#include <X11/X.h>
#include <X11/Xutil.h>
#define pix_rep 3
extern Display *disp;
extern Window win;
extern Colormap xws_cmap;
#endif
