summaryrefslogtreecommitdiff
path: root/xps/xpsopacity.c
blob: 6bd640b32ed8e554bbc40535e0c47875efaccc33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "fitz.h"
#include "muxps.h"

void
xps_bounds_in_user_space(xps_context *ctx, fz_rect *ubox)
{
	*ubox = fz_infiniterect; // *evil grin*
#if 0
	gx_clip_path *clip_path;
	fz_rect dbox;
	int code;

	code = gx_effective_clip_path(ctx->pgs, &clip_path);
	if (code < 0)
		fz_warn("gx_effective_clip_path failed");

	dbox.p.x = fixed2float(clip_path->outer_box.p.x);
	dbox.p.y = fixed2float(clip_path->outer_box.p.y);
	dbox.q.x = fixed2float(clip_path->outer_box.q.x);
	dbox.q.y = fixed2float(clip_path->outer_box.q.y);
	gs_bbox_transform_inverse(&dbox, &ctm_only(ctx->pgs), ubox);
#endif
}

void
xps_begin_opacity(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *dict,
		char *opacity_att, xps_item *opacity_mask_tag)
{
	fz_rect bbox;
	float opacity;
	int save;

return;

	if (!opacity_att && !opacity_mask_tag)
		return;

	opacity = 1.0;
	if (opacity_att)
		opacity = atof(opacity_att);
//	gs_setopacityalpha(ctx->pgs, opacity);

	xps_bounds_in_user_space(ctx, &bbox);

	if (opacity_mask_tag)
	{
		/* opacity-only mode: use alpha value as gray color to create luminosity mask */
		save = ctx->opacity_only;
		ctx->opacity_only = 1;

		// begin mask
		xps_parse_brush(ctx, ctm, base_uri, dict, opacity_mask_tag);

		ctx->opacity_only = save;
	}

	// begin group
}

void
xps_end_opacity(xps_context *ctx, char *base_uri, xps_resource *dict,
		char *opacity_att, xps_item *opacity_mask_tag)
{
	if (!opacity_att && !opacity_mask_tag)
		return;
	// end mask+group
}