本文整理汇总了C++中TXsheet::getCells方法的典型用法代码示例。如果您正苦于以下问题:C++ TXsheet::getCells方法的具体用法?C++ TXsheet::getCells怎么用?C++ TXsheet::getCells使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TXsheet
的用法示例。
在下文中一共展示了TXsheet::getCells方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canMergeColumns
static bool canMergeColumns(int column, int mColumn, bool forMatchlines) {
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
if (xsh->getColumn(column)->isLocked()) return false;
int start, end;
xsh->getCellRange(column, start, end);
if (start > end) return false;
std::vector<TXshCell> cell(end - start + 1);
std::vector<TXshCell> mCell(end - start + 1);
xsh->getCells(start, column, cell.size(), &(cell[0]));
xsh->getCells(start, mColumn, cell.size(), &(mCell[0]));
TXshSimpleLevel *level = 0, *mLevel = 0;
TXshLevelP xl;
for (int i = 0; i < (int)cell.size(); i++) {
if (cell[i].isEmpty() || mCell[i].isEmpty()) continue;
if (!level) {
level = cell[i].getSimpleLevel();
xl = cell[i].m_level;
}
else if (level != cell[i].getSimpleLevel())
return false;
if (!mLevel)
mLevel = mCell[i].getSimpleLevel();
else if (mLevel != mCell[i].getSimpleLevel())
return false;
if (!mLevel || !level || // potrebbero non essere dei simplelevel
(forMatchlines && (level->getType() != TZP_XSHLEVEL ||
mLevel->getType() != TZP_XSHLEVEL)))
return false;
else if (!forMatchlines) {
if (level->getType() != mLevel->getType()) return false;
if (level->getType() != PLI_XSHLEVEL && level->getType() != OVL_XSHLEVEL)
return false;
// Check level type write support. Based on TTool::updateEnabled()
if (level->getType() == OVL_XSHLEVEL &&
(level->getPath().getType() == "psd" || // PSD files.
level->is16BitChannelLevel() || // 16bpc images.
level->getProperties()->getBpp() == 1)) { // Black & White images.
return false;
}
}
}
return true;
}
示例2: getCells
void CellsMover::getCells(std::vector<TXshCell> &cells, int r, int c) const {
for (int i = 0; i < (int)cells.size(); i++) cells[i] = TXshCell();
TXsheet *xsh = getXsheet();
for (int i = 0; i < m_colCount; i++) {
TXshColumn *column = xsh->getColumn(c + i);
if (column && column->isLocked()) continue;
xsh->getCells(r, c + i, m_rowCount, &cells[m_rowCount * i]);
}
}
示例3: canMergeColumns
bool canMergeColumns(int column, int mColumn, bool forMatchlines) {
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int start, end;
xsh->getCellRange(column, start, end);
if (start > end) return false;
std::vector<TXshCell> cell(end - start + 1);
std::vector<TXshCell> mCell(end - start + 1);
xsh->getCells(start, column, cell.size(), &(cell[0]));
xsh->getCells(start, mColumn, cell.size(), &(mCell[0]));
TXshSimpleLevel *level = 0, *mLevel = 0;
TXshLevelP xl;
for (int i = 0; i < (int)cell.size(); i++) {
if (cell[i].isEmpty() || mCell[i].isEmpty()) continue;
if (!level) {
level = cell[i].getSimpleLevel();
xl = cell[i].m_level;
}
else if (level != cell[i].getSimpleLevel())
return false;
if (!mLevel)
mLevel = mCell[i].getSimpleLevel();
else if (mLevel != mCell[i].getSimpleLevel())
return false;
if (!mLevel || !level || // potrebbero non essere dei simplelevel
(forMatchlines && (level->getType() != TZP_XSHLEVEL ||
mLevel->getType() != TZP_XSHLEVEL)))
return false;
else if (!forMatchlines) {
if (level->getType() != mLevel->getType()) return false;
if (level->getType() != PLI_XSHLEVEL && level->getType() != OVL_XSHLEVEL)
return false;
}
}
return true;
}
示例4: mergeColumns
void mergeColumns(int column, int mColumn, bool isRedo)
{
MergeColumnsSessionId++;
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int start, end;
xsh->getCellRange(column, start, end);
if (start > end)
return;
vector<TXshCell> cell(end - start + 1);
vector<TXshCell> mCell(end - start + 1);
xsh->getCells(start, column, cell.size(), &(cell[0]));
xsh->getCells(start, mColumn, cell.size(), &(mCell[0]));
TXshColumn *col = xsh->getColumn(column);
TXshColumn *mcol = xsh->getColumn(mColumn);
vector<MatchlinePair> matchingLevels;
std::set<TFrameId> alreadyDoneSet;
TXshSimpleLevel *level = 0, *mLevel = 0;
TXshLevelP xl;
bool areRasters = false;
std::map<TFrameId, QString> images;
for (int i = 0; i < (int)cell.size(); i++) {
if (cell[i].isEmpty() || mCell[i].isEmpty())
continue;
if (!level) {
level = cell[i].getSimpleLevel();
xl = cell[i].m_level;
}
else if (level != cell[i].getSimpleLevel()) {
MsgBox(WARNING, QObject::tr("It is not possible to perform a merging involving more than one level per column."));
return;
}
if (!mLevel)
mLevel = mCell[i].getSimpleLevel();
else if (mLevel != mCell[i].getSimpleLevel()) {
MsgBox(WARNING, QObject::tr("It is not possible to perform a merging involving more than one level per column."));
return;
}
TImageP img = cell[i].getImage(true);
TImageP match = mCell[i].getImage(false);
TFrameId fid = cell[i].m_frameId;
TFrameId mFid = mCell[i].m_frameId;
if (!img || !match)
continue;
if (alreadyDoneSet.find(fid) == alreadyDoneSet.end()) {
TRasterImageP timg = (TRasterImageP)img;
TRasterImageP tmatch = (TRasterImageP)match;
TVectorImageP vimg = (TVectorImageP)img;
TVectorImageP vmatch = (TVectorImageP)match;
if (timg) {
if (!tmatch) {
MsgBox(WARNING, QObject::tr("Only raster levels can be merged to a raster level."));
return;
}
areRasters = true;
} else if (vimg) {
if (!vmatch) {
MsgBox(WARNING, QObject::tr("Only vector levels can be merged to a vector level."));
return;
}
} else {
MsgBox(WARNING, QObject::tr("It is possible to merge only Toonz vector levels or standard raster levels."));
return;
}
QString id = "MergeColumnsUndo" + QString::number(MergeColumnsSessionId) + "-" + QString::number(fid.getNumber());
TImageCache::instance()->add(id, (timg) ? timg->cloneImage() : vimg->cloneImage());
images[fid] = id;
TAffine imgAff, matchAff;
getColumnPlacement(imgAff, xsh, start + i, column, false);
getColumnPlacement(matchAff, xsh, start + i, mColumn, false);
TAffine dpiAff = getDpiAffine(level, fid);
TAffine mdpiAff = getDpiAffine(mLevel, mFid);
matchingLevels.push_back(MatchlinePair(cell[i], imgAff * dpiAff, mCell[i], matchAff * mdpiAff));
alreadyDoneSet.insert(fid);
}
}
if (matchingLevels.empty()) {
MsgBox(WARNING, QObject::tr("It is possible to merge only Toonz vector levels or standard raster levels."));
return;
}
ToonzScene *sc = TApp::instance()->getCurrentScene()->getScene();
TXshSimpleLevel *simpleLevel = sc->getLevelSet()->getLevel(column)->getSimpleLevel();
if (!isRedo)
//.........这里部分代码省略.........
示例5: mergeCmapped
void mergeCmapped(int column, int mColumn, const QString &fullpath, bool isRedo)
{
static int MergeCmappedSessionId = 0;
MergeCmappedSessionId++;
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
int start, end;
int mStart, mEnd;
xsh->getCellRange(column, start, end);
xsh->getCellRange(mColumn, mStart, mEnd);
if (start > end)
return;
vector<TXshCell> cell(max(end, mEnd) - min(start, mStart) + 1);
vector<TXshCell> mCell(cell.size());
xsh->getCells(min(start, mStart), column, cell.size(), &(cell[0]));
if (mColumn != -1)
xsh->getCells(min(start, mStart), mColumn, cell.size(), &(mCell[0]));
TXshColumn *col = xsh->getColumn(column);
TXshColumn *mcol = xsh->getColumn(mColumn);
vector<MergeCmappedPair> matchingLevels;
std::map<MergedPair, TFrameId> computedMergedMap;
TXshSimpleLevel *level = 0, *mLevel = 0;
TXshLevel *xl;
std::map<TFrameId, QString> images;
double dpix = 0, dpiy = 0;
for (int i = 0; i < (int)cell.size(); i++) {
if (!cell[i].isEmpty() && dpix == 0)
((TToonzImageP)(cell[i].getImage(false)))->getDpi(dpix, dpiy);
if (!level) {
level = cell[i].getSimpleLevel();
xl = cell[i].m_level.getPointer();
}
if (!mLevel)
mLevel = mCell[i].getSimpleLevel();
}
if (!level || !mLevel)
return;
TFilePath fp(fullpath.toStdString());
TXshLevel *txl = level->getScene()->createNewLevel(level->getType(), fp.getWideName(), level->getResolution());
TXshSimpleLevel *newLevel = txl->getSimpleLevel();
newLevel->setPalette(level->getPalette());
newLevel->clonePropertiesFrom(level);
newLevel->setPath(fp);
TApp::instance()->getCurrentScene()->notifySceneChanged();
TApp::instance()->getCurrentScene()->notifyCastChange();
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
int count = 0;
for (int i = 0; i < (int)cell.size(); i++) {
if (cell[i].isEmpty() && mCell[i].isEmpty())
continue;
TAffine imgAff, matchAff;
getColumnPlacement(imgAff, xsh, min(start, mStart) + i, column, false);
getColumnPlacement(matchAff, xsh, min(start, mStart) + i, mColumn, false);
//std::map<TFrameId, TFrameId>::iterator it;
MergedPair mp(cell[i].isEmpty() ? TFrameId() : cell[i].getFrameId(),
mCell[i].isEmpty() ? TFrameId() : mCell[i].getFrameId(),
imgAff.inv() * matchAff);
std::map<MergedPair, TFrameId>::iterator computedMergedIt = computedMergedMap.find(mp);
if (computedMergedIt != computedMergedMap.end()) {
TXshCell newCell(newLevel, computedMergedIt->second);
xsh->setCell(i, column, newCell);
cell[i] = newCell;
continue;
}
TFrameId newFid(++count); //level->getLastFid().getNumber()+1);
TDimension dim = level->getResolution();
TToonzImageP newImage;
if (cell[i].isEmpty()) {
newImage = TToonzImageP(TRasterCM32P(dim), TRect(0, 0, dim.lx - 1, dim.ly - 1));
newImage->setDpi(dpix, dpiy);
} else
newImage = (TToonzImageP)(cell[i].getImage(false)->cloneImage());
newImage->setPalette(level->getPalette());
newLevel->setFrame(newFid, newImage);
TXshCell newCell(newLevel, newFid);
xsh->setCell(i, column, newCell);
computedMergedMap[mp] = newCell.getFrameId();
//.........这里部分代码省略.........