/*
     This is a dummy backend to show how to interface device specific
    graphics routines to the DISPLAY program

*/

#include    stdio
#include    "structs.h"

typedef struct hdrdef hdr_struct;
typedef struct ctbldef ctbl_struct;



/*
    Close the graphics device

*/

usr_close_device ()

{
    printf ("USR_CLOSE_DEVICE\n");
}



/*
    Dummy routine called before graphics device
    is closed

*/

usr_dummy ()

{
    printf ("USR_DUMMY\n");
}



/*
    Routine to retreive parameters from the header,
    and optionally display them

*/

usr_display_header (header)
hdr_struct	*header;

{
    printf ("USR_DISPLAY_HEADER\n");
    printf ("\n");
    printf ("Program version %d\n", header -> hdr_l_version);
    printf ("Center (r, i)  %f, %f\n", header -> hdr_f_center_r, header -> hdr_f_center_i);
    printf ("Scale (r, i)  %f, %f\n", header -> hdr_f_scale_r, header -> hdr_f_scale_i);
    printf ("H size %d   V size %d\n", header -> hdr_l_hsize, header -> hdr_l_vsize);
    printf ("Pixel size %d   Max pixel value %d\n", header -> hdr_l_pixel_size, header -> hdr_l_max_value);
    printf ("\n");
}




/*
    Routine to display the image on the graphics device

*/

usr_display_image (screen)
char	(*screen) [];

{
    int	    i;


    printf ("USR_DISPLAY_IMAGE\n");
    printf ("\n");

    for (i = 0; i < 20; i++)
	printf ("%x ", (*screen) [i]);

    printf ("\n");

}



/*
    Load the color table on the graphics device

*/

usr_load_color_table (color_table)
ctbl_struct    (*color_table) [];

{
    int	    i;


    printf ("USR_LOAD_COLOR_TABLE\n");
    printf ("\n");

    for (i = 0; i < 256; i++)
	printf ("Index %d\tRed %x\tGreen %x\tBlue %x\n", i,
		(*color_table) [i].ctbl_b_red, (*color_table) [i].ctbl_b_grn, (*color_table) [i].ctbl_b_blu);

    printf ("\n");
}



/*
    Open the graphics device

*/

usr_open_device ()

{
    printf ("USR_CLOSE_DEVICE\n");
}
