void TransformerFunc::execute() { ComValue objv(stack_arg(0)); ComValue transv(stack_arg(0)); reset_stack(); if (objv.object_compview()) { ComponentView* compview = (ComponentView*)objv.obj_val(); if (compview && compview->GetSubject()) { OverlayComp* comp = (OverlayComp*)compview->GetSubject(); Graphic* gr = comp->GetGraphic(); if (gr) { Transformer* trans = gr->GetTransformer(); if (transv.is_unknown() || !transv.is_array() || transv.array_val()->Number()!=6) { AttributeValueList* avl = new AttributeValueList(); float a00, a01, a10, a11, a20, a21; trans->matrix(a00, a01, a10, a11, a20, a21); avl->Append(new AttributeValue(a00)); avl->Append(new AttributeValue(a01)); avl->Append(new AttributeValue(a10)); avl->Append(new AttributeValue(a11)); avl->Append(new AttributeValue(a20)); avl->Append(new AttributeValue(a21)); ComValue retval(avl); push_stack(retval); } else { float a00, a01, a10, a11, a20, a21; AttributeValueList* avl = transv.array_val(); Iterator it; AttributeValue* av; avl->First(it); av = avl->GetAttrVal(it); a00 = av->float_val(); avl->Next(it); av = avl->GetAttrVal(it); a01 = av->float_val(); avl->Next(it); av = avl->GetAttrVal(it); a10 = av->float_val(); avl->Next(it); av = avl->GetAttrVal(it); a11 = av->float_val(); avl->Next(it); av = avl->GetAttrVal(it); a20 = av->float_val(); avl->Next(it); av = avl->GetAttrVal(it); a21 = av->float_val(); Transformer t(a00, a01, a10, a11, a20, a21); *gr->GetTransformer()=t; ComValue compval(new OverlayViewRef(comp), comp->class_symid()); push_stack(compval); } } } } }
boolean PSLink::Definition (ostream& out) { LinkComp* comp = (LinkComp*) GetSubject(); Graphic* link = comp->GetGraphic(); Line* line = comp->GetLine(); Transformer* link_t = link->GetTransformer(); Transformer* line_t = line->GetTransformer(); Transformer* temp_t = new Transformer(line_t); Resource::ref(link_t); temp_t->postmultiply(*link_t); link->SetTransformer(temp_t); Coord x0, y0, x1, y1; line->GetOriginal(x0, y0, x1, y1); out << "Begin " << MARK << " Line\n"; MinGS(out); out << MARK << "\n"; out << x0 << " " << y0 << " " << x1 << " " << y1 << " Line\n"; out << "End\n\n"; link->SetTransformer(link_t); Resource::unref(link_t); Resource::unref(temp_t); return out.good(); }
void Picture::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { Extent e; float right, top, dummy1, dummy2; if (extentCached()) { getCachedExtent(e._left, e._bottom, e._cx, e._cy, e._tol); } else { if (IsEmpty()) { l = b = cx = cy = tol = 0.0; return; } else { Iterator i; FullGraphic gstemp; Transformer ttemp; Extent te; gstemp.SetTransformer(&ttemp); First(i); Graphic* gr = GetGraphic(i); concatGSGraphic(gr, gr, gs, &gstemp); concatTransformerGraphic(gr, nil, gr->GetTransformer(), &ttemp); getExtentGraphic(gr, e._left,e._bottom,e._cx,e._cy,e._tol,&gstemp); for (Next(i); !Done(i); Next(i)) { gr = GetGraphic(i); concatGSGraphic(gr, gr, gs, &gstemp); concatTransformerGraphic(gr,nil, gr->GetTransformer(), &ttemp); getExtentGraphic( gr, te._left, te._bottom, te._cx, te._cy, te._tol, &gstemp ); e.Merge(te); } cacheExtent(e._left, e._bottom, e._cx, e._cy, e._tol); gstemp.SetTransformer(nil); // to avoid deleting ttemp explicitly } } right = 2*e._cx - e._left; top = 2*e._cy - e._bottom; transformRect(e._left, e._bottom, right, top, l, b, dummy1, dummy2, gs); transform(e._cx, e._cy, cx, cy, gs); tol = e._tol; }
void LinkComp::Write (ostream& out) { GraphicComp::Write(out); Line* line = GetLine(); WriteTransformer(line->GetTransformer(), out); unidraw->GetCatalog()->WriteComponent(_conn1, out); unidraw->GetCatalog()->WriteComponent(_conn2, out); Graphic* parent = line->Parent(); WriteBgFilled(parent->BgFilled(), out); WriteColor(parent->GetFgColor(), out); WriteColor(parent->GetBgColor(), out); WriteBrush(parent->GetBrush(), out); WriteTransformer(parent->GetTransformer(), out); }