Ejemplo n.º 1
0
static void
fz_list_fill_shade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
{
	fz_display_node *node;
	node = fz_new_display_node(FZ_CMD_FILL_SHADE, ctm, NULL, NULL, alpha);
	node->rect = fz_bound_shade(shade, ctm);
	node->item.shade = fz_keep_shade(shade);
	fz_append_display_node(user, node);
}
Ejemplo n.º 2
0
static void
fz_list_fill_shade(fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha)
{
	fz_display_node *node;
	fz_context *ctx = dev->ctx;
	node = fz_new_display_node(ctx, FZ_CMD_FILL_SHADE, ctm, NULL, NULL, alpha);
	fz_bound_shade(ctx, shade, ctm, &node->rect);
	node->item.shade = fz_keep_shade(ctx, shade);
	fz_append_display_node(dev->user, node);
}
Ejemplo n.º 3
0
fz_error
pdf_load_shading(fz_shade **shadep, pdf_xref *xref, fz_obj *dict)
{
	fz_error error;
	fz_matrix mat;
	fz_obj *obj;
	fz_context *ctx = xref->ctx;

	if ((*shadep = pdf_find_item(ctx, xref->store, fz_drop_shade, dict)))
	{
		fz_keep_shade(*shadep);
		return fz_okay;
	}

	/* Type 2 pattern dictionary */
	if (fz_dict_gets(ctx, dict, "PatternType"))
	{
		obj = fz_dict_gets(ctx, dict, "Matrix");
		if (obj)
			mat = pdf_to_matrix(ctx, obj);
		else
			mat = fz_identity;

		obj = fz_dict_gets(ctx, dict, "ExtGState");
		if (obj)
		{
			if (fz_dict_gets(ctx, obj, "CA") || fz_dict_gets(ctx, obj, "ca"))
			{
				fz_warn(ctx, "shading with alpha not supported");
			}
		}

		obj = fz_dict_gets(ctx, dict, "Shading");
		if (!obj)
			return fz_error_make(ctx, "syntaxerror: missing shading dictionary");

		error = pdf_load_shading_dict(shadep, xref, obj, mat);
		if (error)
			return fz_error_note(ctx, error, "cannot load shading dictionary (%d %d R)", fz_to_num(obj), fz_to_gen(obj));
	}

	/* Naked shading dictionary */
	else
	{
		error = pdf_load_shading_dict(shadep, xref, dict, fz_identity);
		if (error)
			return fz_error_note(ctx, error, "cannot load shading dictionary (%d %d R)", fz_to_num(dict), fz_to_gen(dict));
	}

	pdf_store_item(ctx, xref->store, fz_keep_shade, fz_drop_shade, dict, *shadep);

	return fz_okay;
}