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

  1. /* Copyright (C) 1991, 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. /* gxclist.h */
  20. /* Command list definitions for Ghostscript. */
  21. /* Requires gxdevice.h and gxdevmem.h */
  22.  
  23. /*
  24.  * A command list is essentially a compressed list of driver calls.
  25.  * Command lists are used to record an image that must be rendered in bands
  26.  * for a high-resolution printer.  In the future, they may be used
  27.  * for other purposes as well, such as providing a more compact representation
  28.  * of cached characters than a full bitmap (at high resolution), or
  29.  * representing fully rendered user paths (a Level 2 feature).
  30.  */
  31.  
  32. /* A command list device outputs commands to a stream, */
  33. /* then reads them back to render in bands. */
  34. typedef struct gx_device_clist_s gx_device_clist;
  35. typedef struct gx_clist_state_s gx_clist_state;
  36. typedef struct {
  37.     int slot_index;
  38. } tile_hash;
  39. typedef struct {
  40.     gx_bitmap_id id;
  41.     /* byte band_mask[]; */
  42.     /* byte bits[]; */
  43. } tile_slot;
  44. struct gx_device_clist_s {
  45.     gx_device_forward_common;    /* (see gxdevice.h) */
  46.     /* Following must be set before writing or reading. */
  47.     /* gx_device *target; */    /* device for which commands */
  48.                     /* are being buffered */
  49.     byte *data;            /* buffer area */
  50.     uint data_size;            /* size of buffer */
  51.     FILE *cfile;            /* command list file */
  52.     FILE *bfile;            /* command list block file */
  53.     /* Following are used only when writing. */
  54.     gx_clist_state *states;        /* current state of each band */
  55.     byte *cbuf;            /* start of command buffer */
  56.     byte *cnext;            /* next slot in command buffer */
  57.     byte *cend;            /* end of command buffer */
  58.     gx_clist_state *ccls;        /* clist_state of last command */
  59.     /* Following is the tile cache, used only when writing. */
  60.     gx_tile_bitmap tile;        /* current tile cache parameters */
  61.                     /* (data pointer & id not used) */
  62.     tile_hash *tile_hash_table;    /* hash table for tile cache: */
  63.                     /* -1 = unused, >= 0 = slot index */
  64.     uint tile_max_size;        /* max size of a single tile */
  65.     uint tile_hash_mask;        /* size of tile hash table -1 */
  66.     uint tile_band_mask_size;    /* size of band mask preceding */
  67.                     /* each tile in the cache */
  68.     uint tile_count;        /* # of occupied entries in cache */
  69.     uint tile_max_count;        /* capacity of the cache */
  70.     /* Following are used for both writing and reading. */
  71.     byte *tile_data;        /* data for cached tiles */
  72.     uint tile_data_size;        /* total size of tile cache data */
  73.     uint tile_slot_size;        /* size of each slot in tile cache */
  74. #define tile_slot_ptr(cldev,index)\
  75.   (tile_slot *)((cldev)->tile_data + (index) * (cldev)->tile_slot_size)
  76. #define ts_mask(pts) (byte *)((pts) + 1)
  77. #define ts_bits(cldev,pts) (ts_mask(pts) + (cldev)->tile_band_mask_size)
  78.     /* Following are set when writing, read when reading. */
  79.     int band_height;        /* height of each band */
  80.     int nbands;            /* # of bands */
  81.     long bfile_end_pos;        /* ftell at end of bfile */
  82.     /* Following are used only when reading. */
  83.     int ymin, ymax;            /* current band */
  84.     gx_device_memory mdev;
  85. };
  86. /* The device template itself is never used, only the procs. */
  87. extern gx_device_procs gs_clist_device_procs;
  88.