/* display.h Header file for my display packages. John Watlington, 10/25/95 */ /* One of the following flags must be set, determining which routines are being used. */ #undef USE_PRINTF #define USE_X #ifdef USE_X #include #include #include #endif #define DISPLAY_MAX_COLORS 256 /* limit to 8bit display */ #define DISPLAY_DEPTH 8 #define DISPLAY_MAX_WINDOWS 8 /* may be increased */ /* This data type is used to represent a particular window to the application. */ typedef int window_tag; /****************************************************************** The following variables must unfortunately be declared globally in order to access them through preprocessor macros (desirable for speed) */ typedef struct { #ifdef USE_X Window W; GC Gc; XImage *I; #endif unsigned char *image; int x_size; int y_size; int num_levels; int min; int delta; } window_desc; extern window_desc window_desc_table[]; /****************************************************************** These are the function prototypes */ window_tag display_init_window( char *name, int x_size, int y_size, int num_levels ); void display_update( window_tag id ); void display_set_scale( window_tag id, int min, int max ); /* The following are actually implemented as preprocessor macros... unsigned char *display_get_image( window_tag ); void display_set_pixel( window_tag id, int x, int y, unsigned char raw_pixel_value ); void display_set_spixel( window_tag, x, y, scaled_value ) void display_set_fpixel( window_tag, x, y, scaled_value_float ) */ #define display_get_image( id ) (window_desc_table[ (id) ].image) #define display_set_pixel( id, x, y, raw ) ( \ *(window_desc_table[ (id) ].image + (x) + \ (window_desc_table[ (id) ].x_size * (y))) \ = (unsigned char)(raw) ) #define display_set_spixel( id, x, y, value ) () #define display_set_fpixel( id, x, y, fvalue ) ()