[gs-commits] rev 11783 - trunk/ghostpdl/pcl
henrys at ghostscript.com
henrys at ghostscript.com
Mon Oct 11 16:56:25 UTC 2010
Author: henrys
Date: 2010-10-11 16:56:24 +0000 (Mon, 11 Oct 2010)
New Revision: 11783
Modified:
trunk/ghostpdl/pcl/pcpalet.c
trunk/ghostpdl/pcl/pgcolor.c
trunk/ghostpdl/pcl/pgconfig.c
trunk/ghostpdl/pcl/pgmand.h
Log:
Implement the HPGL/2 color range command, not surprisingly we missed
implementing this as the target device of emulation (Color Laserjet)
does not support it correctly.
Modified: trunk/ghostpdl/pcl/pcpalet.c
===================================================================
--- trunk/ghostpdl/pcl/pcpalet.c 2010-10-11 07:53:26 UTC (rev 11782)
+++ trunk/ghostpdl/pcl/pcpalet.c 2010-10-11 16:56:24 UTC (rev 11783)
@@ -318,7 +318,36 @@
return 0;
}
+/*
+ * Set the white and black point of the GL/2 color palette.
+ *
+ * Returns 0 on success, < 0 in the event of an error.
+ */
+int pcl_palette_CR(
+ pcl_state_t * pcs,
+ floatp wht0,
+ floatp wht1,
+ floatp wht2,
+ floatp blk0,
+ floatp blk1,
+ floatp blk2
+)
+
+{
+ int code = unshare_palette(pcs);
+
+ /* if the default color space must be built, it is fixed, so don't bother */
+ if (pcs->ppalet->pindexed == 0)
+ return code;
+
+ return pcl_cs_indexed_set_norm_and_Decode( &(pcs->ppalet->pindexed),
+ wht0, wht1, wht2,
+ blk0, blk1, blk2
+ );
+}
+
+
/*
* Set the number of entries in a color palette. This is needed only for the
* GL/2 NP command; PCL sets the number of entries in a palette via the
Modified: trunk/ghostpdl/pcl/pgcolor.c
===================================================================
--- trunk/ghostpdl/pcl/pgcolor.c 2010-10-11 07:53:26 UTC (rev 11782)
+++ trunk/ghostpdl/pcl/pgcolor.c 2010-10-11 16:56:24 UTC (rev 11783)
@@ -96,6 +96,38 @@
}
/*
+ * CR [black reference point red, white reference point red, ...];
+ */
+ int
+hpgl_CR(
+ hpgl_args_t * pargs,
+ hpgl_state_t * pgls
+)
+{
+
+ floatp b_ref_r, b_ref_g, b_ref_b,
+ w_ref_r, w_ref_g, w_ref_b;
+
+ if ( pgls->personality == pcl5e )
+ return 0;
+
+ if (hpgl_arg_c_real(pgls->memory, pargs, &b_ref_r))
+ if ( !hpgl_arg_c_real(pgls->memory, pargs, &w_ref_r) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &b_ref_g) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &w_ref_g) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &b_ref_b) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &w_ref_b) )
+ return e_Range;
+ else
+ return pcl_palette_CR(pgls, w_ref_r, w_ref_g, w_ref_b,
+ b_ref_r, b_ref_g, b_ref_b);
+ else /* no args - default references */
+ return pcl_palette_CR(pgls, 255, 255, 255, 0, 0, 0);
+}
+
+
+
+/*
* Initialization. There is no reset or copy command, as those operations are
* carried out by the palette mechanism.
*/
@@ -109,6 +141,7 @@
DEFINE_HPGL_COMMANDS(mem)
HPGL_COMMAND('N', 'P', hpgl_NP, hpgl_cdf_pcl_rtl_both),
HPGL_COMMAND('P', 'C', hpgl_PC, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('C', 'R', hpgl_CR, hpgl_cdf_pcl_rtl_both),
END_HPGL_COMMANDS
return 0;
}
Modified: trunk/ghostpdl/pcl/pgconfig.c
===================================================================
--- trunk/ghostpdl/pcl/pgconfig.c 2010-10-11 07:53:26 UTC (rev 11782)
+++ trunk/ghostpdl/pcl/pgconfig.c 2010-10-11 16:56:24 UTC (rev 11783)
@@ -284,6 +284,10 @@
if (code == 0)
code = pcl_palette_IN(pgls);
+ /* default color range */
+ hpgl_args_setup(&args);
+ hpgl_CR(&args, pgls);
+
/* pen width units - metric, also reset pen widths. This is also
done in hpgl_IN_implicit() above but we have to set the pen
widths again in the case a new palette was created. The
Modified: trunk/ghostpdl/pcl/pgmand.h
===================================================================
--- trunk/ghostpdl/pcl/pgmand.h 2010-10-11 07:53:26 UTC (rev 11782)
+++ trunk/ghostpdl/pcl/pgmand.h 2010-10-11 16:56:24 UTC (rev 11783)
@@ -259,6 +259,7 @@
int hpgl_MC(hpgl_args_t *pargs, hpgl_state_t *pgls);
int hpgl_NP(hpgl_args_t *pargs, hpgl_state_t *pgls);
int hpgl_PP(hpgl_args_t *pargs, hpgl_state_t *pgls);
+int hpgl_CR(hpgl_args_t *pargs, hpgl_state_t *pgls);
/* commands from pgconfig.c - HP-GL/2 configuration and status commands */
int hpgl_CO(hpgl_args_t *pargs, hpgl_state_t *pgls);
More information about the gs-commits
mailing list