summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>1999-04-08 06:46:44 +0000
committerHenry Stiles <henry.stiles@artifex.com>1999-04-08 06:46:44 +0000
commitb31ea3c32890ba663f63dc895349a8fc6177f3bd (patch)
treed55b54f2fc3f5b3d850675513d0b7d3d61066019
parentcd33d1d02cb729af7cb63610059c8d2b66fdad3d (diff)
extensive changes to support static removal from the pcl halftone
code. Removes use of extern in prototypes and adds the standard prototype macros for argument templates. Adds support for device resolution patterns. git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@805 06663e23-700e-0410-b217-a244a6096597
-rw-r--r--pcl/pcbiptrn.c33
-rw-r--r--pcl/pcbiptrn.h12
-rw-r--r--pcl/pccid.h3
-rw-r--r--pcl/pccrd.h12
-rw-r--r--pcl/pccsbase.h18
-rw-r--r--pcl/pcdither.h4
-rw-r--r--pcl/pcdraw.h8
-rw-r--r--pcl/pcfont.h10
-rw-r--r--pcl/pcfrgrnd.h2
-rw-r--r--pcl/pcht.c468
-rw-r--r--pcl/pcht.h94
-rw-r--r--pcl/pcident.h4
-rw-r--r--pcl/pcindxed.h50
-rw-r--r--pcl/pcl.mak1
-rw-r--r--pcl/pclookup.h2
-rw-r--r--pcl/pcmtx3.h36
-rw-r--r--pcl/pcpage.h6
-rw-r--r--pcl/pcpalet.c18
-rw-r--r--pcl/pcpalet.h40
-rw-r--r--pcl/pcparam.h8
-rw-r--r--pcl/pcpatrn.c8
-rw-r--r--pcl/pcpatrn.h16
-rw-r--r--pcl/pcpatxfm.h20
-rw-r--r--pcl/pcstate.h47
-rw-r--r--pcl/pcuptrn.h12
-rw-r--r--pcl/pcursor.h16
-rw-r--r--pcl/pcwhtidx.h12
-rw-r--r--pcl/pginit.h6
-rw-r--r--pcl/pgmisc.h6
-rw-r--r--pcl/rtgmode.h6
-rw-r--r--pcl/rtraster.h6
-rw-r--r--pcl/rtrstcmp.h8
32 files changed, 502 insertions, 490 deletions
diff --git a/pcl/pcbiptrn.c b/pcl/pcbiptrn.c
index 0ea6cfc3b..202031956 100644
--- a/pcl/pcbiptrn.c
+++ b/pcl/pcbiptrn.c
@@ -216,32 +216,39 @@ pcl_pattern_clear_bi_patterns(pcl_state_t *pcs)
/*
* pcl patterns are always always 300 dpi but we use the device
* resolution on devices lower than 300 dpi so we can at least see the
- * patterns on screen resolution devices. NB this could probably be
- * done once but it is not very expensive. Currently, we set the
- * resolution each time the pattern is built.
+ * patterns on screen resolution devices. We also provide a #define
+ * here for customers that wish to have better patterns at higher
+ * resolutions.
*/
+/* #define DEVICE_RES_PATTERNS */
+
private int
pcl_get_pattern_resolution(pcl_state_t *pcs, gs_point *pattern_res)
{
- gs_matrix mat;
- gs_point device_res;
/* default is 300 */
pattern_res->x = 300;
pattern_res->y = 300;
- /* get the current resolutions based on the default centipoint
- matrix */
- gs_defaultmatrix(pcs->pgs, &mat);
- /* if both are less than 300 dpi override the 300 dpi default */
- device_res.x = fabs(mat.xx) * 7200;
- device_res.y = fabs(mat.yy) * 7200;
- if ( (device_res.x < 300) && (device_res.y < 300) ) {
+ /* get the current resolutions based on the device. */
+ {
+ gs_point device_res;
+ gx_device *pdev = gs_currentdevice(pcs->pgs);
+ device_res.x = pdev->HWResolution[0];
+ device_res.y = pdev->HWResolution[1];
+#ifdef DEVICE_RES_PATTERNS
pattern_res->x = device_res.x;
pattern_res->y = device_res.y;
+#else
+ /* if both are less than 300 dpi override the 300 dpi default. */
+ if ( (device_res.x < 300) && (device_res.y < 300) ) {
+ pattern_res->x = device_res.x;
+ pattern_res->y = device_res.y;
+ }
+#endif
}
return 0;
}
-
+#undef DEVICE_RES_PATTERNS
/*
* Return the pointer to a built-in pattern, building it if inecessary.
*/
diff --git a/pcl/pcbiptrn.h b/pcl/pcbiptrn.h
index 47d0787ce..1d91b44de 100644
--- a/pcl/pcbiptrn.h
+++ b/pcl/pcbiptrn.h
@@ -14,38 +14,38 @@
* "non-const" structures, to facilitate working with systems that install all
* initialized global data in ROM.
*/
-extern void pcl_pattern_init_bi_patterns( pcl_state_t *pcs );
+void pcl_pattern_init_bi_patterns(P1( pcl_state_t *pcs ));
/*
* Clear the renderings of the built-in patterns. This may be called during
* a reset to conserve memory.
*/
-extern void pcl_pattern_clear_bi_patterns( pcl_state_t *pcs );
+void pcl_pattern_clear_bi_patterns(P1(pcl_state_t *pcs));
/*
* For a given intensity value, return the corresponding shade pattern. A
* null return indicates that a solid pattern should be used - the caller
* must look at the intensity to determine if it is black or white.
*/
-extern pcl_pattern_t * pcl_pattern_get_shade( pcl_state_t *pcs, int inten );
+pcl_pattern_t * pcl_pattern_get_shade(P2( pcl_state_t *pcs, int inten));
/*
* For a given index value, return the corresponding cross-hatch pattern. A
* null return indicates that the pattern is out of range. The caller must
* determine what to do in this case.
*/
-extern pcl_pattern_t * pcl_pattern_get_cross( pcl_state_t *pcs, int indx );
+pcl_pattern_t * pcl_pattern_get_cross(P2(pcl_state_t *pcs, int indx));
/*
* Return a solid, 1 x 1 pattern for use with rasters. See the comments in
* pcbiptrn.c for why this is necessary.
*/
-extern pcl_pattern_t * pcl_pattern_get_solid_pattern( pcl_state_t *pcs );
+pcl_pattern_t * pcl_pattern_get_solid_pattern(P1(pcl_state_t *pcs));
/*
* Return an "unsolid", 1 x 1 pattern for use with GL/2. See the comments in
* pcbiptrn.c for why this is necessary.
*/
-extern pcl_pattern_t * pcl_pattern_get_unsolid_pattern( pcl_state_t *pcs );
+pcl_pattern_t * pcl_pattern_get_unsolid_pattern(P1(pcl_state_t *pcs));
#endif /* pcbiptrn_INCLUDED */
diff --git a/pcl/pccid.h b/pcl/pccid.h
index 961b0cde0..b2a861e1a 100644
--- a/pcl/pccid.h
+++ b/pcl/pccid.h
@@ -7,7 +7,6 @@
#include "gx.h"
#include "gsstruct.h"
-#include "pcstate.h"
#include "pcommand.h"
typedef short int16;
@@ -151,7 +150,7 @@ typedef struct pcl_cid_data_s {
* Implement the GL/2 IN command. This is probably better done via a reset flag,
* but currently there are no reset flags that propagate out of GL/2.
*/
-extern int pcl_cid_IN( pcl_state_t * pcs );
+int pcl_cid_IN(P1(pcl_state_t * pcs));
/*
* Entry point for the configure image data code.
diff --git a/pcl/pccrd.h b/pcl/pccrd.h
index 79a76a3fa..779f3bccc 100644
--- a/pcl/pccrd.h
+++ b/pcl/pccrd.h
@@ -104,7 +104,7 @@ extern pcl_crd_t * pcl_default_crd;
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_crd_build_default_crd( pcl_state_t * pcs );
+int pcl_crd_build_default_crd(P1(pcl_state_t *pcs));
/*
* Build a CRD with device-provided parameters, but with the default PCL
@@ -118,7 +118,7 @@ extern int pcl_crd_build_default_crd( pcl_state_t * pcs );
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_crd_build_dev_crd(
+int pcl_crd_build_dev_crd(P12(
gs_memory_t * pmem,
const gs_vector3 * BlackPoint,
const gs_matrix3 * MatrixPQR,
@@ -131,7 +131,7 @@ extern int pcl_crd_build_dev_crd(
const gs_cie_render_proc3 * EncodeABC,
const gs_range3 * RangeABC,
const gs_cie_render_table_t * RenderTable
-);
+));
/*
* Set the viewing illuminant.
@@ -142,10 +142,10 @@ extern int pcl_crd_build_dev_crd(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_crd_set_view_illuminant(
+int pcl_crd_set_view_illuminant(P2(
pcl_crd_t ** ppcrd,
const gs_vector3 * pwht_pt
-);
+));
/*
* Set a color rendering dictionary into the graphic state. If the rendering
@@ -153,6 +153,6 @@ extern int pcl_crd_set_view_illuminant(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_crd_set_crd( pcl_crd_t ** ppcrd, pcl_state_t * pcs );
+int pcl_crd_set_crd(P2(pcl_crd_t **ppcrd, pcl_state_t *pcs));
#endif /* pccrd_INCLUDED */
diff --git a/pcl/pccsbase.h b/pcl/pccsbase.h
index a938383a4..bf7938a79 100644
--- a/pcl/pccsbase.h
+++ b/pcl/pccsbase.h
@@ -106,11 +106,11 @@ typedef struct pcl_cs_base_s {
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_base_build_cspace(
+int pcl_cs_base_build_cspace(P3(
pcl_cs_base_t ** ppbase,
const pcl_cid_data_t * pcid,
gs_memory_t * pmem
-);
+));
/*
* Build a special base color space, used for setting the color white.
@@ -119,10 +119,10 @@ extern int pcl_cs_base_build_cspace(
*
* This routine is usually called once at initialization.
*/
-extern int pcl_cs_base_build_white_cspace(
+int pcl_cs_base_build_white_cspace(P2(
pcl_cs_base_t ** ppbase,
gs_memory_t * pmem
-);
+));
/*
* Update the lookup table information for a PCL base color space. This is
@@ -137,10 +137,10 @@ extern int pcl_cs_base_build_white_cspace(
* color space, 0 if no modification occurred but there was no error, and < 0
* in the event of an error.
*/
-extern int pcl_cs_base_update_lookup_tbl(
+int pcl_cs_base_update_lookup_tbl(P2(
pcl_cs_base_t ** ppbase,
pcl_lookup_tbl_t * plktbl
-);
+));
/*
* Install a base color space into the graphic state.
@@ -150,15 +150,15 @@ extern int pcl_cs_base_update_lookup_tbl(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_base_install(
+int pcl_cs_base_install(P2(
pcl_cs_base_t ** ppbase,
pcl_state_t * pcs
-);
+));
/*
* One-time initialization routine. This exists only to handle possible non-
* initialization of BSS.
*/
-extern void pcl_cs_base_init( void );
+void pcl_cs_base_init( void );
#endif /* pccsbase_INCLUDED */
diff --git a/pcl/pcdither.h b/pcl/pcdither.h
index 6a0fb4bf5..a3457c6b6 100644
--- a/pcl/pcdither.h
+++ b/pcl/pcdither.h
@@ -85,10 +85,10 @@ typedef struct pcl_udither_s {
* Get a pointer to the appropriate portion of the dither table in a user
* defined dither structure.
*/
-extern const byte * pcl_udither_get_threshold(
+const byte *pcl_udither_get_threshold(P2(
const pcl_udither_t * pdither,
int indx
-);
+));
/*
* External access to the user-defined dither matrix machinery.
diff --git a/pcl/pcdraw.h b/pcl/pcdraw.h
index 0df4d5b3c..59039b4c4 100644
--- a/pcl/pcdraw.h
+++ b/pcl/pcdraw.h
@@ -10,17 +10,17 @@
#include "pcstate.h"
/* compatibility function */
-extern int pcl_set_ctm( pcl_state_t * pcs, bool print_direction );
+int pcl_set_ctm(P2(pcl_state_t * pcs, bool print_direction));
/* set CTM and clip rectangle for drawing PCL object */
-extern int pcl_set_graphics_state( pcl_state_t * pcs );
+int pcl_set_graphics_state(P1(pcl_state_t * pcs));
/* set the current drawing color */
-extern int pcl_set_drawing_color(
+int pcl_set_drawing_color(P4(
pcl_state_t * pcs,
pcl_pattern_source_t type,
int pcl_id,
bool for_image
-);
+));
#endif /* pcdraw_INCLUDED */
diff --git a/pcl/pcfont.h b/pcl/pcfont.h
index b0d5252f8..7ecf9c3f5 100644
--- a/pcl/pcfont.h
+++ b/pcl/pcfont.h
@@ -15,20 +15,20 @@
* downloaded symbol set, or changing orientations--can cause this.
* set == -1 means all.
*/
-extern void pcl_decache_font( pcl_state_t * pcs, int set );
+void pcl_decache_font(P2(pcl_state_t * pcs, int set));
/*
* Recompute the font if necessary. This is exported for resetting HMI.
*/
-extern int pcl_recompute_font( pcl_state_t * pcs );
+int pcl_recompute_font(P1(pcl_state_t * pcs));
/*
* Recompute the font if the glyph is not found at the time of rendering
*/
-extern int pcl_recompute_substitute_font(
+int pcl_recompute_substitute_font(P2(
pcl_state_t * pcs,
const uint chr
-);
+));
/*
* Do any underlining just before a break in motion (vertical motion or
@@ -47,7 +47,7 @@ extern int pcl_recompute_substitute_font(
pcs->underline_start = pcs->cap; \
END
-extern void pcl_do_underline(P1(pcl_state_t *pcs));
+void pcl_do_underline(P1(pcl_state_t *pcs));
/* Define the common structure of downloaded font headers. */
typedef struct pcl_font_header_s {
diff --git a/pcl/pcfrgrnd.h b/pcl/pcfrgrnd.h
index cf442279a..d682584f5 100644
--- a/pcl/pcfrgrnd.h
+++ b/pcl/pcfrgrnd.h
@@ -107,7 +107,7 @@ typedef struct pcl_frgrnd_s pcl_frgrnd_t;
* for palettes, and should only be called when the current palette is the
* default 2-entry palette.
*/
-extern int pcl_frgrnd_set_default_foreground( pcl_state_t * pcs );
+int pcl_frgrnd_set_default_foreground(P1(pcl_state_t * pcs));
/*
* Entry point for the set-foreground related routines
diff --git a/pcl/pcht.c b/pcl/pcht.c
index dcb63c9f6..c0ad58c2a 100644
--- a/pcl/pcht.c
+++ b/pcl/pcht.c
@@ -1168,158 +1168,6 @@ private const pcl_ht_builtin_threshold_t noise_dither_thresh = {
noise_dither_data
};
-private pcl_ht_builtin_dither_t ordered_dither;
-private pcl_ht_builtin_dither_t clustered_dither;
-private pcl_ht_builtin_dither_t noise_dither;
-
-
-/*
- * The forwarding devices to preform any necessary color mapping. There are
- * four of these: identity mapping, snap to primaries, map black to white and
- * all other colors to black, and monochrome mapping. The devices are all
- * identical except for the mapping method used.
- *
- * Several devices are required because the rendering method used by the
- * foreground may not be the same as that used by the current palette.
- */
-private gx_device_cmap cmap_device_identity;
-private gx_device_cmap cmap_device_snap_to_primaries;
-private gx_device_cmap cmap_device_color_to_black_over_white;
-private gx_device_cmap cmap_device_monochrome;
-
-/*
- * Array of dithers and devices to be used for different rendering methods.
- *
- * The HT_FIXED flag indicates which methods may not be changed by the output
- * device. The ordered, clustered ordered, and user-defined dithers (both
- * color and monochrome versions) are in this category, because they must
- * have predictable matrices for the logical operations to produce predictable
- * results.
- *
- * The HT_USERDEF flag indicates which methods make use of the user-defined
- * dither matrix.
- *
- * The HT_DECSPACE flag indicates which methods may be used with device
- * independent color spaces. If one of these methods is selected and a device
- * independent color space is set, the default rendering method is used
- * instead.
- *
- * The HT_IMONLY flag indicates that a rendering method applies only to
- * images. ***This feature is currently not supported***
- *
- * For each rendering method there is an associated color mapping method, to
- * be used with the devcmap color mapping device. A single device is used
- * rather than one device for each different mapping, as the the graphic
- * library provides no good technique for removing a device from a graphic
- * state (this is typically done by grestore, as is the case for PostScript).
- *
- * To support environments in which all initialized globals are placed in ROM,
- * this code maitains two copies of the rendering_info array: a prototype
- * (which is qualified by const), and the actual array. The former is copied
- * to the latter in init_render_methods.
- */
-#define HT_NONE 0x0
-#define HT_FIXED 0x1
-#define HT_USERDEF 0x2
-#define HT_DEVCSPACE 0x4
-#define HT_IMONLY 0x8
-
-typedef struct rend_info_s {
- uint flags;
- gx_device_cmap * pdev;
- const pcl_ht_builtin_dither_t * pbidither;
-} rend_info_t;
-
-private const rend_info_t rendering_info_proto[20] = {
-
- /* 0 */
- { HT_NONE, &cmap_device_identity, &ordered_dither },
-
- /* 1 - dither doesn't matter */
- {
- HT_FIXED | HT_DEVCSPACE,
- &cmap_device_snap_to_primaries,
- &ordered_dither
- },
-
- /* 2 - dither doesn't matter */
- {
- HT_FIXED | HT_DEVCSPACE,
- &cmap_device_color_to_black_over_white,
- &ordered_dither
- },
-
- /* 3 - the default */
- { HT_NONE, &cmap_device_identity, &ordered_dither },
-
- /* 4 - currently not supported */
- { HT_FIXED | HT_IMONLY, &cmap_device_identity, 0 },
-
- /* 5 - monochrome version of 3 */
- { HT_NONE, &cmap_device_monochrome, &ordered_dither },
-
- /* 6 - currently not supported */
- { HT_FIXED | HT_IMONLY, &cmap_device_monochrome, 0 },
-
- /* 7 */
- { HT_FIXED, &cmap_device_identity, &clustered_dither },
-
- /* 8 */
- { HT_FIXED, &cmap_device_monochrome, &clustered_dither },
-
- /* 9 - dither comes from user */
- {
- HT_FIXED | HT_USERDEF | HT_DEVCSPACE,
- &cmap_device_identity,
- 0
- },
-
- /* 10 - dither comes from user */
- {
- HT_FIXED | HT_USERDEF | HT_DEVCSPACE,
- &cmap_device_monochrome,
- 0
- },
-
- /* 11 */
- { HT_FIXED, &cmap_device_identity, &ordered_dither },
-
- /* 12 */
- { HT_FIXED, &cmap_device_monochrome, &ordered_dither },
-
- /* 13 - device should override */
- { HT_NONE, &cmap_device_identity, &noise_dither },
-
- /* 14 - device should override */
- { HT_NONE, &cmap_device_monochrome, &noise_dither },
-
- /* 15 - device should override */
- { HT_NONE, &cmap_device_identity, &ordered_dither },
-
- /* 16 - device should override */
- { HT_NONE, &cmap_device_monochrome, &ordered_dither },
-
- /* 17 - device should override */
- { HT_NONE, &cmap_device_monochrome, &ordered_dither },
-
- /* 18 - device should override */
- { HT_NONE, &cmap_device_identity, &ordered_dither },
-
- /* 19 - device should override */
- { HT_NONE, &cmap_device_monochrome, &ordered_dither },
-};
-
-private rend_info_t rendering_info[20];
-
-/*
- * Remap the the rendering methods. This will generally be selected from the
- * device; the default value provided below maps all methods to ones that are
- * supported in the default system.
- *
- * Inorder to support systems which place all initialized globals in ROM, there
- * is both a prototype for this array (qualified as const) and the actual array.
- * The former is copied to the latter in pcl_ht_init_render_methods.
- */
private const byte rendering_remap_proto[20] = {
0, 1, 2, 3, /* 0 - 3 */
3, 5, 5, 7, /* 4 - 7 */
@@ -1328,19 +1176,31 @@ private const byte rendering_remap_proto[20] = {
5, 5, 3, 5 /* 16 - 19 */
};
-private byte dflt_rendering_remap[20];
-private byte rendering_remap[20];
-
-/* pointer to the default halftone */
-private pcl_ht_t * pdflt_ht;
-
-
+/*
+ * Update built-in rendering information. Attempts to changed fixed rendering
+ * infomration are ignored.
+ */
+ private void
+pcl_ht_update_rendering_info(
+ pcl_state_t * pcs,
+ int method,
+ const pcl_ht_builtin_dither_t * pbidither
+)
+{
+ if ( (method > 0) &&
+ (method < countof(pcs->rendering_info)) &&
+ ((pcs->rendering_info[method].flags & HT_FIXED) == 0) &&
+ (pbidither->type >= pcl_halftone_Threshold) &&
+ (pbidither->type < pcl_halftone_num) )
+ pcs->rendering_info[method].pbidither = pbidither;
+}
/*
* Read dither information from a parameter dictionary held by the device.
*/
private void
read_dither(
+ pcl_state_t * pcs,
int method,
gs_param_list * plist,
gs_memory_t * pmem
@@ -1409,15 +1269,28 @@ read_dither(
pdt->u.tdither.nlevels = nlevels;
pdt->u.tdither.pdata = dstring.data;
}
+ pcl_ht_update_rendering_info(pcs, method, pdt);
+}
- pcl_ht_update_rendering_info(method, pdt);
+/*
+ * Modify the rendering remap table. Note that the change will not take
+ * effect until the next time the print mode is reset.
+ */
+ private void
+pcl_ht_update_rendering_remap(
+ pcl_state_t * pcs,
+ const byte * map
+)
+{
+ memcpy(pcs->dflt_rendering_remap, map, sizeof(pcs->dflt_rendering_remap));
}
/*
* Read a re-mapping array for rendering methods.
*/
- void
+ private void
read_remap_array(
+ pcl_state_t *pcs,
gs_param_list * plist,
gs_memory_t * pmem
)
@@ -1426,13 +1299,13 @@ read_remap_array(
int i;
if ( (param_read_string(plist, "RenderRemap", &dstring) != 0) ||
- (dstring.size < countof(dflt_rendering_remap)) )
+ (dstring.size < countof(pcs->dflt_rendering_remap)) )
return;
- for (i = 0; i < countof(dflt_rendering_remap); i++) {
- if (dstring.data[i] >= countof(dflt_rendering_remap))
+ for (i = 0; i < countof(pcs->dflt_rendering_remap); i++) {
+ if (dstring.data[i] >= countof(pcs->dflt_rendering_remap))
return;
}
- pcl_ht_update_rendering_remap(dstring.data);
+ pcl_ht_update_rendering_remap(pcs, dstring.data);
}
/*
@@ -1448,31 +1321,136 @@ pcl_ht_init_render_methods(
gx_device * pcur_dev = gs_currentdevice(pcs->pgs);
gs_c_param_list list;
- ordered_dither.type = pcl_halftone_Threshold;
- ordered_dither.u.thresh = ordered_dither_thresh;
- clustered_dither.type = pcl_halftone_Threshold;
- clustered_dither.u.thresh = clustered_dither_thresh;
- noise_dither.type = pcl_halftone_Threshold;
- noise_dither.u.thresh = noise_dither_thresh;
-
- memcpy( rendering_info,
- rendering_info_proto,
- sizeof(rendering_info_proto)
- );
- memcpy( dflt_rendering_remap,
- rendering_remap_proto,
- sizeof(rendering_remap_proto)
- );
- memcpy( rendering_remap,
- rendering_remap_proto,
- sizeof(rendering_remap_proto)
- );
+ pcs->ordered_dither.type = pcl_halftone_Threshold;
+ pcs->ordered_dither.u.thresh = ordered_dither_thresh;
+ pcs->clustered_dither.type = pcl_halftone_Threshold;
+ pcs->clustered_dither.u.thresh = clustered_dither_thresh;
+ pcs->noise_dither.type = pcl_halftone_Threshold;
+ pcs->noise_dither.u.thresh = noise_dither_thresh;
+
+ /* 0 */
+ pcs->rendering_info[0].flags = HT_NONE;
+ pcs->rendering_info[0].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[0].pbidither = &pcs->ordered_dither;
+
+ /* 1 - dither doesn't matter */
+ pcs->rendering_info[1].flags = HT_FIXED | HT_DEVCSPACE;
+ pcs->rendering_info[1].pdev = &pcs->cmap_device_snap_to_primaries;
+ pcs->rendering_info[1].pbidither = &pcs->ordered_dither;
+
+ /* 2 - dither doesn't matter */
+ pcs->rendering_info[2].flags = HT_FIXED | HT_DEVCSPACE;
+ pcs->rendering_info[2].pdev = &pcs->cmap_device_color_to_black_over_white;
+ pcs->rendering_info[2].pbidither = &pcs->ordered_dither;
+
+ /* 3 - the default */
+ pcs->rendering_info[3].flags = HT_NONE;
+ pcs->rendering_info[3].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[3].pbidither = &pcs->ordered_dither;
+
+ /* 4 - currently not supported */
+ pcs->rendering_info[4].flags = HT_FIXED | HT_IMONLY;
+ pcs->rendering_info[4].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[4].pbidither = 0;
+
+ /* 5 - monochrome version of 3 */
+ pcs->rendering_info[5].flags = HT_NONE;
+ pcs->rendering_info[5].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[5].pbidither = &pcs->ordered_dither;
+
+ /* 6 - currently not supported */
+ pcs->rendering_info[6].flags = HT_FIXED | HT_IMONLY;
+ pcs->rendering_info[6].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[6].pbidither = 0;
+
+ /* 7 */
+ pcs->rendering_info[7].flags = HT_FIXED;
+ pcs->rendering_info[7].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[7].pbidither = &pcs->clustered_dither;
+
+ /* 8 */
+ pcs->rendering_info[8].flags = HT_FIXED;
+ pcs->rendering_info[8].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[8].pbidither = &pcs->clustered_dither;
+
+ /* 9 - dither comes from user */
+ pcs->rendering_info[9].flags = HT_FIXED | HT_USERDEF | HT_DEVCSPACE;
+ pcs->rendering_info[9].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[9].pbidither = 0;
+
+ pcs->rendering_info[10].flags = HT_FIXED | HT_USERDEF | HT_DEVCSPACE;
+ pcs->rendering_info[10].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[10].pbidither = 0;
+
+ /* 11 */
+ pcs->rendering_info[11].flags = HT_FIXED | HT_USERDEF | HT_DEVCSPACE;
+ pcs->rendering_info[11].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[11].pbidither = &pcs->ordered_dither;
+
+ /* 12 */
+ pcs->rendering_info[12].flags = HT_FIXED;
+ pcs->rendering_info[12].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[12].pbidither = &pcs->ordered_dither;
+
+ /* 13 - device should override */
+ pcs->rendering_info[13].flags = HT_NONE;
+ pcs->rendering_info[13].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[13].pbidither = &pcs->noise_dither;
+
+ /* 14 - device should override */
+ pcs->rendering_info[14].flags = HT_NONE;
+ pcs->rendering_info[14].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[14].pbidither = &pcs->noise_dither;
+
+ /* 15 - device should override */
+ pcs->rendering_info[15].flags = HT_NONE;
+ pcs->rendering_info[15].pdev = &pcs->cmap_device_identity;
+ pcs->rendering_info[15].pbidither = &pcs->ordered_dither;
+
+ /* 16 - device should override */
+ pcs->rendering_info[16].flags = HT_NONE;
+ pcs->rendering_info[16].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[16].pbidither = &pcs->ordered_dither;
+
+ /* 17 - device should override */
+ pcs->rendering_info[17].flags = HT_NONE;
+ pcs->rendering_info[17].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[17].pbidither = &pcs->ordered_dither;
+
+ /* 18 - device should override */
+ pcs->rendering_info[18].flags = HT_NONE;
+ pcs->rendering_info[18].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[18].pbidither = &pcs->ordered_dither;
+
+ /* 19 - device should override */
+ pcs->rendering_info[19].flags = HT_NONE;
+ pcs->rendering_info[19].pdev = &pcs->cmap_device_monochrome;
+ pcs->rendering_info[19].pbidither = &pcs->ordered_dither;
+
+ {
+ /*
+ * Remap the the rendering methods. This will generally be
+ * selected from the device; the default value provided below
+ * maps all methods to ones that are supported in the default
+ * system.
+ */
+ private const byte rendering_remap[20] = {
+ 0, 1, 2, 3, /* 0 - 3 */
+ 3, 5, 5, 7, /* 4 - 7 */
+ 8, 9, 10, 11, /* 8 - 11 */
+ 12, 13, 14, 3, /* 12 - 15 */
+ 5, 5, 3, 5 /* 16 - 19 */
+ };
+ for ( i = 0; i < countof(rendering_remap); i++ )
+ pcs->dflt_rendering_remap[i] =
+ pcs->rendering_remap[i] = rendering_remap[i];
+ }
/* get any dither information from the current device */
- for (i = 0; i < countof(rendering_info); i++) {
+ for (i = 0; i < countof(pcs->rendering_info); i++) {
char nbuff[12];
- if ((rendering_info[i].flags & HT_FIXED) != 0)
+ if ((pcs->rendering_info[i].flags & HT_FIXED) != 0)
continue;
gs_c_param_list_write(&list, pmem);
sprintf(nbuff, "Dither_%d", i);
@@ -1486,7 +1464,7 @@ pcl_ht_init_render_methods(
&dict,
false
) == 0 )
- read_dither(i, dict.list, pmem);
+ read_dither(pcs, i, dict.list, pmem);
param_end_read_dict((gs_param_list *)&list, nbuff, &dict);
}
@@ -1499,57 +1477,27 @@ pcl_ht_init_render_methods(
if ( (param_request((gs_param_list *)&list, "RenderRemap") >= 0) &&
(gs_getdeviceparams(pcur_dev, (gs_param_list *)&list) >= 0) ) {
gs_c_param_list_read(&list);
- read_remap_array((gs_param_list *)&list, pmem);
+ read_remap_array(pcs, (gs_param_list *)&list, pmem);
}
gs_c_param_list_release(&list);
-
/* initialize the color mapping mapping devices; install the default */
- gdev_cmap_init(&cmap_device_identity, pcur_dev, device_cmap_identity);
- gdev_cmap_init( &cmap_device_snap_to_primaries,
+ gdev_cmap_init(&pcs->cmap_device_identity, pcur_dev, device_cmap_identity);
+ gdev_cmap_init( &pcs->cmap_device_snap_to_primaries,
pcur_dev,
device_cmap_snap_to_primaries
);
- gdev_cmap_init( &cmap_device_color_to_black_over_white,
+ gdev_cmap_init( &pcs->cmap_device_color_to_black_over_white,
pcur_dev,
device_cmap_color_to_black_over_white
);
- gdev_cmap_init(&cmap_device_monochrome, pcur_dev, device_cmap_monochrome);
- gs_setdevice_no_init(pcs->pgs, (gx_device *)&cmap_device_identity);
+ gdev_cmap_init(&pcs->cmap_device_monochrome, pcur_dev, device_cmap_monochrome);
+ gs_setdevice_no_init(pcs->pgs, (gx_device *)&pcs->cmap_device_identity);
- /* handle possible non-initialization of BSS */
- pdflt_ht = 0;
+ /* initialize default halftone */
+ pcs->pdflt_ht = 0;
}
-/*
- * Update built-in rendering information. Attempts to changed fixed rendering
- * infomration are ignored.
- */
- void
-pcl_ht_update_rendering_info(
- int method,
- const pcl_ht_builtin_dither_t * pbidither
-)
-{
- if ( (method > 0) &&
- (method < countof(rendering_info)) &&
- ((rendering_info[method].flags & HT_FIXED) == 0) &&
- (pbidither->type >= pcl_halftone_Threshold) &&
- (pbidither->type < pcl_halftone_num) )
- rendering_info[method].pbidither = pbidither;
-}
-
-/*
- * Modify the rendering remap table. Note that the change will not take
- * effect until the next time the print mode is reset.
- */
- void
-pcl_ht_update_rendering_remap(
- const byte * map
-)
-{
- memcpy(dflt_rendering_remap, map, sizeof(rendering_remap));
-}
/*
* Set up normal or monochrome print mode. The latter is accomplished by
@@ -1563,6 +1511,7 @@ pcl_ht_update_rendering_remap(
*/
void
pcl_ht_set_print_mode(
+ pcl_state_t * pcs,
bool monochrome
)
{
@@ -1572,12 +1521,11 @@ pcl_ht_set_print_mode(
12, 14, 14, 17,
16, 17, 19, 19 };
- memcpy(rendering_remap, dflt_rendering_remap, sizeof(rendering_remap));
+ memcpy(pcs->rendering_remap, pcs->dflt_rendering_remap, sizeof(pcs->rendering_remap));
if (monochrome) {
int i;
-
- for (i = 0; i < countof(rendering_remap); i++)
- rendering_remap[i] = monochrome_remap[rendering_remap[i]];
+ for (i = 0; i < countof(pcs->rendering_remap); i++)
+ pcs->rendering_remap[i] = monochrome_remap[pcs->rendering_remap[i]];
}
}
@@ -1588,12 +1536,13 @@ pcl_ht_set_print_mode(
*/
private bool
is_monochrome(
+ pcl_state_t * pcs,
int method
)
{
- rend_info_t * pinfo = &(rendering_info[method]);
+ pcl_rend_info_t * pinfo = &pcs->rendering_info[method];
- return pinfo->pdev == &cmap_device_monochrome;
+ return pinfo->pdev == &pcs->cmap_device_monochrome;
}
@@ -1768,16 +1717,17 @@ unshare_pcl_ht(
*/
int
pcl_ht_set_render_method(
- pcl_ht_t ** ppht,
- uint render_method
+ pcl_state_t * pcs,
+ pcl_ht_t ** ppht,
+ uint render_method
)
{
int code = 0;
- if (render_method >= countof(rendering_info))
+ if (render_method >= countof(pcs->rendering_info))
return 0;
- render_method = rendering_remap[render_method];
+ render_method = pcs->rendering_remap[render_method];
if (render_method == (*ppht)->render_method)
return 0;
if ((code = unshare_pcl_ht(ppht)) < 0)
@@ -1893,6 +1843,7 @@ pcl_ht_set_udither(
*/
int
pcl_ht_update_cspace(
+ pcl_state_t * pcs,
pcl_ht_t ** ppht,
pcl_cspace_type_t cstype_old,
pcl_cspace_type_t cstype_new
@@ -1900,7 +1851,7 @@ pcl_ht_update_cspace(
{
pcl_ht_t * pht = *ppht;
uint i = pht->render_method;
- uint flags = rendering_info[i].flags;
+ uint flags = pcs->rendering_info[i].flags;
if ( ((pht->pfg_ht == 0) && (pht->pim_ht == 0)) ||
((flags & HT_DEVCSPACE) == 0) ||
@@ -1919,15 +1870,16 @@ pcl_ht_update_cspace(
*/
int
pcl_ht_build_default_ht(
+ pcl_state_t * pcs,
pcl_ht_t ** ppht,
gs_memory_t * pmem
)
{
int code = 0;
- if ((pdflt_ht == 0) && ((code = alloc_pcl_ht(&pdflt_ht, pmem)) < 0))
+ if ((pcs->pdflt_ht == 0) && ((code = alloc_pcl_ht(&pcs->pdflt_ht, pmem)) < 0))
return code;
- pcl_ht_copy_from(*ppht, pdflt_ht);
+ pcl_ht_copy_from(*ppht, pcs->pdflt_ht);
return 0;
}
@@ -1974,20 +1926,21 @@ dflt_transfer_proc(
* not be used with device-independent color spaces. Also considers whether
* or not the rendering is processing PCL rasters (the for_image operand).
*/
- private const rend_info_t *
+ private const pcl_rend_info_t *
get_rendering_info(
+ pcl_state_t * pcs,
uint sel_method,
pcl_cspace_type_t cstype,
bool for_image
)
{
- rend_info_t * pinfo = &(rendering_info[sel_method]);
+ pcl_rend_info_t * pinfo = &(pcs->rendering_info[sel_method]);
uint flags = pinfo->flags;
/* check for methods that require device-dependent color spaces */
if ( (((flags & HT_DEVCSPACE) != 0) && (cstype > pcl_cspace_CMY)) ||
(((flags & HT_IMONLY) != 0) && !for_image) )
- pinfo = &rendering_info[3];
+ pinfo = &pcs->rendering_info[3];
return pinfo;
}
@@ -2016,9 +1969,10 @@ get_rendering_info(
*/
private int
set_threshold_ht(
+ pcl_state_t * pcs,
pcl_ht_t * pht,
gs_ht * pgsht,
- const rend_info_t * pinfo,
+ const pcl_rend_info_t * pinfo,
int comp,
const gs_ht_separation_name sepname
)
@@ -2031,7 +1985,7 @@ set_threshold_ht(
) = transfer_proc;
/* if not in monochrome print mode, make sure K has default transfer */
- if ((comp == 3) && !is_monochrome(pht->render_method))
+ if ((comp == 3) && !is_monochrome(pcs, pht->render_method))
proc = dflt_transfer_proc;
/* set the array threshold pointers */
@@ -2043,7 +1997,7 @@ set_threshold_ht(
dt.u.thresh.height = pcl_udither_get_height(pht->pdither);
dt.u.thresh.pdata = pcl_udither_get_threshold(pht->pdither, 0);
} else
- dt = ordered_dither;
+ dt = pcs->ordered_dither;
} else if (pinfo->pbidither != 0)
dt = *(pinfo->pbidither);
else
@@ -2137,13 +2091,14 @@ private const gs_ht_separation_name sepnames_gray[1] = {
*/
private int
create_gs_halftones(
+ pcl_state_t * pcs,
pcl_ht_t * pht,
pcl_cspace_type_t cstype,
int ncomps /* # device components */
)
{
int code = 0;
- const rend_info_t * pinfo = 0;
+ const pcl_rend_info_t * pinfo = 0;
int i;
const gs_ht_separation_name * sepnames = 0;
@@ -2153,7 +2108,7 @@ create_gs_halftones(
free_gs_hts(pht);
/* get the rendering information for geometric objects */
- pinfo = get_rendering_info(pht->render_method, cstype, false);
+ pinfo = get_rendering_info(pcs, pht->render_method, cstype, false);
/* make the typical assumption concerning the color space */
if (ncomps == 4)
@@ -2172,14 +2127,14 @@ create_gs_halftones(
/* create the halftone components (allow for 4-color device) */
for (i = 0; i < ncomps; i++) {
- code = set_threshold_ht(pht, pht->pfg_ht, pinfo, i, sepnames[i]);
+ code = set_threshold_ht(pcs, pht, pht->pfg_ht, pinfo, i, sepnames[i]);
if (code < 0)
break;
}
/* currently the foreground and image halftone objects must be the same */
if (code == 0) {
- if (pinfo != get_rendering_info(pht->render_method, cstype, true))
+ if (pinfo != get_rendering_info(pcs, pht->render_method, cstype, true))
code = e_Unimplemented;
else
gs_ht_init_ptr(pht->pim_ht, pht->pfg_ht);
@@ -2198,10 +2153,10 @@ create_gs_halftones(
*/
int
pcl_ht_set_halftone(
+ pcl_state_t * pcs,
pcl_ht_t ** ppht,
pcl_cspace_type_t cstype,
- bool for_image,
- pcl_state_t * pcs
+ bool for_image
)
{
pcl_ht_t * pht = *ppht;
@@ -2210,11 +2165,11 @@ pcl_ht_set_halftone(
int ncomps = 0;
gs_ht * pgsht = 0;
int code = 0;
- const rend_info_t * pinfo_new = 0;
+ const pcl_rend_info_t *pinfo_new = 0;
/* if no halftone yet, create one */
if (pht == 0) {
- if ((code = pcl_ht_build_default_ht(ppht, pcs->memory)) < 0)
+ if ((code = pcl_ht_build_default_ht(pcs, ppht, pcs->memory)) < 0)
return code;
pht = *ppht;
}
@@ -2230,15 +2185,16 @@ pcl_ht_set_halftone(
* it is 0).
*/
if (pcs->pids->pht != 0) {
- const rend_info_t * pinfo_old;
+ const pcl_rend_info_t * pinfo_old;
- pinfo_old = get_rendering_info( pcs->pids->pht->render_method,
+ pinfo_old = get_rendering_info( pcs,
+ pcs->pids->pht->render_method,
cstype, /* irrelevant */
for_image /* irrelevant */
);
old_pdev = pinfo_old->pdev;
}
- pinfo_new = get_rendering_info(pht->render_method, cstype, for_image);
+ pinfo_new = get_rendering_info(pcs, pht->render_method, cstype, for_image);
if ((pdev = pinfo_new->pdev) != old_pdev) {
long ref_count = pdev->rc.ref_count; /* HACK ALERT */
@@ -2252,7 +2208,7 @@ pcl_ht_set_halftone(
/* see if we need to create a halftone object */
if ( ((pgsht = (for_image ? pht->pim_ht : pht->pfg_ht)) == 0) &&
- ((code = create_gs_halftones(pht, cstype, ncomps)) < 0) )
+ ((code = create_gs_halftones(pcs, pht, cstype, ncomps)) < 0) )
return code;
pgsht = (for_image ? pht->pim_ht : pht->pfg_ht);
diff --git a/pcl/pcht.h b/pcl/pcht.h
index fa481a2ac..d8a60c449 100644
--- a/pcl/pcht.h
+++ b/pcl/pcht.h
@@ -90,6 +90,8 @@ typedef enum {
pcl_halftone_num
} pcl_halftone_type_t;
+#ifndef pcl_ht_builtin_dither_DEFINED
+#define pcl_ht_builtin_dither_DEFINED
typedef struct pcl_ht_builtin_dither_s {
pcl_halftone_type_t type;
union {
@@ -97,6 +99,7 @@ typedef struct pcl_ht_builtin_dither_s {
pcl_ht_builtin_table_dither_t tdither;
} u;
} pcl_ht_builtin_dither_t;
+#endif
#define private_st_ht_builtin_dither_t() \
gs_private_st_composite( st_ht_builtin_dither_t, \
@@ -107,6 +110,45 @@ typedef struct pcl_ht_builtin_dither_s {
)
/*
+ * Array of dithers and devices to be used for different rendering methods.
+ *
+ * The HT_FIXED flag indicates which methods may not be changed by the output
+ * device. The ordered, clustered ordered, and user-defined dithers (both
+ * color and monochrome versions) are in this category, because they must
+ * have predictable matrices for the logical operations to produce predictable
+ * results.
+ *
+ * The HT_USERDEF flag indicates which methods make use of the user-defined
+ * dither matrix.
+ *
+ * The HT_DECSPACE flag indicates which methods may be used with device
+ * independent color spaces. If one of these methods is selected and a device
+ * independent color space is set, the default rendering method is used
+ * instead.
+ *
+ * The HT_IMONLY flag indicates that a rendering method applies only to
+ * images. ***This feature is currently not supported***
+ *
+ * For each rendering method there is an associated color mapping method, to
+ * be used with the devcmap color mapping device. A single device is used
+ * rather than one device for each different mapping, as the the graphic
+ * library provides no good technique for removing a device from a graphic
+ * state (this is typically done by grestore, as is the case for PostScript).
+ */
+
+#define HT_NONE 0x0
+#define HT_FIXED 0x1
+#define HT_USERDEF 0x2
+#define HT_DEVCSPACE 0x4
+#define HT_IMONLY 0x8
+
+typedef struct rend_info_s {
+ uint flags;
+ gx_device_cmap * pdev;
+ const pcl_ht_builtin_dither_t * pbidither;
+} pcl_rend_info_t;
+
+/*
* Client data structure for PCL halftones. This holds two pieces of
* information: the gamma correction factor, and a pointer to the lookup table
* for device specific color spaces. The former is used only if the latter is
@@ -193,26 +235,10 @@ typedef struct pcl_ht_s pcl_ht_t;
* for special render methods. Currently it only creates the built-in dither
* arrays.
*/
-extern void pcl_ht_init_render_methods(
+void pcl_ht_init_render_methods(P2(
pcl_state_t * pcs,
gs_memory_t * pmem
-);
-
-/*
- * Update built-in rendering information. Attempts to change information for
- * fixed rendering methods are ignored.
- */
-extern void pcl_ht_update_rendering_info(
- int method,
- const pcl_ht_builtin_dither_t * pbidither
-);
-
-/*
- * Modify the rendering-method remap table. This table is used to set rendering
- * methods to match specific HP devices. The operand array is used to map
- * requested rendering methods to the rendering method actually used.
- */
-extern void pcl_ht_update_rendering_remap( const byte * map );
+));
/*
* Set up normal or monochrome print mode. The latter is accomplished by
@@ -224,21 +250,21 @@ extern void pcl_ht_update_rendering_remap( const byte * map );
* Note that the current rendering method must be set before this change
* will take effect.
*/
-extern void pcl_ht_set_print_mode( bool monochrome );
+void pcl_ht_set_print_mode(P2(pcl_state_t *pcs, bool monochrome));
/*
* Set the render method.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_ht_set_render_method( pcl_ht_t ** ppht, uint render_method );
+int pcl_ht_set_render_method(P3(pcl_state_t *pcs, pcl_ht_t ** ppht, uint render_method));
/*
* Update the gamma parameter.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_ht_set_gamma( pcl_ht_t ** ppht, float gamma );
+int pcl_ht_set_gamma(P2(pcl_ht_t ** ppht, float gamma));
/*
* Update the color lookup table information. This takes action only for lookup
@@ -247,20 +273,20 @@ extern int pcl_ht_set_gamma( pcl_ht_t ** ppht, float gamma );
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_ht_set_lookup_tbl(
+int pcl_ht_set_lookup_tbl(P2(
pcl_ht_t ** ppht,
pcl_lookup_tbl_t * plktbl
-);
+));
/*
* Set the user-defined dither matrix for a halftone object.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_ht_set_udither(
+int pcl_ht_set_udither(P2(
pcl_ht_t ** ppht,
pcl_udither_t * pdither
-);
+));
/*
* Update the current halftone for a change in the color space.
@@ -269,21 +295,23 @@ extern int pcl_ht_set_udither(
* in which a device-independent color space is used with a rendering method
* that is not compatible with device-independent color spaces.
*/
-extern int pcl_ht_update_cspace(
+int pcl_ht_update_cspace(P4(
+ pcl_state_t * pcs,
pcl_ht_t ** ppht,
pcl_cspace_type_t cstype_old,
pcl_cspace_type_t cstype_new
-);
+));
/*
* Create the default halftone, releasing the current halftone if it exists.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_ht_build_default_ht(
+int pcl_ht_build_default_ht(P3(
+ pcl_state_t * pcs,
pcl_ht_t ** ppht,
gs_memory_t * pmem
-);
+));
/*
* Set the given halftone into the graphic state. If the halftone doesn't
@@ -291,11 +319,11 @@ extern int pcl_ht_build_default_ht(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_ht_set_halftone(
+int pcl_ht_set_halftone(P4(
+ pcl_state_t * pcs,
pcl_ht_t ** ppht,
pcl_cspace_type_t cstype,
- bool for_image,
- pcl_state_t * pcs
-);
+ bool for_image
+));
#endif /* pcht_INCLUDED */
diff --git a/pcl/pcident.h b/pcl/pcident.h
index 75d859fc9..161a7cd37 100644
--- a/pcl/pcident.h
+++ b/pcl/pcident.h
@@ -35,8 +35,8 @@
typedef ulong pcl_gsid_t;
-extern pcl_gsid_t pcl_next_id( void );
+pcl_gsid_t pcl_next_id( void );
-extern void pcl_init_id( void );
+void pcl_init_id( void );
#endif /* pcident_INCLUDED */
diff --git a/pcl/pcindxed.h b/pcl/pcindxed.h
index cee90ba3c..f4bc822e1 100644
--- a/pcl/pcindxed.h
+++ b/pcl/pcindxed.h
@@ -202,7 +202,7 @@ typedef struct pcl_cs_indexed_s {
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_indexed_set_norm_and_Decode(
+int pcl_cs_indexed_set_norm_and_Decode(P7(
pcl_cs_indexed_t ** ppindexed,
floatp wht0,
floatp wht1,
@@ -210,7 +210,7 @@ extern int pcl_cs_indexed_set_norm_and_Decode(
floatp blk0,
floatp blk1,
floatp blk2
-);
+));
/*
* Change the number of entries in an PCL indexed color space palette.
@@ -220,32 +220,32 @@ extern int pcl_cs_indexed_set_norm_and_Decode(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_indexed_set_num_entries(
+int pcl_cs_indexed_set_num_entries(P3(
pcl_cs_indexed_t ** ppindexed,
int new_num,
bool gl2
-);
+));
/*
* Update the lookup table information for an indexed color space.
*
* Returns 0 if successful, < 0 in the event of an error.
*/
-extern int pcl_cs_indexed_update_lookup_tbl(
+int pcl_cs_indexed_update_lookup_tbl(P2(
pcl_cs_indexed_t ** pindexed,
pcl_lookup_tbl_t * plktbl
-);
+));
/*
* Update an entry in the palette of a PCL indexed color space.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_indexed_set_palette_entry(
+int pcl_cs_indexed_set_palette_entry(P3(
pcl_cs_indexed_t ** ppindexed,
int indx,
const float comps[3]
-);
+));
/*
* Default the contents of a palette entry.
@@ -254,21 +254,21 @@ extern int pcl_cs_indexed_set_palette_entry(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_indexed_set_default_palette_entry(
+int pcl_cs_indexed_set_default_palette_entry(P2(
pcl_cs_indexed_t ** ppindexed,
int indx
-);
+));
/*
* Set a pen width in a palette. Units used are still TBD.
*
* Returns 0 if successful, < 0 in case of error.
*/
-extern int pcl_cs_indexed_set_pen_width(
+int pcl_cs_indexed_set_pen_width(P3(
pcl_cs_indexed_t ** ppindexed,
int pen,
floatp width
-);
+));
/*
* Build a PCL indexed color space.
@@ -277,13 +277,13 @@ extern int pcl_cs_indexed_set_pen_width(
*
* Returns 0 if successful, < 0 in case of error.
*/
-extern int pcl_cs_indexed_build_cspace(
+int pcl_cs_indexed_build_cspace(P5(
pcl_cs_indexed_t ** ppindexed,
const pcl_cid_data_t * pcid,
bool fixed,
bool gl2,
gs_memory_t * pmem
-);
+));
/*
* Build the default indexed color space. This function is usually called only
@@ -291,10 +291,10 @@ extern int pcl_cs_indexed_build_cspace(
*
* Returns 0 on success, < 0
*/
-extern int pcl_cs_indexed_build_default_cspace(
+int pcl_cs_indexed_build_default_cspace(P2(
pcl_cs_indexed_t ** ppindexed,
gs_memory_t * pmem
-);
+));
/*
* Special indexed color space constructor, for building a 2 entry indexed color
@@ -304,12 +304,12 @@ extern int pcl_cs_indexed_build_default_cspace(
* This reoutine is used to build the two-entry indexed color spaces required
* for creating opaque "uncolored" patterns.
*/
-extern int pcl_cs_indexed_build_special(
+int pcl_cs_indexed_build_special(P4(
pcl_cs_indexed_t ** ppindexed,
pcl_cs_base_t * pbase,
const byte * pcolor1,
gs_memory_t * pmem
-);
+));
/*
* Install an indexed color space into the graphic state. If not indexed
@@ -317,10 +317,10 @@ extern int pcl_cs_indexed_build_special(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_cs_indexed_install(
+int pcl_cs_indexed_install(P2(
pcl_cs_indexed_t ** ppindexed,
pcl_state_t * pcs
-);
+));
/*
* Two routines to determine if an entry of a color palette is either white
@@ -332,15 +332,15 @@ extern int pcl_cs_indexed_install(
* the two give different results, and the former is much simpler to implement
* in the current system.
*/
-extern bool pcl_cs_indexed_is_white(
+bool pcl_cs_indexed_is_white(P2(
const pcl_cs_indexed_t * pindexed,
int indx
-);
+));
-extern bool pcl_cs_indexed_is_black(
+bool pcl_cs_indexed_is_black(P2(
const pcl_cs_indexed_t * pindexed,
int indx
-);
+));
#define pcl_cs_indexed_0_is_white(pindexed) \
pcl_cs_indexed_is_white(pindexed, 0)
@@ -351,6 +351,6 @@ extern bool pcl_cs_indexed_is_black(
* One time initialization. This exists only because of the possibility that
* BSS may not be initialized.
*/
-extern void pcl_cs_indexed_init( void );
+void pcl_cs_indexed_init( void );
#endif /* pcindexed_INCLUDED */
diff --git a/pcl/pcl.mak b/pcl/pcl.mak
index ac81b6106..02c272e05 100644
--- a/pcl/pcl.mak
+++ b/pcl/pcl.mak
@@ -134,7 +134,6 @@ pcstate_h = $(PCLSRC)pcstate.h \
pccid_h = $(PCLSRC)pccid.h \
$(gx_h) \
$(gsstruct_h) \
- $(pcstate_h) \
$(pcommand_h)
pccrd_h = $(PCLSRC)pccrd.h \
diff --git a/pcl/pclookup.h b/pcl/pclookup.h
index 0395b655e..d1ba57e7d 100644
--- a/pcl/pclookup.h
+++ b/pcl/pclookup.h
@@ -202,6 +202,6 @@ typedef struct pcl_lookup_tbl_s {
/*
* External access to the color lookup table/gamma correction code.
*/
-extern const pcl_init_t pcl_lookup_tbl_init;
+const pcl_init_t pcl_lookup_tbl_init;
#endif /* pclookup_INCLUDED */
diff --git a/pcl/pcmtx3.h b/pcl/pcmtx3.h
index 50010007c..a22aff4bd 100644
--- a/pcl/pcmtx3.h
+++ b/pcl/pcmtx3.h
@@ -73,28 +73,28 @@ typedef union {
*
* Any of the three pointer operands may be the same.
*/
-extern void pcl_vec3_add(
+void pcl_vec3_add(P3(
const pcl_vec3_t * pivec1,
const pcl_vec3_t * pivec2,
pcl_vec3_t * poutvec
-);
+));
-extern void pcl_vec3_sub(
+void pcl_vec3_sub(P3(
const pcl_vec3_t * pivec1,
const pcl_vec3_t * pivec2,
pcl_vec3_t * poutvec
-);
+));
/*
* Apply a matrix to a 3-dimensional row vector.
*
* The code will properly handle the case pinvec == poutvec.
*/
-extern void pcl_vec3_xform(
+void pcl_vec3_xform(P3(
const pcl_vec3_t * pinvec,
pcl_vec3_t * poutvec,
const pcl_mtx3_t * pmtx
-);
+));
/*
* Invert a 3 x 3 matrix.
@@ -103,10 +103,10 @@ extern void pcl_vec3_xform(
*
* Returns 0 on success, e_Range if the matrix provided is singular.
*/
-extern int pcl_mtx3_invert(
+int pcl_mtx3_invert(P2(
const pcl_mtx3_t * pinmtx,
pcl_mtx3_t * poutmtx
-);
+));
/*
* Add, subtract, and multiply two 3 x 3 matrices. These are not currently
@@ -114,36 +114,36 @@ extern int pcl_mtx3_invert(
*
* In all cases, any of the three pointers provided may be identical.
*/
-extern void pcl_mtx3_add(
+void pcl_mtx3_add(P3(
const pcl_mtx3_t * pinmtx1,
const pcl_mtx3_t * pinmtx2,
pcl_mtx3_t * poutmtx
-);
+));
-extern void pcl_mtx3_sub(
+void pcl_mtx3_sub(P3(
const pcl_mtx3_t * pinmtx1,
const pcl_mtx3_t * pinmtx2,
pcl_mtx3_t * poutmtx
-);
+));
-extern void pcl_mtx3_mul(
+void pcl_mtx3_mul(P3(
const pcl_mtx3_t * pinmtx1,
const pcl_mtx3_t * pinmtx2,
pcl_mtx3_t * poutmtx
-);
+));
/*
* Convert a pcl_mtx3_t structure to and from a gs_matrix3 struct. Identity
* transformations are rare in PCL, so no attempt is made to identify them.
*/
-extern void pcl_mtx3_convert_to_gs(
+void pcl_mtx3_convert_to_gs(P2(
const pcl_mtx3_t * pinmtx,
gs_matrix3 * pgsmtx
-);
+));
-extern void pcl_mtx3_convert_from_gs(
+void pcl_mtx3_convert_from_gs(P2(
pcl_mtx3_t * poutmtx,
const gs_matrix3 * pgsmtx
-);
+));
#endif /* pcmtx3_INCLUDED */
diff --git a/pcl/pcpage.h b/pcl/pcpage.h
index 9054073df..6377f4b78 100644
--- a/pcl/pcpage.h
+++ b/pcl/pcpage.h
@@ -11,7 +11,7 @@
#include "pcommand.h"
/* set the page output procedure */
-extern void pcl_set_end_page( int (*procp)(pcl_state_t *, int, int) );
+void pcl_set_end_page(P1(int (*procp)(pcl_state_t *, int, int)));
/*
* End a page, either unconditionally or only if there are marks on it.
@@ -22,10 +22,10 @@ typedef enum {
pcl_print_if_marked
} pcl_print_condition_t;
-extern int pcl_end_page(
+int pcl_end_page(P2(
pcl_state_t * pcs,
pcl_print_condition_t condition
-);
+));
#define pcl_end_page_always(pcs) pcl_end_page((pcs), pcl_print_always)
#define pcl_end_page_if_marked(pcs) pcl_end_page((pcs), pcl_print_if_marked)
diff --git a/pcl/pcpalet.c b/pcl/pcpalet.c
index 284f96f0b..453e2419f 100644
--- a/pcl/pcpalet.c
+++ b/pcl/pcpalet.c
@@ -177,7 +177,7 @@ build_default_palette(
if (code == 0)
pcl_crd_init_from(ppalet->pcrd, pcl_default_crd);
if (code == 0)
- code = pcl_ht_build_default_ht(&(ppalet->pht), pmem);
+ code = pcl_ht_build_default_ht(pcs, &(ppalet->pht), pmem);
if (code < 0) {
if (ppalet != 0)
free_palette(pmem, ppalet, "build default palette");
@@ -382,9 +382,9 @@ pcl_palette_set_render_method(
int code = unshare_palette(pcs);
if ((code == 0) && (pcs->ppalet->pht == 0))
- code = pcl_ht_build_default_ht(&(pcs->ppalet->pht), pcs->memory);
+ code = pcl_ht_build_default_ht(pcs, &(pcs->ppalet->pht), pcs->memory);
if (code >= 0)
- code = pcl_ht_set_render_method(&(pcs->ppalet->pht), render_method);
+ code = pcl_ht_set_render_method(pcs, &(pcs->ppalet->pht), render_method);
if (code >= 0)
pcs->render_mode = render_method;
return code;
@@ -413,7 +413,7 @@ pcl_palette_set_gamma(
int code = unshare_palette(pcs);
if ((code == 0) && (pcs->ppalet->pht == 0))
- code = pcl_ht_build_default_ht(&(pcs->ppalet->pht), pcs->memory);
+ code = pcl_ht_build_default_ht(pcs, &(pcs->ppalet->pht), pcs->memory);
if (code == 0)
code = pcl_ht_set_gamma(&(pcs->ppalet->pht), gamma);
return code;
@@ -448,7 +448,7 @@ pcl_palette_set_lookup_tbl(
pcs->memory
);
if ((code == 0) && (pcs->ppalet->pht == 0))
- code = pcl_ht_build_default_ht(&(pcs->ppalet->pht), pcs->memory);
+ code = pcl_ht_build_default_ht(pcs, &(pcs->ppalet->pht), pcs->memory);
if (code < 0)
return code;
@@ -569,7 +569,7 @@ pcl_palette_set_udither(
int code = unshare_palette(pcs);
if ((code == 0) && (pcs->ppalet->pht == 0))
- code = pcl_ht_build_default_ht(&(pcs->ppalet->pht), pcs->memory);
+ code = pcl_ht_build_default_ht(pcs, &(pcs->ppalet->pht), pcs->memory);
if (code == 0)
code = pcl_ht_set_udither(&(pcs->ppalet->pht), pdither);
return code;
@@ -622,7 +622,7 @@ pcl_palette_set_cid(
/* if a halftone exist, inform it of the update and discard lookup tables */
if ((code == 0) && (ppalet->pht != 0)) {
- code = pcl_ht_update_cspace(&(ppalet->pht), cstype_old, cstype_new);
+ code = pcl_ht_update_cspace(pcs, &(ppalet->pht), cstype_old, cstype_new);
if (code == 0)
code = pcl_ht_set_lookup_tbl(&(ppalet->pht), NULL);
}
@@ -687,7 +687,7 @@ pcl_palette_check_complete(
pcl_crd_init_from(pcs->ppalet->pcrd, pcl_default_crd);
}
if ((code == 0) && (ppalet->pht == 0))
- code = pcl_ht_build_default_ht(&(ppalet->pht), pcs->memory);
+ code = pcl_ht_build_default_ht(pcs, &(ppalet->pht), pcs->memory);
return code;
}
@@ -865,7 +865,7 @@ set_print_mode(
pcl_home_cursor(pcs);
pcs->monochrome_mode = (mode == 1);
- pcl_ht_set_print_mode(pcs->monochrome_mode);
+ pcl_ht_set_print_mode(pcs, pcs->monochrome_mode);
return pcl_palette_set_render_method(pcs, pcs->render_mode);
}
diff --git a/pcl/pcpalet.h b/pcl/pcpalet.h
index 6a3dd5a4e..690e3f737 100644
--- a/pcl/pcpalet.h
+++ b/pcl/pcpalet.h
@@ -132,7 +132,7 @@ typedef struct pcl_palette_s pcl_palette_t;
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_CR(
+int pcl_palette_CR(P7(
pcl_state_t * pcs,
floatp wht0,
floatp wht1,
@@ -140,7 +140,7 @@ extern int pcl_palette_CR(
floatp blk0,
floatp blk1,
floatp blk2
-);
+));
/*
* Set the number of entries in a color palette. This is needed only for the
@@ -149,7 +149,7 @@ extern int pcl_palette_CR(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_NP( pcl_state_t * pcs, int num_entries );
+int pcl_palette_NP(P2(pcl_state_t * pcs, int num_entries));
/*
* Set a pen width. Note that this does NOT change the palette id. This
@@ -157,7 +157,7 @@ extern int pcl_palette_NP( pcl_state_t * pcs, int num_entries );
*
* Returns 0 on success, < 0 in the even of an error;
*/
-extern int pcl_palette_PW( pcl_state_t * pcs, int pen, floatp width );
+int pcl_palette_PW(P3(pcl_state_t * pcs, int pen, floatp width));
/*
* Support for the GL/2 IN command. This is actually implemented in pccid.c,
@@ -170,10 +170,10 @@ extern int pcl_palette_PW( pcl_state_t * pcs, int pen, floatp width );
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_set_render_method(
+int pcl_palette_set_render_method(P2(
pcl_state_t * pcs,
uint render_method
-);
+));
/*
* Set gamma correction information for a palette.
@@ -189,7 +189,7 @@ extern int pcl_palette_set_render_method(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_set_gamma( pcl_state_t * pcs, float gamma );
+int pcl_palette_set_gamma(P2(pcl_state_t * pcs, float gamma));
/*
* Set color lookup table information for a palette.
@@ -206,10 +206,10 @@ extern int pcl_palette_set_gamma( pcl_state_t * pcs, float gamma );
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_set_lookup_tbl(
+int pcl_palette_set_lookup_tbl(P2(
pcl_state_t * pcs,
pcl_lookup_tbl_t * plktbl
-);
+));
/*
* Set an entry in a color palette.
@@ -217,11 +217,11 @@ extern int pcl_palette_set_lookup_tbl(
* Returns 0 on success, < 0 in the event of an error. The returned code will
* normally be ignored.
*/
-extern int pcl_palette_set_color(
+int pcl_palette_set_color(P3(
pcl_state_t * pcs,
int indx,
const float comps[3]
-);
+));
/*
* Set a palette entry to its default color.
@@ -229,20 +229,20 @@ extern int pcl_palette_set_color(
* Returns 0 on success, < 0 in the event of an error. The returned code will
* normally be ignored.
*/
-extern int pcl_palette_set_default_color(
+int pcl_palette_set_default_color(P2(
pcl_state_t * pcs,
int indx
-);
+));
/*
* Set the user-defined dither matrix.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_set_udither(
+int pcl_palette_set_udither(P2(
pcl_state_t * pcs,
pcl_udither_t * pdither
-);
+));
/*
* Overwrite the current palette with new a new image data configuration.
@@ -259,22 +259,22 @@ extern int pcl_palette_set_udither(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_set_cid(
+int pcl_palette_set_cid(P4(
pcl_state_t * pcs,
pcl_cid_data_t * pcid,
bool fixed,
bool gl2
-);
+));
/*
* Set the view illuminant for a palette.
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_set_view_illuminant(
+int pcl_palette_set_view_illuminant(P2(
pcl_state_t * pcs,
const gs_vector3 * pwht_pt
-);
+));
/*
* Check that all parts of a PCL palette have been built. If not, build the
@@ -282,7 +282,7 @@ extern int pcl_palette_set_view_illuminant(
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_palette_check_complete( pcl_state_t * pcs );
+int pcl_palette_check_complete(P1(pcl_state_t * pcs));
/*
* Entry points to the palette-related commands.
diff --git a/pcl/pcparam.h b/pcl/pcparam.h
index b7679b5e6..98592b637 100644
--- a/pcl/pcparam.h
+++ b/pcl/pcparam.h
@@ -16,9 +16,9 @@
* Put a single device parameter.
* Return 0 if OK, 1 if must reopen device, or an error code.
*/
-extern int put_param1_bool( pcl_state_t *, gs_param_name, bool );
-extern int put_param1_float( pcl_state_t *, gs_param_name, floatp );
-extern int put_param1_int( pcl_state_t *, gs_param_name, int );
-extern int put_param1_float_array( pcl_state_t *, gs_param_name, float[2] );
+int put_param1_bool(P3(pcl_state_t *, gs_param_name, bool));
+int put_param1_float(P3(pcl_state_t *, gs_param_name, floatp));
+int put_param1_int(P3(pcl_state_t *, gs_param_name, int) );
+int put_param1_float_array(P3(pcl_state_t *, gs_param_name, float[2]));
#endif /* pcparam_INCLUDED */
diff --git a/pcl/pcpatrn.c b/pcl/pcpatrn.c
index 3b025fe94..9df1e6b92 100644
--- a/pcl/pcpatrn.c
+++ b/pcl/pcpatrn.c
@@ -84,7 +84,7 @@ set_ht_crd_from_palette(
ppalet = pcs->ppalet;
/* install crd and ht */
- code = pcl_ht_set_halftone(&(ppalet->pht), cstype, false, pcs);
+ code = pcl_ht_set_halftone(pcs, &(ppalet->pht), cstype, false);
if (code == 0)
code = pcl_crd_set_crd(&(ppalet->pcrd), pcs);
return code;
@@ -106,7 +106,7 @@ set_ht_crd_from_foreground(
pcl_cspace_type_t cstype = pcl_frgrnd_get_cspace(pfrgrnd);
/* install crd and ht */
- code = pcl_ht_set_halftone(&(pfrgrnd->pht), cstype, false, pcs);
+ code = pcl_ht_set_halftone(pcs, &(pfrgrnd->pht), cstype, false);
if (code == 0)
code = pcl_crd_set_crd(&(pfrgrnd->pcrd), pcs);
return code;
@@ -848,11 +848,11 @@ pattern_set_white(
/* build the pure white color space and default halftone if necessary */
if ((code = pcl_cs_base_build_white_cspace(&pwhite_cs, pcs->memory)) >= 0)
- code = pcl_ht_build_default_ht(&pdflt_ht, pcs->memory);
+ code = pcl_ht_build_default_ht(pcs, &pdflt_ht, pcs->memory);
/* set the halftone and color space */
if (code >= 0)
- code = pcl_ht_set_halftone(&pdflt_ht, pcl_cspace_RGB, false, pcs);
+ code = pcl_ht_set_halftone(pcs, &pdflt_ht, pcl_cspace_RGB, false);
pcl_ht_release(pdflt_ht);
if (code >= 0)
code = set_unpatterned_color(pcs, NULL, pwhite_cs, &white_paint);
diff --git a/pcl/pcpatrn.h b/pcl/pcpatrn.h
index 715efe8ed..6df770b60 100644
--- a/pcl/pcpatrn.h
+++ b/pcl/pcpatrn.h
@@ -291,11 +291,11 @@ struct pcl_ccolor_s {
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_pattern_RF(
+int pcl_pattern_RF(P3(
int ptrn_indx, /* pattern index */
const gs_depth_bitmap * ppixmap, /* pixmap */
pcl_state_t * pcs
-);
+));
/*
* Procedure to get/set up the current graphic state for the proper "pattern"
@@ -532,17 +532,17 @@ typedef int (*pcl_pattern_set_proc_t)( pcl_state_t *, int arg1, int arg2 );
*
* A return of NULL indicates a range check error.
*/
-extern pcl_pattern_set_proc_t pcl_pattern_get_proc_PCL(
+pcl_pattern_set_proc_t pcl_pattern_get_proc_PCL(P1(
pcl_pattern_source_t pattern_source
-);
+));
-extern pcl_pattern_set_proc_t pcl_pattern_get_proc_FT(
+pcl_pattern_set_proc_t pcl_pattern_get_proc_FT(P1(
hpgl_FT_pattern_source_t pattern_source
-);
+));
-extern pcl_pattern_set_proc_t pcl_pattern_get_proc_SV(
+pcl_pattern_set_proc_t pcl_pattern_get_proc_SV(P1(
hpgl_SV_pattern_source_t pattern_source
-);
+));
/*
* Entry point to pattern-related functions.
diff --git a/pcl/pcpatxfm.h b/pcl/pcpatxfm.h
index 06b1d851d..d471104ab 100644
--- a/pcl/pcpatxfm.h
+++ b/pcl/pcpatxfm.h
@@ -16,26 +16,26 @@
/* invert a diagonal matrix (assumed to be non-signular) */
-extern void pcl_invert_mtx( const gs_matrix * pmtx1, gs_matrix * pmtx2 );
+void pcl_invert_mtx(P2(const gs_matrix * pmtx1, gs_matrix * pmtx2));
/* transform a rectangel via a diagonal matrix */
-extern void pcl_transform_rect(
+void pcl_transform_rect(P3(
const gs_rect * prect1,
gs_rect * prect2,
const gs_matrix * pmtx
-);
+));
/*
* create a 90 degree rotation matrix (counter clockwise rotation) that includes
* the transformation required to keep the indicated rectangle in the positive
* quadrant (with the origin at one corner of the rectangle).
*/
-extern void pcl_make_rotation(
+void pcl_make_rotation(P4(
int rot,
floatp width,
floatp height,
gs_matrix * pmtx
-);
+));
/*
* Form the transformation matrix required to render a pattern.
@@ -43,31 +43,31 @@ extern void pcl_make_rotation(
* Note that, though the rotation implicit in the print direction may apply
* to a pattern transformation, the translation never does.
*/
-extern void pcl_xfm_get_pat_xfm(
+void pcl_xfm_get_pat_xfm(P3(
const pcl_state_t * pcs,
pcl_pattern_t * pptrn,
gs_matrix * pmat
-);
+));
/*
* Reset the PCL pattern reference point. This should be done each time the
* logical page parameters change. (This would be better done via a reset, but
* unfortunately there was no reset created for this category of event.)
*/
-extern void pcl_xfm_reset_pcl_pat_ref_pt( pcl_state_t * pcs );
+void pcl_xfm_reset_pcl_pat_ref_pt(P1(pcl_state_t * pcs));
/*
* Set up the pattern orientation and reference point for PCL. Note that PCL's
* pattern reference point is kept in logical page space.
*/
-extern void pcl_xfm_pcl_set_pat_ref_pt( pcl_state_t * pcs );
+void pcl_xfm_pcl_set_pat_ref_pt(P1(pcl_state_t * pcs));
/*
* Set up the pattern orientatin and reference point for GL. The anchor point
* is taken as being in the current GL space, and the current transform is
* assumed properly set. The orientation is that of the logical page.
*/
-extern void pcl_xfm_gl_set_pat_ref_pt( pcl_state_t * pcs );
+void pcl_xfm_gl_set_pat_ref_pt(P1(pcl_state_t * pcs));
extern const pcl_init_t pcl_xfm_init;
diff --git a/pcl/pcstate.h b/pcl/pcstate.h
index c724ccd9a..cf229f480 100644
--- a/pcl/pcstate.h
+++ b/pcl/pcstate.h
@@ -9,6 +9,7 @@
#include "gx.h"
#include "gxdevice.h"
+#include "gdevcmap.h"
#include "scommon.h"
#include "gsdcolor.h" /* for gx_ht_tile */
#include "gschar.h"
@@ -23,6 +24,7 @@
#include "pcpattyp.h" /* pattern related structures */
#include "pcdict.h" /* PL dictionary key structure */
#include "rtrstst.h" /* raster state information */
+#include "pcht.h"
/*#include "pgstate.h"*/ /* HP-GL/2 state, included below */
#include "pjparse.h"
@@ -54,21 +56,21 @@ typedef struct gs_state_s gs_state;
* The routine pcl_init_gstate_stk must be called once a boot time to
* intialize PCL graphics state stack tracking mechanism.
*/
-extern int pcl_gsave( pcl_state_t * pcs );
-extern int pcl_grestore( pcl_state_t * pcs );
-extern void pcl_init_gstate_stk( pcl_state_t * pcs );
+int pcl_gsave(P1(pcl_state_t * pcs));
+int pcl_grestore(P1(pcl_state_t * pcs));
+void pcl_init_gstate_stk(P1(pcl_state_t * pcs));
/*
* "Cold start" initialization for the graphic state.
*/
-extern void pcl_init_state( pcl_state_t * pcs, gs_memory_t * pmem );
+void pcl_init_state(P2(pcl_state_t * pcs, gs_memory_t * pmem));
#include "pgstate.h" /* HP-GL/2 state */
#ifndef pcl_pattern_data_DEFINED
-#define pcl_pattern_data_DEFINED
-typedef struct pcl_pattern_t pcl_pattern_s;
+#define pcl_ht_builtin_dither_DEFINED
+typedef struct pcl_pattern_t pcl_pattern;
#endif
/*
@@ -206,13 +208,13 @@ struct pcl_state_s {
pl_dict_t gl_patterns;
#define PCL_NUM_SHADE_PATTERNS (7) /* pcl support 7 shades of gray */
#define PCL_NUM_CROSSHATCH_PATTERNS (6) /* and 6 cross hatch patterns */
- pcl_pattern_s * bi_pattern_array[PCL_NUM_SHADE_PATTERNS + PCL_NUM_CROSSHATCH_PATTERNS];
+ pcl_pattern * bi_pattern_array[PCL_NUM_SHADE_PATTERNS + PCL_NUM_CROSSHATCH_PATTERNS];
int last_pcl_uptrn_id; /* optimizations for recording last patter */
- pcl_pattern_s * plast_pcl_uptrn; /* and pattern id */
+ pcl_pattern * plast_pcl_uptrn; /* and pattern id */
int last_gl2_RF_indx;
- pcl_pattern_s * plast_gl2_uptrn;
- pcl_pattern_s * psolid_pattern; /* see documentation in pcbiptrn.c for these two */
- pcl_pattern_s * punsolid_pattern;
+ pcl_pattern * plast_gl2_uptrn;
+ pcl_pattern * psolid_pattern; /* see documentation in pcbiptrn.c for these two */
+ pcl_pattern * punsolid_pattern;
bool rotate_patterns; /* rotate patterns with print direction in PCL */
bool source_transparent; /* (also in graphics state) */
bool pattern_transparent;/* (also in graphics state);
@@ -256,10 +258,31 @@ struct pcl_state_s {
pcl_frgrnd_t * pfrgrnd;
pcl_gstate_ids_t * pids;
+ /* internal dithers */
+ pcl_ht_builtin_dither_t ordered_dither;
+ pcl_ht_builtin_dither_t clustered_dither;
+ pcl_ht_builtin_dither_t noise_dither;
+ /*
+ * The forwarding devices to preform any necessary color mapping. There are
+ * four of these: identity mapping, snap to primaries, map black to white and
+ * all other colors to black, and monochrome mapping. The devices are all
+ * identical except for the mapping method used.
+ *
+ * Several devices are required because the rendering method used by the
+ * foreground may not be the same as that used by the current palette.
+ */
+ gx_device_cmap cmap_device_identity;
+ gx_device_cmap cmap_device_snap_to_primaries;
+ gx_device_cmap cmap_device_color_to_black_over_white;
+ gx_device_cmap cmap_device_monochrome;
+ pcl_rend_info_t rendering_info[20]; /* rendering methods */
+ byte dflt_rendering_remap[20]; /* NB not convinced this is necessary (review) */
+ byte rendering_remap[20]; /* remap the table of rendering methods */
+ pcl_ht_t * pdflt_ht; /* default halftone */
+
/* Chapter C5 (pccprint.c) */
byte logical_op; /* (also in graphics state) */
byte pp_mode; /* pixel placement mode */
-
/* ---------------- HP-GL/2 state ---------------- */
pcl_hpgl_state_t g; /* see pgstate.h */
/* ---------------- PJL state -------------------- */
diff --git a/pcl/pcuptrn.h b/pcl/pcuptrn.h
index a42cd6c44..3c763e77d 100644
--- a/pcl/pcuptrn.h
+++ b/pcl/pcuptrn.h
@@ -15,36 +15,36 @@
* Free routine for patterns. This is exported for the benefit of the code
* that handles PCL built-in patterns.
*/
-extern void pcl_pattern_free_pattern(
+void pcl_pattern_free_pattern(P3(
gs_memory_t * pmem,
void * pvptrn,
client_name_t cname
-);
+));
/*
* Build a PCL pattern. This is exported for use by the routines supporting
* built-in patterns.
*/
-extern int pcl_pattern_build_pattern(
+int pcl_pattern_build_pattern(P6(
pcl_pattern_t ** pppat_data,
const gs_depth_bitmap * ppixmap,
pcl_pattern_type_t type,
int xres,
int yres,
gs_memory_t * pmem
-);
+));
/*
* Get a PCL user-defined pattern. A null return indicates the pattern is
* not defined.
*/
-extern pcl_pattern_t * pcl_pattern_get_pcl_uptrn( pcl_state_t *pcs, int id );
+pcl_pattern_t * pcl_pattern_get_pcl_uptrn(P2(pcl_state_t *pcs, int id));
/*
* Get a GL/2 user defined pattern. A null return indicates there is no pattern
* defined for the index.
*/
-extern pcl_pattern_t * pcl_pattern_get_gl_uptrn( pcl_state_t *pcs, int indx );
+extern pcl_pattern_t * pcl_pattern_get_gl_uptrn(P2(pcl_state_t *pcs, int indx));
/* pcl_pattern_RF is in pcpatrn.h */
diff --git a/pcl/pcursor.h b/pcl/pcursor.h
index 6d602bdb1..7926cf321 100644
--- a/pcl/pcursor.h
+++ b/pcl/pcursor.h
@@ -26,27 +26,27 @@
* which the pcs->cap is maintained. If passing coordinates in the
* latter space, BE SURE TO SUBTRACT THE CURRENT TOP MARGIN.
*/
-extern void pcl_set_cap_x(
+void pcl_set_cap_x(P4(
pcl_state_t * pcs,
coord x, /* position or distance */
bool relative, /* x is distance (else position) */
bool use_margins /* apply text margins */
-);
+));
-extern int pcl_set_cap_y(
+int pcl_set_cap_y(P5(
pcl_state_t * pcs,
coord y, /* position or distance */
bool relative, /* y is distance (else position) */
bool use_margins, /* apply text margins */
bool by_row /* LF, half LF, or by row */
-);
+));
-extern void pcl_do_CR( pcl_state_t * pcs );
-extern int pcl_do_LF( pcl_state_t * pcs );
-extern void pcl_home_cursor( pcl_state_t * pcs );
+void pcl_do_CR(P1(pcl_state_t * pcs));
+int pcl_do_LF(P1(pcl_state_t * pcs));
+void pcl_home_cursor(P1(pcl_state_t * pcs));
/* Get the HMI. This may require recomputing it from the font. */
-extern coord pcl_updated_hmi( pcl_state_t * pcs );
+coord pcl_updated_hmi(P1(pcl_state_t * pcs));
#define pcl_hmi(pcs) \
((pcs)->hmi_cp == HMI_DEFAULT ? pcl_updated_hmi(pcs) : (pcs)->hmi_cp)
diff --git a/pcl/pcwhtidx.h b/pcl/pcwhtidx.h
index 6b86cc61a..595b596de 100644
--- a/pcl/pcwhtidx.h
+++ b/pcl/pcwhtidx.h
@@ -57,14 +57,14 @@
*
* Returns 0 if successful, < 0 in the event of an error.
*/
-extern int pcl_cmap_map_raster(
+int pcl_cmap_map_raster(P6(
const pcl_cs_indexed_t * pindexed,
int * pfirst_white,
const gs_depth_bitmap * pin_pixinfo,
gs_depth_bitmap * pout_pixinfo,
bool must_copy,
gs_memory_t * pmem
-);
+));
/*
* An alternative interface to the remapping capability, this one more suited
@@ -88,17 +88,17 @@ extern int pcl_cmap_map_raster(
* a null-pointer inline. Hence, the caller need not provide any other check
* of whether or nor remapping is necessary.
*/
-extern const void * pcl_cmap_create_remap_ary(
+const void * pcl_cmap_create_remap_ary(P2(
pcl_state_t * pcs,
int * pfirst_white
-);
+));
-extern void pcl_cmap_int_apply_ary(
+void pcl_cmap_int_apply_ary(P4(
const void * vpmap, /* remap array pointer */
byte * prast, /* array of bytes to be mapped */
int b_per_p, /* bits per pixel */
int npixels
-);
+));
#define pcl_cmap_apply_remap_ary(pmap, prast, b_per_p, npixels) \
BEGIN \
diff --git a/pcl/pginit.h b/pcl/pginit.h
index cdefbbdb6..cd12317be 100644
--- a/pcl/pginit.h
+++ b/pcl/pginit.h
@@ -13,12 +13,12 @@
#include "pgmand.h"
/* Reset a set of font parameters to their default values. */
-extern void hpgl_default_font_params(P1( pcl_font_selection_t * pfs ));
+void hpgl_default_font_params(P1( pcl_font_selection_t * pfs ));
/* Reset all the fill patterns to solid fill. */
-extern void hpgl_default_all_fill_patterns(P1( hpgl_state_t * pgls ));
+void hpgl_default_all_fill_patterns(P1( hpgl_state_t * pgls ));
/* Reset (parts of) the HP-GL/2 state. */
-extern void hpgl_do_reset(P2( pcl_state_t * pcs, pcl_reset_type_t type ));
+void hpgl_do_reset(P2( pcl_state_t * pcs, pcl_reset_type_t type ));
#endif /* pginit_INCLUDED */
diff --git a/pcl/pgmisc.h b/pcl/pgmisc.h
index 436030917..608a8d640 100644
--- a/pcl/pgmisc.h
+++ b/pcl/pgmisc.h
@@ -8,7 +8,7 @@
#ifndef pgmisc_INCLUDED
# define pgmisc_INCLUDED
-extern void hpgl_set_lost_mode(P2(hpgl_state_t *pgls, hpgl_lost_mode_t lost_mode));
+void hpgl_set_lost_mode(P2(hpgl_state_t *pgls, hpgl_lost_mode_t lost_mode));
/* get the current setting of the edge pen set by CF, NB this should
be in a different header file */
int32 hpgl_get_character_edge_pen(P1(hpgl_state_t *pgls));
@@ -23,8 +23,8 @@ int32 hpgl_get_character_edge_pen(P1(hpgl_state_t *pgls));
#ifdef DEBUG
-extern void hpgl_error(P0());
-extern int hpgl_print_error(P4(const char *function, const char *file, int line, int code));
+void hpgl_error(P0());
+int hpgl_print_error(P4(const char *function, const char *file, int line, int code));
# ifdef __GNUC__
# define hpgl_call_note_error(code)\
diff --git a/pcl/rtgmode.h b/pcl/rtgmode.h
index 1295a5936..8a7621215 100644
--- a/pcl/rtgmode.h
+++ b/pcl/rtgmode.h
@@ -25,13 +25,13 @@ typedef enum {
/* enter raster graphics mode */
-extern int pcl_enter_graphics_mode(
+int pcl_enter_graphics_mode(P2(
pcl_state_t * pcs,
pcl_gmode_entry_t mode
-);
+));
/* exit raster graphics mode */
-extern int pcl_end_graphics_mode( pcl_state_t * pcs );
+int pcl_end_graphics_mode(P1(pcl_state_t * pcs));
extern const pcl_init_t rtgmode_init;
extern const pcl_init_t rtlrastr_init;
diff --git a/pcl/rtraster.h b/pcl/rtraster.h
index 9bef6a83d..5abd4f4f6 100644
--- a/pcl/rtraster.h
+++ b/pcl/rtraster.h
@@ -15,14 +15,14 @@
*
* Returns 0 on success, < 0 in the event of an error.
*/
-extern int pcl_start_raster(
+int pcl_start_raster(P3(
uint src_width,
uint src_height,
pcl_state_t * pcs
-);
+));
/* complete a raster (when exiting raster graphics mode) */
-extern void pcl_complete_raster( void );
+void pcl_complete_raster(void);
extern const pcl_init_t rtraster_init;
diff --git a/pcl/rtrstcmp.h b/pcl/rtrstcmp.h
index 91219119d..a9724a8e8 100644
--- a/pcl/rtrstcmp.h
+++ b/pcl/rtrstcmp.h
@@ -72,9 +72,9 @@ typedef struct pcl_seed_row_s {
/*
* The array of decompression functions.
*/
-extern void (*const pcl_decomp_proc[9 + 1])( pcl_seed_row_t * pout,
- const byte * pin,
- int in_size
- );
+void (*const pcl_decomp_proc[9 + 1])(P3(pcl_seed_row_t *pout,
+ const byte *pin,
+ int in_size
+ ));
#endif /* rtrstcmp_INCLUDED */