summaryrefslogtreecommitdiff
path: root/base/spwgx.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-12-11 19:52:43 +0000
committerRobin Watts <robin.watts@artifex.com>2017-12-13 11:23:08 +0000
commitb5189a84ddf0ca1454b10bb4a9926cd4f8c4f0eb (patch)
treefc2fb9066a50ac40a3041cf8f100b62090c4aed9 /base/spwgx.h
parent0bdb35346b5a9636bc6c1ca629401ba21232d9bb (diff)
downloadghostpdl-b5189a84ddf0ca1454b10bb4a9926cd4f8c4f0eb.tar.gz
Add PWGDecode filter.
And lib/viewpwg.ps to use it.
Diffstat (limited to 'base/spwgx.h')
-rw-r--r--base/spwgx.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/base/spwgx.h b/base/spwgx.h
new file mode 100644
index 000000000..8b3d71086
--- /dev/null
+++ b/base/spwgx.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2017 Artifex Software, Inc.
+ All Rights Reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+ implied.
+
+ This software is distributed under license and may not be copied,
+ modified or distributed except as expressly authorized under the terms
+ of the license contained in the file LICENSE in this distribution.
+
+ Refer to licensing information at http://www.artifex.com or contact
+ Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
+ CA 94903, U.S.A., +1(415)492-9861, for further information.
+*/
+
+
+/* Definitions for PWG compatible RunLength filters */
+/* Requires scommon.h; strimpl.h if any templates are referenced */
+
+#ifndef spwgx_INCLUDED
+# define spwgx_INCLUDED
+
+/* Common state */
+#define stream_PWG_state_common\
+ stream_state_common;\
+ int width;\
+ int bpp
+
+/* No encode for now */
+
+/* PWG RunLengthDecode */
+typedef struct stream_PWGD_state_s {
+ stream_PWG_state_common;
+ int line_pos; /* Byte Position on the current line (0 to bpp*width-1) */
+ int line_rep; /* Number of times this line should be repeated */
+ byte *line_buffer; /* Pointer to line buffer */
+ int state; /* 0 = Waiting for line_rep byte, 1 = Waiting for repeat, > 1 => copy n-1 bytes literally into linebuffer, < 0 => -n bytes of repeats */
+} stream_PWGD_state;
+
+/* Needed a default width. Stole it from fax. */
+#define PWG_default_width (1728)
+#define PWG_default_bpp (8)
+
+#define private_st_PWGD_state() /* in spwgd.c */\
+ gs_private_st_simple(st_PWGD_state, stream_PWGD_state, "PWGDecode state")
+extern const stream_template s_PWGD_template;
+
+#endif /* spwgx_INCLUDED */