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

  1. /* Copyright (C) 1989, 1993 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. /* gxbitmap.h */
  20. /* Definitions for stored bitmaps for Ghostscript */
  21.  
  22. #ifndef gxbitmap_INCLUDED
  23. #  define gxbitmap_INCLUDED
  24.  
  25. /*
  26.  * Drivers such as the X driver and the command list (band list) driver
  27.  * benefit greatly by being able to cache bitmaps (tiles and characters)
  28.  * and refer to them later.  To support this, we define a bitmap ID type
  29.  * which the kernel passes to the driver on each copy_ or tile_ operation.
  30.  */
  31. typedef unsigned long gx_bitmap_id;
  32. #define gx_no_bitmap_id 0L
  33.  
  34. /*
  35.  * Structure for describing stored bitmaps.
  36.  * Bitmaps are stored bit-big-endian (i.e., the 0x80 bit of the first
  37.  * byte corresponds to x=0), as a sequence of bytes (i.e., you can't
  38.  * do word-oriented operations on them if you're on a little-endian
  39.  * platform like the Intel 80x86 or VAX).  Each scan line must start on
  40.  * a `word' (long) boundary, and hence is padded to a word boundary,
  41.  * although this should rarely be of concern, since the raster and width
  42.  * are specified individually.  The first scan line corresponds to y=0
  43.  * in whatever coordinate system is relevant.
  44.  */
  45. /* We assume arch_align_long_mod is 1-4 or 8. */
  46. #if arch_align_long_mod <= 4
  47. #  define log2_align_bitmap_mod 2
  48. #else
  49. #if arch_align_long_mod == 8
  50. #  define log2_align_bitmap_mod 3
  51. #endif
  52. #endif
  53. #define align_bitmap_mod (1 << log2_align_bitmap_mod)
  54. #define bitmap_raster(width_bits)\
  55.   ((uint)(((width_bits + (align_bitmap_mod * 8 - 1))\
  56.     >> (log2_align_bitmap_mod + 3)) << log2_align_bitmap_mod))
  57. /*
  58.  * The basic structure for a bitmap does not specify the depth;
  59.  * this is implicit in the context of use.
  60.  */
  61. #define gx_bitmap_common\
  62.     byte *data;\
  63.     int raster;            /* bytes per scan line */\
  64.     gs_int_point size;        /* width, height */\
  65.     gx_bitmap_id id
  66. typedef struct gx_bitmap_s {
  67.     gx_bitmap_common;
  68. } gx_bitmap;
  69. /*
  70.  * For bitmaps used as halftone tiles, we may replicate the tile in
  71.  * X and/or Y, but it is still valuable to know the true tile dimensions
  72.  * (i.e., the dimensions prior to replication).  Eventually, for rotated
  73.  * tiles, we will include strip and shift values that will allow us to
  74.  * store such tiles in much less space.
  75.  */
  76. typedef struct gx_tile_bitmap_s {
  77.     gx_bitmap_common;
  78.     ushort rep_width, rep_height;    /* true size of tile */
  79. } gx_tile_bitmap;
  80.  
  81. #endif                    /* gxbitmap_INCLUDED */
  82.