Esempio n. 1
0
/**
 * Create a region info for each process and virtual colorant.  These are used
 * for tracking the background to avoid compositing for colorimetric overprints.
 * Spot colorants that are being output do not need compositing for overprinting
 * and are ignored.
 */
static Bool region_info_for_overprinting(DL_STATE *page, GUCR_RASTERSTYLE *rs,
                                         RegionInfo **regionInfo)
{
  GUCR_CHANNEL *hf;

  for ( hf = gucr_framesStart(rs); gucr_framesMore(hf); gucr_framesNext(&hf) ) {
    GUCR_COLORANT *hc;
    for ( hc = gucr_colorantsStart(hf);
          gucr_colorantsMore(hc, GUCR_INCLUDING_PIXEL_INTERLEAVED);
          gucr_colorantsNext(&hc) ) {
      /* Ignore spot colorants that are being output, because compositing is not
         required to overprint them. */
      const GUCR_COLORANT_INFO *colorantInfo;
      if ( gucr_colorantDescription(hc, &colorantInfo) &&
           (colorantInfo->colorantType == COLORANTTYPE_PROCESS ||
            !guc_equivalentRealColorantIndex(rs, colorantInfo->colorantIndex, NULL)) ) {
        if ( !region_info_create(page, regionInfo, colorantInfo->colorantIndex,
                                 colorantInfo->colorantType == COLORANTTYPE_PROCESS,
                                 colorantInfo->colorantType != COLORANTTYPE_PROCESS) )
          return FALSE;
      }
    }
  }
  return TRUE;
}
Esempio n. 2
0
region_info_t *region_info_cpy(region_info_t *copy, region_info_t *info)
{
  contour_point_t *_contour = NULL;
  int              max_contour = 0;
  int *            _subLabels = NULL;
  int              max_subLabels = 0;

  if (!info) return (copy);
  if (!copy)
    copy = region_info_create();

  _contour = copy->contour;
  max_contour = copy->max_contour;
  _subLabels = copy->subLabels;
  max_subLabels = copy->max_subLabels;

  memcpy(copy, info, sizeof(region_info_t));

  copy->contour = (contour_point_t *)
    _region_memcpyPtr(&copy->max_contour,
		      _contour, max_contour,
		      info->contour, info->max_contour,
		      info->n_contour, sizeof(contour_point_t));
  copy->subLabels = (int *)
    _region_memcpyPtr(&copy->max_subLabels,
		      _subLabels, max_subLabels,
		      info->subLabels, info->max_subLabels,
		      info->n_subLabels, sizeof(int));

  return (copy);
}
Esempio n. 3
0
/**
 * Create a region map and mark it according to the DL.  If LCM is enabled then
 * overprinted process colorants may need compositing for correct results.
 */
Bool dlregion_mark(DL_STATE *page)
{
  Bool result = FALSE;
  RegionMarkingData data = {0};
  DL_FORALL_INFO info = {0};

  HQASSERT(page->regionMap == NULL, "Region map already exists");
  HQASSERT(page->region_width > 0 && page->region_height > 0,
           "Region dimensions not set");
  if ( !region_map_create(page, &page->regionMap) )
    return FALSE;
#define return USE_goto_cleanup

  /* Do not mark the region map for pattern DL objects, only patterned objects.
     The pattern DL objects are defined in pattern space and could also be
     tiled. */
  info.page = page;
  info.inflags = DL_FORALL_USEMARKER|DL_FORALL_GROUP;
  /** \todo Vignette detection fails to unify KO flags through the vignette
      elements and therefore we need to mark elements individually. Don't need
      to do this for shfills, and once vignette detection is removed we can also
      remove this hack (also remove include "vndetect.h"). */
  if ( vd_detect() )
    info.inflags |= DL_FORALL_SHFILL;
  info.hdl = dlPageHDL(page);
  info.data = &data;

#if defined( DEBUG_BUILD )
  /* Decide whether to force the whole page to be composited. */
  if ( (backdrop_render_debug & BR_DEBUG_ALL_TO_BACKDROP) != 0 ) {
    dbbox_t pageFrame;
    bbox_store(&pageFrame, 0, 0, page->page_w - 1, page->page_h - 1);
    bitGridSetBoxMapped(page->regionMap, &pageFrame, TRUE);
  } else
#endif
  if ( pclGstateIsEnabled() ) {
    /* PCL uses a single region info to track the background. */
    if ( !region_info_create(page, &data.regionInfo, COLORANTINDEX_UNKNOWN,
                             TRUE, FALSE) )
      goto cleanup;

    /* Do region marking according to PCL rules. */
    if ( !dl_forall(&info, dlregion_pcl_callback) )
      goto cleanup;
  } else {
    /* Do region marking for transparency and overprinting. */
    if ( !dl_forall(&info, dlregion_callback) )
      goto cleanup;
  }

#ifdef METRICS_BUILD
  {
    dl_metrics_t *dlmetrics = dl_metrics();
    Size2d size = bitGridSize(page->regionMap);
    uint32 x, y;

    for ( y = 0; y < size.height; ++y ) {
      for ( x = 0; x < size.width; ++x ) {
        ++dlmetrics->regions.total;
        if ( bitGridGet(page->regionMap, x, y) )
          ++dlmetrics->regions.backdropRendered;
        else
          ++dlmetrics->regions.directRendered;
      }
    }
  }
#endif

  result = TRUE;
 cleanup:
  region_info_destroy(&data.regionInfo);
  /* Don't need regionMap if error or all clear. */
  if ( page->regionMap != NULL &&
       (!result || bitGridGetAll(page->regionMap) == BGAllClear) )
    bitGridDestroy(&page->regionMap);
#undef return
  return result;
}