本文整理汇总了C++中Transformer::Translate方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::Translate方法的具体用法?C++ Transformer::Translate怎么用?C++ Transformer::Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformer
的用法示例。
在下文中一共展示了Transformer::Translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterpGraphicCompManip
Command* PinView::InterpGraphicCompManip (Manipulator* m) {
DragManip* dm = (DragManip*) m;
Editor* ed = dm->GetViewer()->GetEditor();
BrushVar* brVar = (BrushVar*) ed->GetState("Brush");
SlidingPin* sp = (SlidingPin*) dm->GetRubberband();
Transformer* rel = dm->GetTransformer();
Coord px, py, dum;
float dx, dy;
PinGraphic* pinGraphic;
sp->GetCurrent(px, py, dum, dum);
if (rel != nil) {
GetOffset(rel, px, py, dx, dy);
rel = new Transformer;
rel->Translate(dx, dy);
}
Graphic* pg = GetGraphicComp()->GetGraphic();
pinGraphic = new PinGraphic(px, py, pg);
if (brVar != nil) pinGraphic->SetBrush(brVar->GetBrush());
pinGraphic->SetTransformer(rel);
Unref(rel);
return new PasteCmd(ed, new Clipboard(NewSubject(pinGraphic)));
}
示例2: execute
void CreateRasterFunc::execute() {
const int x0 = 0;
const int y0 = 1;
const int x1 = 2;
const int y1 = 3;
const int n = 4;
int coords[n];
ComValue& vect = stack_arg(0);
if (!vect.is_type(ComValue::ArrayType) || vect.array_len() != n) {
reset_stack();
push_stack(ComValue::nullval());
return;
}
ALIterator i;
AttributeValueList* avl = vect.array_val();
avl->First(i);
for (int j=0; j<n && !avl->Done(i); j++) {
coords[j] = avl->GetAttrVal(i)->int_val();
avl->Next(i);
}
AttributeList* al = stack_keys();
Resource::ref(al);
reset_stack();
PasteCmd* cmd = nil;
if (coords[x0] != coords[x1] || coords[y0] != coords[y1]) {
float dcoords[n];
((OverlayViewer*)GetEditor()->GetViewer())->ScreenToDrawing
(coords[x0], coords[y0], dcoords[x0], dcoords[y0]);
((OverlayViewer*)GetEditor()->GetViewer())->ScreenToDrawing
(coords[x1], coords[y1], dcoords[x1], dcoords[y1]);
OverlayRaster* raster =
new OverlayRaster((int)(dcoords[x1]-dcoords[x0]+1),
(int)(dcoords[y1]-dcoords[y0]+1),
2 /* initialize with border of 2 */);
OverlayRasterRect* rasterrect = new OverlayRasterRect(raster, stdgraphic);
#if 1
Transformer* t = new Transformer();
t->Translate(dcoords[x0], dcoords[y0]);
rasterrect->SetTransformer(t);
Unref(t);
#else
Transformer* rel = get_transformer(al);
#endif
RasterOvComp* comp = new RasterOvComp(rasterrect);
comp->SetAttributeList(al);
if (PasteModeFunc::paste_mode()==0)
cmd = new PasteCmd(_ed, new Clipboard(comp));
ComValue compval(new OverlayViewRef(comp), symbol_add("RasterComp"));
push_stack(compval);
execute_log(cmd);
} else
push_stack(ComValue::nullval());
Unref(al);
}