int gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax, gx_color_tile *ptile, gx_pattern_trans_t *fill_trans_buffer, gs_int_point phase) { tile_fill_trans_state_t state; int code; if (ptile == 0) /* null pattern */ return 0; /* Fit fill */ if ( (xmin | ymin) < 0 ) { if ( xmin < 0 ) xmin = 0; if ( ymin < 0 ) ymin = 0; } state.phase.x = phase.x; state.phase.y = phase.y; if (ptile->is_simple && ptile->cdev == NULL) { /* A simple case. Tile is not clist and simple. */ int px = imod(-(int)fastfloor(ptile->step_matrix.tx - phase.x + 0.5), ptile->ttrans->width); int py = imod(-(int)fastfloor(ptile->step_matrix.ty - phase.y + 0.5), ptile->ttrans->height); tile_rect_trans_simple(xmin, ymin, xmax, ymax, px, py, ptile, fill_trans_buffer); } else { if (ptile->cdev == NULL) { /* No clist for the pattern, but a complex case This portion transforms the bounding box by the step matrix and does partial rect fills with tiles that fall into this transformed bbox */ code = tile_by_steps_trans(&state, xmin, ymin, xmax-xmin, ymax-ymin, fill_trans_buffer, ptile); } else { /* clist for the tile. Currently this is not implemented for the case when the tile has transparency. This is on the to do list. Right now, all tiles with transparency are rendered into the pattern cache or into the clist */ return_error(gs_error_unregistered); } } return(0); }
int gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax, gx_color_tile *ptile, gx_pattern_trans_t *fill_trans_buffer, gs_int_point phase, gx_device *dev, const gx_device_color * pdevc) { tile_fill_trans_state_t state_trans; tile_fill_state_t state_clist_trans; int code; if (ptile == 0) /* null pattern */ return 0; /* Fit fill */ if ( (xmin | ymin) < 0 ) { if ( xmin < 0 ) xmin = 0; if ( ymin < 0 ) ymin = 0; } /* Initialize the fill state */ state_trans.phase.x = phase.x; state_trans.phase.y = phase.y; if (ptile->is_simple && ptile->cdev == NULL) { /* A simple case. Tile is not clist and simple. */ int px = imod(-(int)fastfloor(ptile->step_matrix.tx - phase.x + 0.5), ptile->ttrans->width); int py = imod(-(int)fastfloor(ptile->step_matrix.ty - phase.y + 0.5), ptile->ttrans->height); tile_rect_trans_simple(xmin, ymin, xmax, ymax, px, py, ptile, fill_trans_buffer); } else { if (ptile->cdev == NULL) { /* No clist for the pattern, but a complex case This portion transforms the bounding box by the step matrix and does partial rect fills with tiles that fall into this transformed bbox */ code = tile_by_steps_trans(&state_trans, xmin, ymin, xmax-xmin, ymax-ymin, fill_trans_buffer, ptile); } else { /* clist for the trans tile. This uses the pdf14 device as a target and should blend directly into the buffer. Note that the pattern can not have a push pdf14 device or a pop pdf14 device compositor action. Those are removed during the compositor clist writing operation where we check for the case of a pattern with a transparency */ gx_device_clist *cdev = ptile->cdev; gx_device_clist_reader *crdev = (gx_device_clist_reader *)cdev; gx_strip_bitmap tbits; code = tile_fill_init(&state_clist_trans, pdevc, dev, false); state_clist_trans.phase.x = phase.x; state_clist_trans.phase.y = phase.y; crdev->yplane.depth = 0; crdev->yplane.shift = 0; crdev->yplane.index = -1; crdev->pages = NULL; crdev->num_pages = 1; state_clist_trans.orig_dev = dev; state_clist_trans.pdevc = pdevc; tbits = ptile->tbits; tbits.size.x = crdev->width; tbits.size.y = crdev->height; code = tile_by_steps(&state_clist_trans, xmin, ymin, xmax, ymax, ptile, &tbits, tile_pattern_clist); } } return(0); }