本文整理汇总了C++中TVectorImageP::getNearestStroke方法的典型用法代码示例。如果您正苦于以下问题:C++ TVectorImageP::getNearestStroke方法的具体用法?C++ TVectorImageP::getNearestStroke怎么用?C++ TVectorImageP::getNearestStroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVectorImageP
的用法示例。
在下文中一共展示了TVectorImageP::getNearestStroke方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TImageP
TStroke *PinchTool::getClosestStroke(const TPointD &pos, double &w) const
{
TVectorImageP vi = TImageP(getImage(false));
if (!vi)
return 0;
double dist = 0;
UINT index;
if (vi->getNearestStroke(pos, w, index, dist, true))
return vi->getStroke(index);
else
return 0;
}
示例2: leftButtonDown
void PinchTool::leftButtonDown(const TPointD &pos,
const TMouseEvent &event)
{
m_curr = m_down = pos;
if (!m_active &&
!m_selector.isSelected()) {
m_active = false;
assert(m_undo == 0);
StrokeDeformation *
deformation = m_deformation;
TVectorImageP
vi = TImageP(getImage(true));
if (!vi)
return;
m_active = true;
ContextStatus
*status = &m_status;
// reset status
status->init();
double
w,
dist2;
// find nearest stroke
if (vi->getNearestStroke(m_down,
w,
m_n,
dist2, true)) {
TStroke
*stroke = vi->getStroke(m_n);
assert(stroke && "Not valid stroke found!!!");
if (!stroke)
return;
updateStrokeStatus(stroke,
w);
// set parameters from sliders
updateInterfaceStatus(event);
deformation->activate(status);
// stroke can be changed (replaced by another) during deformation activate
if (TTool::getApplication()->getCurrentObject()->isSpline())
m_undo = new ToolUtils::UndoPath(getXsheet()->getStageObject(getObjectId())->getSpline());
else {
TXshSimpleLevel *sl = TTool::getApplication()->getCurrentLevel()->getSimpleLevel();
assert(sl);
TFrameId id = getCurrentFid();
m_undo = new UndoModifyStrokeAndPaint(sl, id, m_n);
}
}
}
m_selector.mouseDown(m_curr);
m_prev = m_curr;
invalidate();
}