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

  1. /* Copyright (C) 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. /* gxht.h */
  20. /* Rest of (client) halftone definitions */
  21.  
  22. #ifndef gxht_INCLUDED
  23. #  define gxht_INCLUDED
  24.  
  25. #include "gsht.h"
  26.  
  27. /* Halftone types */
  28. typedef enum {
  29.     ht_type_none,            /* is this needed? */
  30.     ht_type_screen,            /* set by setscreen */
  31.     ht_type_colorscreen,        /* set by setcolorscreen */
  32.     ht_type_spot,            /* Type 1 halftone dictionary */
  33.     ht_type_threshold,        /* Type 3 halftone dictionary */
  34.     ht_type_multiple        /* Type 5 halftone dictionary */
  35. } gs_halftone_type;
  36.  
  37. /* Type 1 halftone.  This is just a Level 1 halftone with */
  38. /* a few extra members. */
  39. typedef struct gs_spot_halftone_s {
  40.     gs_screen_halftone screen;
  41.     bool accurate_screens;            /* Level 2 */
  42.     float (*transfer)(P2(const gs_state *, floatp));
  43. } gs_spot_halftone;
  44. #define st_spot_halftone_max_ptrs st_screen_halftone_max_ptrs
  45.  
  46. /* Type 3 halftone. */
  47. typedef struct gs_threshold_halftone_s {
  48.     int width;
  49.     int height;
  50.     const byte *thresholds;
  51.     float (*transfer)(P2(const gs_state *, floatp));
  52. } gs_threshold_halftone;
  53. #define st_threshold_halftone_max_ptrs 1
  54.  
  55. /* Define the separation "names" for a Type 5 halftone. */
  56. typedef enum {
  57.     gs_ht_separation_Default,    /* must be first */
  58.     gs_ht_separation_Gray,
  59.     gs_ht_separation_Red,
  60.     gs_ht_separation_Green,
  61.     gs_ht_separation_Blue,
  62.     gs_ht_separation_Cyan,
  63.     gs_ht_separation_Magenta,
  64.     gs_ht_separation_Yellow,
  65.     gs_ht_separation_Black
  66. } gs_ht_separation_name;
  67. #define gs_ht_separation_name_strings\
  68.   "Default", "Gray", "Red", "Green", "Blue",\
  69.   "Cyan", "Magenta", "Yellow", "Black"
  70.  
  71. /* Define the elements of a Type 5 halftone. */
  72. typedef struct gs_halftone_component_s {
  73.     gs_ht_separation_name cname;
  74.     gs_halftone_type type;
  75.     union {
  76.         gs_spot_halftone spot;        /* Type 1 */
  77.         gs_threshold_halftone threshold;    /* Type 3 */
  78.     } params;
  79. } gs_halftone_component;
  80. #define private_st_halftone_component()    /* in zht2.c */\
  81.   gs_private_st_composite(st_halftone_component, gs_halftone_component,\
  82.     "gs_halftone_component", halftone_component_enum_ptrs,\
  83.     halftone_component_reloc_ptrs)
  84. #define st_halftone_component_max_ptrs\
  85.   max(st_spot_halftone_max_ptrs, st_threshold_halftone_max_ptrs)
  86.  
  87. /* Define the Type 5 halftone itself. */
  88. typedef struct gs_multiple_halftone_s {
  89.     gs_halftone_component *components;
  90.     uint num_comp;
  91. } gs_multiple_halftone;
  92. #define st_multiple_halftone_max_ptrs 1
  93.  
  94. /* The halftone stored in the graphics state is the union of */
  95. /* setscreen, setcolorscreen, Type 1, Type 3, and Type 5. */
  96. struct gs_halftone_s {
  97.     gs_halftone_type type;
  98.     union {
  99.         gs_screen_halftone screen;        /* setscreen */
  100.         gs_colorscreen_halftone colorscreen;    /* setcolorscreen */
  101.         gs_spot_halftone spot;            /* Type 1 */
  102.         gs_threshold_halftone threshold;    /* Type 3 */
  103.         gs_multiple_halftone multiple;        /* Type 5 */
  104.     } params;
  105. };
  106. extern_st(st_halftone);
  107. #define public_st_halftone()    /* in gsht.c */\
  108.   gs_public_st_composite(st_halftone, gs_halftone, "gs_halftone",\
  109.     halftone_enum_ptrs, halftone_reloc_ptrs)
  110. #define st_halftone_max_ptrs\
  111.   max(max(st_screen_halftone_max_ptrs, st_colorscreen_halftone_max_ptrs),\
  112.       max(max(st_spot_halftone_max_ptrs, st_threshold_halftone_max_ptrs),\
  113.       st_multiple_halftone_max_ptrs))
  114.  
  115. #endif                    /* gxht_INCLUDED */
  116.