本文整理汇总了C++中TRectD::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ TRectD::isEmpty方法的具体用法?C++ TRectD::isEmpty怎么用?C++ TRectD::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRectD
的用法示例。
在下文中一共展示了TRectD::isEmpty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertWorldToRaster
TRect TRasterImageUtils::convertWorldToRaster(const TRectD &area, const TRasterImageP ri)
{
if (area.isEmpty())
return TRect();
if (!ri || !ri->getRaster())
return TRect(tfloor(area.x0), tfloor(area.y0), tfloor(area.x1) - 1, tfloor(area.y1) - 1);
TRasterP ras = ri->getRaster();
TRectD rect(area + ras->getCenterD());
return TRect(tfloor(rect.x0), tfloor(rect.y0), tceil(rect.x1) - 1, tceil(rect.y1) - 1);
}
示例2: invalidate
void TTool::invalidate(const TRectD &rect) {
if (m_viewer) {
if (rect.isEmpty())
m_viewer->GLInvalidateAll();
else {
TPointD dpiScale(1, 1);
TXshSimpleLevel *sl =
getApplication()->getCurrentLevel()->getSimpleLevel();
if (sl) dpiScale = getCurrentDpiScale(sl, getCurrentFid());
m_viewer->GLInvalidateRect(getCurrentColumnMatrix() *
TScale(dpiScale.x, dpiScale.y) * rect);
}
}
}
示例3: doGetBBox
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info) {
if (m_warped.isConnected()) {
int ret = m_warped->doGetBBox(frame, bBox, info);
if (ret && !bBox.isEmpty()) {
if (bBox != TConsts::infiniteRectD) {
WarpParams params;
params.m_intensity = m_intensity->getValue(frame);
bBox = bBox.enlarge(getWarpRadius(params));
}
return true;
}
}
bBox = TRectD();
return false;
}
示例4: doGetBBox
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &rs) {
TRectD up_bx;
const bool up_sw =
(m_up.isConnected() ? m_up->doGetBBox(frame, up_bx, rs) : false);
TRectD dn_bx;
const bool dn_sw =
(m_down.isConnected() ? m_down->doGetBBox(frame, dn_bx, rs) : false);
if (up_sw && dn_sw) {
bBox = up_bx + dn_bx;
return !bBox.isEmpty();
} else if (up_sw) {
bBox = up_bx;
return true;
} else if (dn_sw) {
bBox = dn_bx;
return true;
} else {
bBox = TRectD();
return false;
}
}
示例5: doGetBBox
bool TExternalProgramFx::doGetBBox(double frame, TRectD &bBox,
const TRenderSettings &info) {
// bBox = TRectD(-30,-30,30,30);
// return true;
std::map<std::string, Port>::const_iterator portIt;
for (portIt = m_ports.begin(); portIt != m_ports.end(); ++portIt) {
if (portIt->second.m_port != 0) {
TRasterFxPort *tmp;
tmp = portIt->second.m_port;
if (tmp->isConnected()) {
TRectD tmpbBox;
(*tmp)->doGetBBox(frame, tmpbBox, info);
bBox += tmpbBox;
}
}
}
if (bBox.isEmpty()) {
bBox = TRectD();
return false;
} else
return true;
/*
if(m_input1.isConnected() || m_input2.isConnected())
{
bool ret = m_input1->doGetBBox(frame, bBox) || m_input1->doGetBBox(frame, bBox);
return ret;
}
else
{
bBox = TRectD();
return false;
}
*/
}
示例6: applyAutoclose
/*-- AutoCloseが実行されたらtrue,実行されなければfalseを返す --*/
bool applyAutoclose(const TToonzImageP &ti, const TRectD &selRect = TRectD(),
TStroke *stroke = 0) {
if (!ti) return false;
// inizializzo gli AutocloseParameters
AutocloseParameters params;
params.m_closingDistance = (int)(m_distance.getValue());
params.m_spotAngle = (int)(m_angle.getValue());
params.m_opacity = m_opacity.getValue();
std::string inkString = ::to_string(m_inkIndex.getValue());
int inkIndex =
TTool::getApplication()
->getCurrentLevelStyleIndex(); // TApp::instance()->getCurrentPalette()->getStyleIndex();
if (isInt(inkString)) inkIndex = std::stoi(inkString);
params.m_inkIndex = inkIndex;
TPoint delta;
TRasterCM32P ras, raux = ti->getRaster();
if (m_closeType.getValue() == RECT_CLOSE && raux && !selRect.isEmpty()) {
TRectD selArea = selRect;
if (selRect.x0 > selRect.x1) {
selArea.x1 = selRect.x0;
selArea.x0 = selRect.x1;
}
if (selRect.y0 > selRect.y1) {
selArea.y1 = selRect.y0;
selArea.y0 = selRect.y1;
}
TRect myRect(ToonzImageUtils::convertWorldToRaster(selArea, ti));
ras = raux->extract(myRect);
delta = myRect.getP00();
} else if ((m_closeType.getValue() == FREEHAND_CLOSE ||
m_closeType.getValue() == POLYLINE_CLOSE) &&
stroke) {
TRectD selArea = stroke->getBBox();
TRect myRect(ToonzImageUtils::convertWorldToRaster(selArea, ti));
ras = raux->extract(myRect);
delta = myRect.getP00();
} else
ras = raux;
if (!ras) return false;
TAutocloser ac(ras, params.m_closingDistance, params.m_spotAngle,
params.m_inkIndex, params.m_opacity);
std::vector<TAutocloser::Segment> segments;
ac.compute(segments);
if ((m_closeType.getValue() == FREEHAND_CLOSE ||
m_closeType.getValue() == POLYLINE_CLOSE) &&
stroke)
checkSegments(segments, stroke, raux, delta);
std::vector<TAutocloser::Segment> segments2(segments);
/*-- segmentが取得できなければfalseを返す --*/
if (segments2.empty()) return false;
int i;
if (delta != TPoint(0, 0))
for (i = 0; i < (int)segments2.size(); i++) {
segments2[i].first += delta;
segments2[i].second += delta;
}
TTileSetCM32 *tileSet = new TTileSetCM32(raux->getSize());
for (i = 0; i < (int)segments2.size(); i++) {
TRect bbox(segments2[i].first, segments2[i].second);
bbox = bbox.enlarge(2);
tileSet->add(raux, bbox);
}
TXshSimpleLevel *sl =
TTool::getApplication()->getCurrentLevel()->getSimpleLevel();
TFrameId id = getCurrentFid();
TUndoManager::manager()->add(
new RasterAutocloseUndo(tileSet, params, segments2, sl, id));
ac.draw(segments);
ToolUtils::updateSaveBox();
return true;
}
示例7: render_particles
//.........这里部分代码省略.........
* /birth_rateが小数だったとき、各フレームの小数部分を足しこんだ結果の整数部分をintpartに渡す。
* -*/
fractpart = fractpart + values.maxnum_val - intpart;
if ((int)fractpart) {
values.maxnum_val += (int)fractpart;
fractpart = fractpart - (int)fractpart;
}
std::map<int, TTile *> porttiles;
// Perform the roll
/*- RenderSettingsを複製して現在のフレームの計算用にする -*/
TRenderSettings riAux(ri);
riAux.m_affine = TAffine();
riAux.m_bpp = 32;
int r_frame; // Useful in case of negative roll frames
if (frame < 0)
r_frame = 0;
else
r_frame = frame;
/*- 出力画像のバウンディングボックス -*/
TRectD outTileBBox(tile->m_pos, TDimensionD(tile->getRaster()->getLx(),
tile->getRaster()->getLy()));
/*- Controlに刺さっている各ポートについて -*/
for (std::map<int, TRasterFxPort *>::iterator it = ctrl_ports.begin();
it != ctrl_ports.end(); ++it) {
TTile *tmp;
/*- ポートが接続されていて、Fx内で実際に使用されていたら -*/
if ((it->second)->isConnected() && port_is_used(it->first, values)) {
TRectD bbox;
(*(it->second))->getBBox(r_frame, bbox, riAux);
/*- 素材が存在する場合、portTilesにコントロール画像タイルを格納 -*/
if (!bbox.isEmpty()) {
if (bbox == TConsts::infiniteRectD) // There could be an infinite
// bbox - deal with it
bbox = ri.m_affine.inv() * outTileBBox;
if (frame <= pcFrame) {
// This frame will not actually be rolled. However, it was
// dryComputed - so, declare the same here.
(*it->second)->dryCompute(bbox, r_frame, riAux);
} else {
tmp = new TTile;
if (isPrecomputingEnabled)
(*it->second)
->allocateAndCompute(*tmp, bbox.getP00(),
convert(bbox).getSize(), 0, r_frame,
riAux);
else {
std::string alias =
"CTRL: " + (*(it->second))->getAlias(r_frame, riAux);
TRasterImageP rimg = TImageCache::instance()->get(alias, false);
if (rimg) {
tmp->m_pos = bbox.getP00();
tmp->setRaster(rimg->getRaster());
} else {
(*it->second)
->allocateAndCompute(*tmp, bbox.getP00(),
convert(bbox).getSize(), 0, r_frame,
riAux);
addRenderCache(alias, TRasterImageP(tmp->getRaster()));
}