Exemplo n.º 1
0
/* Begin a compositing operation. */
static int
begin_composite(i_ctx_t *i_ctx_p, alpha_composite_state_t * pcp)
{
    gx_device *dev = gs_currentdevice(igs);
    int code =
        gs_create_composite_alpha(&pcp->pcte, &pcp->params, imemory);

    if (code < 0)
        return code;
    pcp->orig_dev = pcp->cdev = dev;	/* for end_composite */
    code = (*dev_proc(dev, create_compositor))
        (dev, &pcp->cdev, pcp->pcte, (gs_imager_state *)igs, imemory, NULL);
    if (code < 0) {
        end_composite(i_ctx_p, pcp);
        return code;
    }
    gs_setdevice_no_init(igs, pcp->cdev);
    return 0;
}
Exemplo n.º 2
0
static int
c_alpha_read(gs_composite_t ** ppcte, const byte * data, uint size,
	     gs_memory_t * mem)
{
    gs_composite_alpha_params_t params;
    int code, nbytes = 1;

    if (size < 1 || *data > composite_op_last)
	return_error(gs_error_rangecheck);
    params.op = *data;
    if_debug1('v', "[v]c_alpha_read(%d)\n", params.op);
    if (params.op == composite_Dissolve) {
	if (size < 1 + sizeof(params.delta))
	    return_error(gs_error_rangecheck);
	memcpy(&params.delta, data + 1, sizeof(params.delta));
	nbytes += sizeof(params.delta);
    }
    code = gs_create_composite_alpha(ppcte, &params, mem);
    return code < 0 ? code : nbytes;
}