本文整理汇总了C++中Graphic::GetBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphic::GetBounds方法的具体用法?C++ Graphic::GetBounds怎么用?C++ Graphic::GetBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphic
的用法示例。
在下文中一共展示了Graphic::GetBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Align
void Viewer::Align (GraphicComp* comp, Alignment a) {
Graphic* g = comp->GetGraphic();
float cl, cb, cr, ct;
g->GetBounds(cl, cb, cr, ct);
Perspective* p = GetPerspective();
float mag = GetMagnification();
float vl = float(p->curx - p->x0) / mag;
float vb = float(p->cury - p->y0) / mag;
float vr = float(p->curx - p->x0 + p->curwidth - 1) / mag;
float vt = float(p->cury - p->y0 + p->curheight - 1) / mag;
float dx, dy;
switch (a) {
case TopLeft:
case CenterLeft:
case BottomLeft:
case Left:
dx = vl - cl;
break;
case TopCenter:
case Center:
case BottomCenter:
dx = (vr + vl - cr - cl) / 2;
break;
case TopRight:
case CenterRight:
case BottomRight:
case Right:
dx = vr - cr;
break;
}
switch (a) {
case TopLeft:
case TopCenter:
case TopRight:
case Top:
dy = vt - ct;
break;
case CenterLeft:
case Center:
case CenterRight:
dy = (vt + vb - ct - cb) / 2;
break;
case BottomLeft:
case BottomCenter:
case BottomRight:
case Bottom:
dy = vb - cb;
break;
}
MoveCmd mvcmd(GetEditor(), dx, dy);
comp->Interpret(&mvcmd);
}
示例2: Connect
void PadComp::Connect (Connector* target, CGlue* g) {
PadGraphic* padgr = GetPad();
float l, b, r, t;
padgr->GetBounds(l, b, r, t);
float h = (r - l)/2;
float v = (t - b)/2;
if (target->IsA(PIN_COMP)) {
CGlue padGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v);
padGlue.Interpose(g);
csolver->Connect(this, target, &padGlue);
Connector::Connect(target, &padGlue);
} else if (target->IsA(HSLOT_COMP)) {
Graphic* peergr = target->GetGraphic();
peergr->GetBounds(l, b, r, t);
h += (r - l)/2;
CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v);
slotGlue.Interpose(g);
csolver->Connect(this, target, &slotGlue);
Connector::Connect(target, &slotGlue);
} else if (target->IsA(VSLOT_COMP)) {
Graphic* peergr = target->GetGraphic();
peergr->GetBounds(l, b, r, t);
v += (t - b)/2;
CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v);
slotGlue.Interpose(g);
csolver->Connect(this, target, &slotGlue);
Connector::Connect(target, &slotGlue);
} else if (target->IsA(PAD_COMP)) {
Graphic* peergr = target->GetGraphic();
peergr->GetBounds(l, b, r, t);
h += (r - l)/2;
v += (t - b)/2;
CGlue padGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v);
padGlue.Interpose(g);
csolver->Connect(this, target, &padGlue);
Connector::Connect(target, &padGlue);
}
}