summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2017-09-10 12:40:14 -0700
committerRay Johnston <ray.johnston@artifex.com>2017-09-10 12:40:14 -0700
commitd94fd9bd9cb69a998c812eb2f04fdc0083895ae5 (patch)
treea851b4c2abd592970ccc9b6ee7957bc144c83518
parentdc8eb2a822bda44aab546e0bf7a0e35e3115696b (diff)
downloadghostpdl-d94fd9bd9cb69a998c812eb2f04fdc0083895ae5.tar.gz
Adjust .genordered 50% gray level to be on an desirable boundary
Customer needs 50% gray level with 45 degree Angle and DotShape 8 to be a checkerboard pattern with no stray dots. Add a check to force the step at 50% to be an even number of dots. Tested for Frequency from 30 to 150 (at 600 dpi).
-rw-r--r--psi/zht2.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/psi/zht2.c b/psi/zht2.c
index 739ed2704..718da9f7f 100644
--- a/psi/zht2.c
+++ b/psi/zht2.c
@@ -474,10 +474,10 @@ zgenordered(i_ctx_t *i_ctx_p)
/* Make a threshold array from the turn_on_sequence */
int level;
int cur_pix = 0;
- double end_value, cur_value = 0.0;
int width = final_mask.width;
int num_pix = width * final_mask.height;
double delta_value = 1.0 / (double)(num_pix);
+ double end_value, cur_value = 0.0;
byte *thresh;
ref rval, thresh_ref;
@@ -493,10 +493,11 @@ zgenordered(i_ctx_t *i_ctx_p)
goto done;
/* The following is adapted from thresh_remap with the default linear map */
for (level=0; level<256; level++) {
- end_value = (float)(1+level) / 256.;
- if (end_value > 256.0)
- end_value = 256.0; /* clamp in case of rounding errors */
- while (end_value - cur_value > 0.00001) {
+ end_value = (float)(1+level) / 255.;
+ if (end_value > 255.0)
+ end_value = 255.0; /* clamp in case of rounding errors */
+ while (cur_value < (end_value - (delta_value * (1./256.))) ||
+ (cur_pix + 1) == (num_pix / 2) ) { /* force 50% gray level */
thresh[final_mask.data[2*cur_pix] + (width*final_mask.data[2*cur_pix+1])] = 255 - level;
cur_pix++;
if (cur_pix >= num_pix)