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

  1. /* Copyright (C) 1993, 1994 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. /* scfx.h */
  20. /* Ghostscript CCITTFax filter state definition */
  21. /* Requires strimpl.h */
  22. #include "shc.h"
  23.  
  24. /* Common state */
  25. #define stream_CF_state_common\
  26.     stream_hc_state_common;\
  27.         /* The client sets the following before initialization. */\
  28.     bool Uncompressed;\
  29.     int K;\
  30.     bool EndOfLine;\
  31.     bool EncodedByteAlign;\
  32.     int Columns;\
  33.     int Rows;\
  34.     bool EndOfBlock;\
  35.     bool BlackIs1;\
  36.     int DamagedRowsBeforeError;\
  37.     /*bool FirstBitLowOrder;*/    /* in stream_hc_state_common */\
  38.         /* The init procedure sets the following. */\
  39.     uint raster;\
  40.     byte *lbuf;        /* current scan line buffer */\
  41.                 /* (only if decoding or 2-D encoding) */\
  42.     byte *lprev;        /* previous scan line buffer (only if 2-D) */\
  43.         /* The following are updated dynamically. */\
  44.     int k_left;        /* number of next rows to encode in 2-D */\
  45.                 /* (only if K > 0) */\
  46.     int run_color        /* 0 if processing white run, 1 if black */
  47. typedef struct stream_CF_state_s {
  48.     stream_CF_state_common;
  49. } stream_CF_state;
  50.  
  51. /* CCITTFaxEncode */
  52. typedef struct stream_CFE_state_s {
  53.     stream_CF_state_common;
  54.     int count;        /* # of source bits left to scan, */
  55.                 /* padded to a byte boundary */
  56.     int run_count;        /* count at start of run begin scanned */
  57.     int copy_count;        /* # of bytes to copy into lbuf */
  58. } stream_CFE_state;
  59. #define private_st_CFE_state()    /* in scfe.c */\
  60.   gs_private_st_ptrs2(st_CFE_state, stream_CFE_state, "CCITTFaxEncode state",\
  61.     cfe_enum_ptrs, cfe_reloc_ptrs, lbuf, lprev)
  62. extern const stream_template s_CFE_template;
  63.  
  64. /* CCITTFaxDecode */
  65. typedef struct stream_CFD_state_s {
  66.     stream_CF_state_common;
  67.     int cbit;        /* bits left to fill in current decoded */
  68.                 /* byte at lbuf[wpos] (0..7) */
  69.     int rows_left;        /* number of rows left */
  70.     int rpos;        /* rptr for copying lbuf to client */
  71.     int wpos;        /* rlimit/wptr for filling lbuf or */
  72.                 /* copying to client */
  73.     int eol_count;        /* number of EOLs seen so far */
  74.     byte invert;        /* current value of 'white' */
  75.                 /* for 2-D decoding */
  76.     /* The following are not used yet. */
  77.     int uncomp_run;        /* non-0 iff we are in an uncompressed */
  78.                 /* run straddling a scan line (-1 if white, */
  79.                 /* 1 if black) */
  80.     int uncomp_left;    /* # of bits left in the run */
  81.     int uncomp_exit;    /* non-0 iff this is an exit run */
  82.                 /* (-1 if next run white, 1 if black) */
  83. } stream_CFD_state;
  84. #define private_st_CFD_state()    /* in scfd.c */\
  85.   gs_private_st_ptrs2(st_CFD_state, stream_CFD_state, "CCITTFaxDecode state",\
  86.     cfd_enum_ptrs, cfd_reloc_ptrs, lbuf, lprev)
  87. extern const stream_template s_CFD_template;
  88.