aboutsummaryrefslogtreecommitdiff
path: root/generic/Group.c
diff options
context:
space:
mode:
authorlecoanet2005-05-10 07:59:48 +0000
committerlecoanet2005-05-10 07:59:48 +0000
commit79f65d040d72f778f66f8eefdaffb6acd9799a38 (patch)
treed1e43508242bd9d6ba85e4147e444d12830b8d3a /generic/Group.c
parent72fd6b4d5f695731d2b6f4c553f7f9bcd0c43476 (diff)
downloadtkzinc-79f65d040d72f778f66f8eefdaffb6acd9799a38.zip
tkzinc-79f65d040d72f778f66f8eefdaffb6acd9799a38.tar.gz
tkzinc-79f65d040d72f778f66f8eefdaffb6acd9799a38.tar.bz2
tkzinc-79f65d040d72f778f66f8eefdaffb6acd9799a38.tar.xz
Merge of the newly developped postscript code (still not fully functional).
Diffstat (limited to 'generic/Group.c')
-rw-r--r--generic/Group.c66
1 files changed, 63 insertions, 3 deletions
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, &current_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;
}