From 79f65d040d72f778f66f8eefdaffb6acd9799a38 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Tue, 10 May 2005 07:59:48 +0000 Subject: Merge of the newly developped postscript code (still not fully functional). --- generic/Group.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) (limited to 'generic/Group.c') diff --git a/generic/Group.c b/generic/Group.c index d569182..1f6a183 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -1355,10 +1355,70 @@ Coords(ZnItem item, * ********************************************************************************** */ -static void -PostScript(ZnItem item, - ZnBool prepass) +static int +PostScript(ZnItem item, + ZnBool prepass, + ZnBBox *area) { + GroupItem group = (GroupItem) item; + ZnWInfo *wi = item->wi; + ZnItem current_item; + ZnBBox bbox; + int result = TCL_OK; + char msg[500]; + + PushTransform(item); + PushClip(group, True); + + for (current_item = group->tail; current_item != ZN_NO_ITEM; + current_item = current_item->previous) { + if (ISCLEAR(current_item->flags, ZN_VISIBLE_BIT)) { + continue; + } + //printf("area %g %g %g %g\n", area->orig.x, area->orig.y, + // area->corner.x, area->corner.y); + ZnIntersectBBox(area, ¤t_item->item_bounding_box, &bbox); + if (ZnIsEmptyBBox(&bbox)) { + continue; + } + if (current_item->class->PostScript == NULL) { + continue; + } + + if (current_item->class != ZnGroup) { + PushTransform(current_item); + if (!prepass) { + Tcl_AppendResult(wi->interp, "gsave\n", NULL); + } + ZnPostscriptTrace(current_item, 1); + } + result = current_item->class->PostScript(current_item, prepass, area); + if (current_item->class != ZnGroup) { + ZnPostscriptTrace(current_item, 0); + if (!prepass && (result == TCL_OK)) { + Tcl_AppendResult(wi->interp, "grestore\n", NULL); + } + PopTransform(current_item); + } + if (result == TCL_ERROR) { + if (!prepass) { + /* + * Add some trace to ease the error lookup. + */ + sprintf(msg, "\n (generating Postscript for item %d)", current_item->id); + Tcl_AddErrorInfo(wi->interp, msg); + break; + } + } + } + + PopClip(group, True); + PopTransform(item); + + if (!prepass && (result == TCL_OK)) { + ZnFlushPsChan(wi->interp, wi->ps_info); + } + return result; } -- cgit v1.1