/* Copy device parameters back from the target. */ static void bbox_copy_params(gx_device_bbox * bdev, bool remap_colors) { gx_device *tdev = bdev->target; if (tdev != 0) gx_device_copy_params((gx_device *)bdev, tdev); if (remap_colors) { bdev->black = gx_device_black((gx_device *)bdev); bdev->white = gx_device_white((gx_device *)bdev); bdev->transparent = (bdev->white_is_opaque ? gx_no_color_index : bdev->white); } }
/* Initialize a RasterOp source device. */ void gx_make_rop_texture_device(gx_device_rop_texture * dev, gx_device * target, gs_logical_operation_t log_op, const gx_device_color * texture) { gx_device_init((gx_device *) dev, (const gx_device *)&gs_rop_texture_device, NULL, true); gx_device_set_target((gx_device_forward *)dev, target); /* Drawing operations are defaulted, non-drawing are forwarded. */ check_device_separable((gx_device *) dev); gx_device_fill_in_procs((gx_device *) dev); gx_device_copy_params((gx_device *)dev, target); dev->log_op = log_op; dev->texture = *texture; }
/* Create an alpha compositor. */ static int c_alpha_create_default_compositor(const gs_composite_t * pcte, gx_device ** pcdev, gx_device * dev, gs_imager_state * pis, gs_memory_t * mem) { gx_device_composite_alpha *cdev; if (pacte->params.op == composite_Copy) { /* Just use the original device. */ *pcdev = dev; return 0; } cdev = gs_alloc_struct_immovable(mem, gx_device_composite_alpha, &st_device_composite_alpha, "create default alpha compositor"); *pcdev = (gx_device *)cdev; if (cdev == 0) return_error(gs_error_VMerror); gx_device_init((gx_device *)cdev, (const gx_device *)&gs_composite_alpha_device, mem, true); gx_device_copy_params((gx_device *)cdev, dev); /* * Set the color_info and depth to be compatible with the target, * but using standard chunky color storage, including alpha. ****** CURRENTLY ALWAYS USE 8-BIT COLOR ****** */ cdev->color_info.depth = (dev->color_info.num_components == 4 ? 32 /* CMYK, no alpha */ : (dev->color_info.num_components + 1) * 8); cdev->color_info.max_gray = cdev->color_info.max_color = 255; /* No halftoning will occur, but we fill these in anyway.... */ cdev->color_info.dither_grays = cdev->color_info.dither_colors = 256; /* * We could speed things up a little by tailoring the procedures in * the device to the specific num_components, but for simplicity, * we'll defer considering that until there is a demonstrated need. */ gx_device_set_target((gx_device_forward *)cdev, dev); cdev->params = pacte->params; return 0; }