本文整理汇总了C++中Transformer::InvTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::InvTransform方法的具体用法?C++ Transformer::InvTransform怎么用?C++ Transformer::InvTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformer
的用法示例。
在下文中一共展示了Transformer::InvTransform方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invTransform
void Graphic::invTransform (Coord& tx, Coord& ty, Graphic* g) {
Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer();
if (t != nil) {
t->InvTransform(tx, ty);
}
}
示例2: InterpretManipulator
Command* TextOvView::InterpretManipulator (Manipulator* m) {
Viewer* v = m->GetViewer();
Editor* ed = v->GetEditor();
Tool* tool = m->GetTool();
Command* cmd = nil;
if (tool->IsA(GRAPHIC_COMP_TOOL) || tool->IsA(RESHAPE_TOOL)) {
TextManip* tm = (TextManip*) m;
int size;
const char* text = tm->GetText(size);
if (size == 0) {
if (tool->IsA(RESHAPE_TOOL)) {
cmd = new OvDeleteCmd(ed);
} else {
v->Update(); // to repair text display-incurred damage
}
} else {
Coord xpos, ypos;
tm->GetPosition(xpos, ypos);
Painter* p = tm->GetPainter();
Transformer* rel = tm->GetPainter()->GetTransformer();
int lineHt = tm->GetLineHeight();
Graphic* pg = GetGraphicComp()->GetGraphic();
TextGraphic* textgr = new TextGraphic(text, lineHt, pg);
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
textgr->SetTransformer(nil);
}
if (rel != nil) {
if (v->GetOrientation()==Rotated && !tool->IsA(RESHAPE_TOOL))
rel->Rotate(-90);
rel->InvTransform(xpos, ypos);
}
if (v->GetOrientation()==Rotated && !tool->IsA(RESHAPE_TOOL))
textgr->Rotate(90.0);
textgr->Translate(xpos, ypos);
textgr->FillBg(false);
textgr->SetFont((PSFont*) p->GetFont());
textgr->SetColors((PSColor*) p->GetFgColor(), nil);
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
cmd = new PasteCmd(ed, new Clipboard(new TextOvComp(textgr)));
} else {
cmd = new ReplaceCmd(ed, new TextOvComp(textgr));
}
}
} else {
cmd = OverlayView::InterpretManipulator(m);
}
return cmd;
}
示例3: PlaceTextDisplay
void TextManip::PlaceTextDisplay (Coord xpos, Coord ypos) {
GetViewer()->InitTextDisplay(_display, _painter);
Transformer* rel = _painter->GetTransformer();
if (rel != nil) rel->InvTransform(xpos, ypos);
int l = xpos;
int r = l + _display->Width();
int t = ypos + _lineHt-1;
int b = t - _display->Height();
_display->Resize(l, b, r, t);
}
示例4: Contains
boolean TextManip::Contains (Coord x, Coord y) {
Transformer* rel = _painter->GetTransformer();
if (rel != nil) rel->InvTransform(x, y);
int line = _display->LineNumber(y);
int index = _display->LineIndex(line, x);
return
x >= _display->Left(line, _text->BeginningOfLine(index)) &&
x <= _display->Right(line, _text->EndOfLine(index)) &&
y >= _display->Base(line) &&
y <= _display->Top(line);
}
示例5: Locate
int TextManip::Locate (Coord x, Coord y) {
Transformer* rel = _painter->GetTransformer();
if (rel != nil) rel->InvTransform(x, y);
int line = _display->LineNumber(y);
int index = _display->LineIndex(line, x);
int l = _text->LineIndex(line);
int i = 0;
while (i < index) {
l = _text->NextCharacter(l);
i += 1;
}
return l;
}
示例6: contains
bool SFH_ClosedBSpline::contains (PointObj& po, Graphic* gs) {
const Coord *x, *y;
int count = GetOriginal(x, y);
Transformer* t = gs->GetTransformer();
if (t != nil) {
t->InvTransform(po._x, po._y);
}
for (int i = 0; i < count; i++) {
if (x[i] == po._x && y[i] == po._y) {
return true;
}
}
return SF_ClosedBSpline::contains(po, gs);
}
示例7:
void Graphic31::scale (float sx, float sy, float cx, float cy) {
float ncx, ncy;
if (sx != 1.0 || sy != 1.0) {
if (_t == nil) {
_t = new Transformer;
}
Transformer parents;
parentXform(parents);
parents.InvTransform(cx, cy, ncx, ncy);
if (ncx != 0 || ncy != 0) {
_t->translate(-ncx, -ncy);
_t->scale(sx, sy);
_t->translate(ncx, ncy);
} else {
_t->scale(sx, sy);
}
}
}
示例8: Scale
void Graphic::Scale (float sx, float sy, float cx, float cy) {
float ncx, ncy;
if (sx != 1 || sy != 1) {
if (_t == nil) {
_t = new Transformer;
}
Transformer parents;
parentXform(parents);
parents.InvTransform(cx, cy, ncx, ncy);
if (ncx != 0 || ncy != 0) {
_t->Translate(-ncx, -ncy);
_t->Scale(sx, sy);
_t->Translate(ncx, ncy);
} else {
_t->Scale(sx, sy);
}
uncacheParents();
}
}
示例9: InterpretManipulator
Command* LinkView::InterpretManipulator (Manipulator* m) {
DragManip* dm = (DragManip*) m;
Editor* ed = dm->GetViewer()->GetEditor();
Tool* tool = dm->GetTool();
Transformer* rel = dm->GetTransformer();
Command* cmd = nil;
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
cmd = InterpLinkCompManip(dm);
} else if (tool->IsA(MOVE_TOOL)) {
SlidingLine* sl;
Coord x0, y0, x1, y1, dummy1, dummy2;
float fx0, fy0, fx1, fy1;
sl = (SlidingLine*) dm->GetRubberband();
sl->GetOriginal(x0, y0, dummy1, dummy2);
sl->GetCurrent(x1, y1, dummy1, dummy2);
if (rel != nil) {
rel->InvTransform(float(x0), float(y0), fx0, fy0);
rel->InvTransform(float(x1), float(y1), fx1, fy1);
}
cmd = new MoveCmd(ed, fx1-fx0, fy1-fy0);
} else if (tool->IsA(SCALE_TOOL)) {
ScalingLine* sl = (ScalingLine*) dm->GetRubberband();
float sxy = sl->CurrentScaling();
cmd = new ScaleCmd(ed, sxy, sxy);
} else if (tool->IsA(ROTATE_TOOL)) {
RotatingLine* rl = (RotatingLine*) dm->GetRubberband();
float angle = rl->CurrentAngle() - rl->OriginalAngle();
cmd = new RotateCmd(ed, angle);
}
return cmd;
}
示例10: InterpretManipulator
Command* LineView::InterpretManipulator (Manipulator* m) {
DragManip* dm = (DragManip*) m;
Editor* ed = dm->GetViewer()->GetEditor();
Tool* tool = dm->GetTool();
Transformer* rel = dm->GetTransformer();
Command* cmd = nil;
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
RubberLine* rl = (RubberLine*) dm->GetRubberband();
Coord x0, y0, x1, y1;
rl->GetCurrent(x0, y0, x1, y1);
if (x0 != x1 || y0 != y1) {
BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar");
ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar");
if (rel != nil) {
rel = new Transformer(rel);
rel->Invert();
}
Graphic* pg = GetGraphicComp()->GetGraphic();
Line* line = new Line(x0, y0, x1, y1, pg);
if (brVar != nil) line->SetBrush(brVar->GetBrush());
if (colVar != nil) {
line->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
}
line->SetTransformer(rel);
Unref(rel);
cmd = new PasteCmd(ed, new Clipboard(new LineComp(line)));
}
} else if (tool->IsA(MOVE_TOOL)) {
Coord x0, y0, x1, y1, dummy1, dummy2;
float fx0, fy0, fx1, fy1;
SlidingLine* sl = (SlidingLine*) dm->GetRubberband();
sl->GetOriginal(x0, y0, dummy1, dummy2);
sl->GetCurrent(x1, y1, dummy1, dummy2);
if (rel != nil) {
rel->InvTransform(float(x0), float(y0), fx0, fy0);
rel->InvTransform(float(x1), float(y1), fx1, fy1);
}
cmd = new MoveCmd(ed, fx1 - fx0, fy1 - fy0);
} else if (tool->IsA(SCALE_TOOL)) {
ScalingLine* sl = (ScalingLine*) dm->GetRubberband();
float sxy = sl->CurrentScaling();
cmd = new ScaleCmd(ed, sxy, sxy);
} else if (tool->IsA(ROTATE_TOOL)) {
RotatingLine* rl = (RotatingLine*) dm->GetRubberband();
float angle = rl->CurrentAngle() - rl->OriginalAngle();
cmd = new RotateCmd(ed, angle);
} else if (tool->IsA(RESHAPE_TOOL)) {
RubberLine* rl = (RubberLine*) dm->GetRubberband();
Coord x0, y0, x1, y1;
rl->GetCurrent(x0, y0, x1, y1);
if (rel != nil) {
rel = new Transformer(rel);
rel->Invert();
}
Line* line = new Line(x0, y0, x1, y1, GetGraphic());
line->SetTransformer(rel);
Unref(rel);
cmd = new ReplaceCmd(ed, new LineComp(line));
} else {
cmd = GraphicView::InterpretManipulator(m);
}
return cmd;
}
示例11: InterpretManipulator
Command* RectView::InterpretManipulator (Manipulator* m) {
DragManip* dm = (DragManip*) m;
Editor* ed = dm->GetViewer()->GetEditor();
Tool* tool = dm->GetTool();
Transformer* rel = dm->GetTransformer();
Command* cmd = nil;
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
RubberRect* rr = (RubberRect*) dm->GetRubberband();
Coord x0, y0, x1, y1;
rr->GetCurrent(x0, y0, x1, y1);
if (x0 != x1 || y0 != y1) {
BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar");
PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar");
ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar");
if (rel != nil) {
rel = new Transformer(rel);
rel->Invert();
}
Graphic* pg = GetGraphicComp()->GetGraphic();
SF_Rect* rect = new SF_Rect(x0, y0, x1, y1, pg);
if (brVar != nil) rect->SetBrush(brVar->GetBrush());
if (patVar != nil) rect->SetPattern(patVar->GetPattern());
if (colVar != nil) {
rect->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
}
rect->SetTransformer(rel);
Unref(rel);
cmd = new PasteCmd(ed, new Clipboard(new RectComp(rect)));
}
} else if (tool->IsA(RESHAPE_TOOL)) {
RubberGroup* rubberGroup = (RubberGroup*) dm->GetRubberband();
RubberLine* rubberLine = (RubberLine*) rubberGroup->First();
SF_Polygon* polygon;
Coord x[4], y[4];
Coord x0, y0;
GetCorners(x, y);
rubberLine->GetCurrent(x0, y0, x[_reshapeCorner], y[_reshapeCorner]);
if (rel != nil) {
rel = new Transformer(rel);
rel->Invert();
}
polygon = new SF_Polygon(x, y, 4, GetGraphic());
polygon->SetTransformer(rel);
Unref(rel);
cmd = new ReplaceCmd(ed, new PolygonComp(polygon));
} else if (tool->IsA(MOVE_TOOL)) {
SlidingLineList* sll;
Transformer* rel = dm->GetTransformer();
Coord* ox, *oy, *cx, *cy;
float fx0, fy0, fx1, fy1;
int n;
sll = (SlidingLineList*) dm->GetRubberband();
sll->GetOriginal(ox, oy, n);
sll->GetCurrent(cx, cy, n);
if (rel != nil) {
rel->InvTransform(float(ox[0]), float(oy[0]), fx0, fy0);
rel->InvTransform(float(cx[0]), float(cy[0]), fx1, fy1);
}
delete ox; delete oy; delete cx; delete cy;
cmd = new MoveCmd(ed, fx1 - fx0, fy1 - fy0);
} else if (tool->IsA(SCALE_TOOL)) {
ScalingLineList* sll = (ScalingLineList*) dm->GetRubberband();
float sxy = sll->CurrentScaling();
cmd = new ScaleCmd(ed, sxy, sxy);
} else if (tool->IsA(ROTATE_TOOL)) {
RotatingLineList* rll = (RotatingLineList*) dm->GetRubberband();
float angle = rll->CurrentAngle() - rll->OriginalAngle();
cmd = new RotateCmd(ed, angle);
} else {
cmd = GraphicView::InterpretManipulator(m);
}
return cmd;
}