home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / printing / ghostscrip / source / _gs / h / gxdevmem < prev    next >
Encoding:
Text File  |  1991-10-25  |  3.7 KB  |  89 lines

  1. /* Copyright (C) 1989, 1991 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxdevmem.h */
  21. /* "Memory" device structure for Ghostscript library */
  22. /* Requires gxdevice.h */
  23.  
  24. /*
  25.  * A 'memory' device is essentially a stored bitmap.
  26.  * There are several different kinds: monochrome, 8-bit mapped color,
  27.  * and 24- and 32-bit true color.  (24- and 32-bit are equivalent:
  28.  * 24-bit takes less space, but is slower.)  All use the same structure,
  29.  * since it's so awkward to get the effect of subclasses in C.
  30.  *
  31.  * On little-endian machines, the bytes can be stored in either order.
  32.  * Little-endian order is the default, since this allows efficient
  33.  * updating; big-endian is required if the bits will be used as the
  34.  * source for a rendering operation (e.g., in the character cache).
  35.  * We provide an operation to normalize the byte order, and we trust the
  36.  * client not to do any rendering operations if the byte order is
  37.  * reversed.
  38.  */
  39. typedef struct gx_device_memory_s gx_device_memory;
  40. struct gx_device_memory_s {
  41.     gx_device_common;        /* (see gxdevice.h) */
  42.     gs_matrix initial_matrix;    /* the initial transformation */
  43.     int raster;            /* bytes per scan line, */
  44.                     /* filled in by '...bitmap_size' */
  45.     byte *base;
  46.     byte **line_ptrs;        /* scan line pointers */
  47.     int bytes_le;            /* true if bytes are stored in */
  48.                     /* little-endian order */
  49.     /* Following is only needed for monochrome */
  50.     int invert;            /* 0 if 1=white, -1 if 1=black */
  51.     /* Following are only needed for mapped color */
  52.     int palette_size;        /* # of entries */
  53.     byte *palette;            /* RGB triples */
  54. };
  55. extern gx_device_memory
  56.     mem_mono_device,
  57.     mem_mapped8_color_device,
  58.     mem_true24_color_device,
  59.     mem_true32_color_device;
  60.  
  61. /* Memory devices may have special setup requirements. */
  62. /* In particular, it may not be obvious how much space to allocate */
  63. /* for the bitmap.  Here is the routine that computes this */
  64. /* from the width and height in the device structure. */
  65. extern ulong gdev_mem_bitmap_size(P1(gx_device_memory *));
  66.  
  67. /* Test whether a device is a memory device. */
  68. extern int gs_device_is_memory(P1(gx_device *));
  69.  
  70. /* Copy data from the bitmap to a client. */
  71. /* Return the number of lines copied. */
  72. extern int gdev_mem_copy_scan_lines(P4(gx_device_memory *,
  73.     int /* first_line */, byte * /* string */, uint /* string_size */));
  74.  
  75. /* Return the number of bytes per scan line for copy_scan_lines. */
  76. extern int gdev_mem_bytes_per_scan_line(P1(gx_device *));
  77.  
  78. /* Ensure that the data bytes are in big-endian order. */
  79. /* This is only needed when the bitmap will be used as the source */
  80. /* for a copy_mono operation, and is only used for the character cache */
  81. /* and similar RAM-resident devices. */
  82. extern void gdev_mem_ensure_byte_order(P1(gx_device_memory *));
  83.  
  84. /*
  85.  * A memory device is guaranteed to allocate the bitmap consecutively,
  86.  * i.e., in the form that can serve as input to copy_mono or copy_color
  87.  * operations (provided that the bytes are in big-endian order, of course).
  88.  */
  89.