home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / GDEVSVGA.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  3KB  |  90 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gdevsvga.h */
  20. /* SuperVGA display definitions */
  21. /* Requires gdevpcfb.h */
  22.  
  23. /* Common procedures */
  24.  
  25.     /* See gxdevice.h for the definitions of the procedures. */
  26.  
  27. dev_proc_close_device(svga_close);
  28. dev_proc_map_rgb_color(svga_map_rgb_color);
  29. dev_proc_map_color_rgb(svga_map_color_rgb);
  30. dev_proc_fill_rectangle(svga_fill_rectangle);
  31. dev_proc_copy_mono(svga_copy_mono);
  32. dev_proc_copy_color(svga_copy_color);
  33. dev_proc_get_bits(svga_get_bits);
  34.  
  35. /* Table structure for looking up graphics modes. */
  36. typedef struct {
  37.     int width, height;        /* "key" */
  38.     int mode;            /* "value" */
  39. } mode_info;
  40.  
  41. /* The device descriptor structure */
  42. typedef struct gx_device_svga_s gx_device_svga;
  43. struct gx_device_svga_s {
  44.     gx_device_common;
  45.     int (*get_mode)(P0());
  46.     void (*set_mode)(P1(int));
  47.     void (*set_page)(P3(gx_device_svga *fbdev, int pnum, int wnum));
  48.     const mode_info _ds *mode;    /* BIOS display mode info */
  49.     uint raster;            /* frame buffer bytes per line */
  50.     int current_page;        /* current page */
  51.     int wnum_read, wnum_write;    /* window #s for read vs. write */
  52.     /* Following are device-specific. */
  53.     union {
  54.       struct {
  55.         void (*bios_set_page)(P2(int, int));    /* set-page function */
  56.         int pn_shift;        /* log2(64K/granularity) */
  57.       } vesa;
  58.       struct {
  59.         int select_reg;            /* page-select register */
  60.       } atiw;
  61.       struct {
  62.         int et_model;            /* 4 for ET4000, */
  63.                         /* 3 for ET3000 */
  64.       } tseng;
  65.     } info;
  66. };
  67.  
  68. /* The initial parameters map an appropriate fraction of */
  69. /* the screen to a full-page coordinate space. */
  70. /* This may or may not be what is desired! */
  71. #define svga_color_device(procs, name, depth, maxv, dither, get_mode, set_mode, set_page) {\
  72.     sizeof(gx_device_svga),\
  73.     &procs,\
  74.     name,\
  75.     640, 480,        /* screen size */\
  76.     480 / PAGE_HEIGHT_INCHES, 480 / PAGE_HEIGHT_INCHES, /* resolution */\
  77.     no_margins,\
  78.     dci_color(depth, maxv, dither),\
  79.     dev_init_misc,\
  80.     { 0 },            /* std_procs */\
  81.     get_mode, set_mode, set_page\
  82.    }
  83. #define svga_device(procs, name, get_mode, set_mode, set_page)\
  84.   svga_color_device(procs, name, 8, 31, 4, get_mode, set_mode, set_page)
  85.  
  86. /* Utility procedures */
  87. void    svga_init_colors(P0());
  88. int    svga_find_mode(P2(gx_device *, const mode_info _ds *));
  89. int    svga_open(P1(gx_device *));
  90.