diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2021-03-16 18:00:13 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2021-05-03 08:43:18 -0700 |
commit | 032cb22e6d63e2e81b86ae6ba1cbd04d7798bae7 (patch) | |
tree | 384383fb28c5e38380019437c026087ac99d2196 /base/gxicolor.c | |
parent | 2b5118c3fcb8e5cc58c9a3d87ad9fe327eece117 (diff) | |
download | ghostpdl-032cb22e6d63e2e81b86ae6ba1cbd04d7798bae7.tar.gz |
Add object type specific device halftones to the graphics state.
PostScript 'sethalftone' has an optional parameter "ObjectType" that allows
one of the three object specific types to be set: Vector, Image or Text.
Also add a new PostScript operator to set the current halftone (dev_ht,
set by sethalftone) as the device halftone to be used for an object type:
path, image and text.
For non-PostScript clients, the gs_halftone structure adds a 'objtype'
element (enum) that can be set prior to calling gs_sethalftone.
The gs_gstate_s dev_ht is now an array of HT_OBJTYPE_COUNT elements,
indexed by the gs_HT_objtype_t enum, with HT_OBJTYPE_DEFAULT (value 0)
used for prior sethalftone/setscreen/setcolorscreen operations.
NOTE: adding object types beyond the default+3 entries will require modification
of gx_select_dev_ht since it only uses 3 bits of the 'tag' to get the index
for the dev_ht[] array.
For code style, change to use != NULL instead of != 0 in most places that
this commit touched (but we may want a general cleanup of this everywhere).
TBD: Command line options for all PDL's will need a method to take a
halftone specification -- most likely a file that may be "PS-lite" syntax
and may be limited to a threshold array. Discussions are in progress.
Diffstat (limited to 'base/gxicolor.c')
-rw-r--r-- | base/gxicolor.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/base/gxicolor.c b/base/gxicolor.c index 05820695b..4785ab4f0 100644 --- a/base/gxicolor.c +++ b/base/gxicolor.c @@ -108,7 +108,7 @@ color_halftone_init(gx_image_enum *penum) if (!gx_device_must_halftone(penum->dev)) return NULL; - if (penum->pgs == NULL || penum->pgs->dev_ht == NULL) + if (penum->pgs == NULL || penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT] == NULL) return NULL; dda_ht = penum->dda.pixel0.x; if (penum->dxx > 0) @@ -136,20 +136,20 @@ color_halftone_init(gx_image_enum *penum) if (cal_ht == NULL) goto fail; - for (k = 0; k < penum->pgs->dev_ht->num_comp; k++) { - d_order = &(penum->pgs->dev_ht->components[k].corder); + for (k = 0; k < penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT]->num_comp; k++) { + d_order = &(penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT]->components[k].corder); code = gx_ht_construct_threshold(d_order, penum->dev, penum->pgs, k); if (code < 0) goto fail; if (cal_halftone_add_screen(ctx, penum->memory->non_gc_memory, cal_ht, - penum->pgs->dev_ht->components[k].corder.threshold_inverted, - penum->pgs->dev_ht->components[k].corder.width, - penum->pgs->dev_ht->components[k].corder.full_height, + penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT]->components[k].corder.threshold_inverted, + penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT]->components[k].corder.width, + penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT]->components[k].corder.full_height, -penum->pgs->screen_phase[k].x, -penum->pgs->screen_phase[k].y, - penum->pgs->dev_ht->components[k].corder.threshold) < 0) + penum->pgs->dev_ht[HT_OBJTYPE_DEFAULT]->components[k].corder.threshold) < 0) goto fail; } |