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

  1. /* Copyright (C) 1989, 1992, 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. /* gzstate.h */
  20. /* Private graphics state definition for Ghostscript library */
  21. #include "gxdcolor.h"
  22. #include "gxfixed.h"
  23. #include "gxmatrix.h"
  24. #include "gsstate.h"
  25. #include "gxdevice.h"
  26.  
  27. /* Opaque types referenced by the graphics state. */
  28. #ifndef gs_font_DEFINED
  29. #  define gs_font_DEFINED
  30. typedef struct gs_font_s gs_font;
  31. #endif
  32. #ifndef gs_halftone_DEFINED
  33. #  define gs_halftone_DEFINED
  34. typedef struct gs_halftone_s gs_halftone;
  35. #endif
  36. #ifndef gx_device_halftone_DEFINED
  37. #  define gx_device_halftone_DEFINED
  38. typedef struct gx_device_halftone_s gx_device_halftone;
  39. #endif
  40. #ifndef gx_transfer_map_DEFINED
  41. #  define gx_transfer_map_DEFINED
  42. typedef struct gx_transfer_map_s gx_transfer_map;
  43. #endif
  44.  
  45. /* Composite components of the graphics state. */
  46. typedef struct gx_transfer_s {
  47.     gx_transfer_map *red;
  48.     gx_transfer_map *green;
  49.     gx_transfer_map *blue;
  50.     gx_transfer_map *gray;
  51. } gx_transfer;
  52.  
  53. /* We allocate a large subset of the graphics state as a single object. */
  54. /* Its type is opaque here, defined in gsstate.c. */
  55. /* The components marked with @ must be allocated in the contents. */
  56. typedef struct gs_state_contents_s gs_state_contents;
  57.  
  58. /* Graphics state structure. */
  59.  
  60. struct gs_state_s {
  61.     gs_state *saved;        /* previous state from gsave */
  62.     gs_memory_t *memory;
  63.     gs_state_contents *contents;
  64.  
  65.         /* Transformation: */
  66.  
  67.     gs_matrix_fixed ctm;
  68. #define ctm_only(pgs) *(gs_matrix *)&(pgs)->ctm
  69.     gs_matrix ctm_inverse;
  70.     int inverse_valid;        /* true if ctm_inverse = ctm^-1 */
  71.  
  72.         /* Paths: */
  73.  
  74.     struct gx_path_s *path;
  75.     struct gx_clip_path_s *clip_path;    /* @ */
  76.     int clip_rule;
  77.  
  78.         /* Lines: */
  79.  
  80.     struct gx_line_params_s *line_params;
  81.  
  82.         /* Halftone screen: */
  83.  
  84.     gs_halftone *halftone;
  85.     gx_device_halftone *dev_ht;
  86.     gs_int_point ht_phase;
  87.     struct gx_ht_cache_s *ht_cache;    /* shared by all GCs */
  88.  
  89.         /* Color (device-independent): */
  90.  
  91.     struct gs_color_space_s *color_space;
  92.     struct gs_client_color_s *ccolor;
  93.     gx_color_value alpha;
  94.  
  95.         /* Color (device-dependent): */
  96.  
  97.     struct gs_cie_render_s *cie_render;
  98.     int overprint;
  99.     gx_transfer_map *black_generation;    /* may be 0 */
  100.     gx_transfer_map *undercolor_removal;    /* may be 0 */
  101.     gx_transfer transfer;
  102.  
  103.         /* Color caches: */
  104.  
  105.     gx_device_color *dev_color;
  106.     struct gx_cie_joint_caches_s *cie_joint_caches;
  107.     const struct gx_color_map_procs_s *cmap_procs;
  108.     struct gx_pattern_cache_s *pattern_cache; /* shared by all GCs */
  109.  
  110.         /* Font: */
  111.  
  112.     gs_font *font;
  113.     gs_font *root_font;
  114.     gs_matrix_fixed char_tm;    /* font matrix * ctm */
  115. #define char_tm_only(pgs) *(gs_matrix *)&(pgs)->char_tm
  116.     int char_tm_valid;        /* true if char_tm is valid */
  117.     byte in_cachedevice;        /* true after a setcachedevice */
  118.     byte in_charpath;        /* 0 if not in charpath, */
  119.                     /* 1 if false charpath, */
  120.                     /* 2 if true charpath */
  121.                     /* (see charpath_flag in */
  122.                     /* gs_show_enum_s) */
  123.     gs_state *show_gstate;        /* gstate when show was invoked */
  124.                     /* (so charpath can append to path) */
  125.  
  126.         /* Other stuff: */
  127.  
  128.     int level;            /* incremented by 1 per gsave */
  129.     float flatness;
  130.     fixed fill_adjust;        /* fattening for fill */
  131.     int stroke_adjust;
  132.     gx_device *device;
  133. #undef gs_currentdevice_inline
  134. #define gs_currentdevice_inline(pgs) ((pgs)->device)
  135.  
  136.         /* Client data: */
  137.  
  138.     void *client_data;
  139. #undef gs_state_client_data_inline
  140. #define gs_state_client_data_inline(pgs) ((pgs)->client_data)
  141.     gs_state_client_procs client_procs;
  142. };
  143. /* The structure type is only public for testing. */
  144. extern_st(st_gstate);
  145. #define public_st_gstate()    /* in gsstate.c */\
  146.   gs_public_st_composite(st_gstate, gs_state, "gstatetype",\
  147.     gs_state_enum_ptrs, gs_state_reloc_ptrs)
  148.