本文整理汇总了C++中TXshSimpleLevel类的典型用法代码示例。如果您正苦于以下问题:C++ TXshSimpleLevel类的具体用法?C++ TXshSimpleLevel怎么用?C++ TXshSimpleLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TXshSimpleLevel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getCurrentFrame
int FilmstripFrameHeadGadget::getCurrentFrame() const
{
TXshSimpleLevel *level = m_filmstrip->getLevel();
if (!level)
return 0;
return level->guessIndex(TApp::instance()->getCurrentFrame()->getFid());
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:7,代码来源:frameheadgadget.cpp
示例2: updateCurrentLevelComboItem
void Filmstrip::updateWindowTitle() {
updateCurrentLevelComboItem();
TXshSimpleLevel *level = m_frames->getLevel();
QString levelName;
if (!level) {
parentWidget()->setWindowTitle(tr("Level Strip"));
return;
} else {
levelName = QString::fromStdWString(level->getName());
if (level->getProperties()->getDirtyFlag()) levelName += " *";
}
// parentWidget() is TPanel
parentWidget()->setWindowTitle(tr("Level: ") + levelName);
TFrameHandle *fh = TApp::instance()->getCurrentFrame();
if (fh->isEditingLevel() && fh->getFid().getNumber() >= 0)
levelName += QString(" [#") + QString::number(fh->getFid().getNumber()) +
QString("]");
m_chooseLevelCombo->setItemText(m_chooseLevelCombo->currentIndex(),
levelName);
}
开发者ID:jcome,项目名称:opentoonz,代码行数:26,代码来源:filmstrip.cpp
示例3: getLevel
void FilmstripFrames::drawFrameIcon(QPainter &p, const QRect &r, int index,
const TFrameId &fid, int flags) {
QPixmap pm;
TXshSimpleLevel *sl = getLevel();
if (sl) {
pm = IconGenerator::instance()->getIcon(sl, fid);
}
if (!pm.isNull()) {
p.drawPixmap(r.left(), r.top(), pm);
if (sl && sl->getType() == PLI_XSHLEVEL && flags & F_INBETWEEN_RANGE) {
int x1 = r.right();
int x0 = x1 - 12;
int y0 = r.top();
int y1 = r.bottom();
p.fillRect(x0, y0, x1 - x0 + 1, y1 - y0 + 1, QColor(180, 180, 180, 255));
p.setPen(Qt::black);
p.drawLine(x0 - 1, y0, x0 - 1, y1);
QPixmap inbetweenPixmap(
svgToPixmap(":Resources/filmstrip_inbetween.svg"));
p.drawPixmap(
x0 + 2,
y1 - inbetweenPixmap.height() / inbetweenPixmap.devicePixelRatio() -
3,
inbetweenPixmap);
}
} else {
// non riesco (per qualche ragione) a visualizzare l'icona
p.fillRect(r, QColor(255, 200, 200));
p.setPen(Qt::black);
p.drawText(r, tr("no icon"), QTextOption(Qt::AlignCenter));
}
}
开发者ID:jcome,项目名称:opentoonz,代码行数:34,代码来源:filmstrip.cpp
示例4: updateAllLinkedStyles
void StudioPaletteCmd::updateAllLinkedStyles(TPaletteHandle *paletteHandle,
TXsheetHandle *xsheetHandle) {
if (!xsheetHandle) return;
TXsheet *xsheet = xsheetHandle->getXsheet();
if (!xsheet) return;
ToonzScene *scene = xsheet->getScene();
if (!scene) return;
// emit signal only if something changed
bool somethingChanged = false;
StudioPalette *sp = StudioPalette::instance();
TLevelSet *levelSet = scene->getLevelSet();
for (int i = 0; i < levelSet->getLevelCount(); i++) {
TXshLevel *xl = levelSet->getLevel(i);
TXshSimpleLevel *sl = xl ? xl->getSimpleLevel() : 0;
if (!sl) continue;
TPalette *palette = sl->getPalette();
if (palette) {
somethingChanged = somethingChanged | sp->updateLinkedColors(palette);
if (sl->getType() == TZP_XSHLEVEL) {
std::vector<TFrameId> fids;
sl->getFids(fids);
std::vector<TFrameId>::iterator it;
for (it = fids.begin(); it != fids.end(); ++it) {
TFrameId fid = *it;
std::string id = sl->getImageId(fid);
}
}
}
}
if (!paletteHandle || !paletteHandle->getPalette()) return;
if (somethingChanged) paletteHandle->notifyColorStyleChanged();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:34,代码来源:studiopalettecmd.cpp
示例5: onXshLevelSwitched
void TApp::onXshLevelSwitched(TXshLevel *) {
TXshLevel *level = m_currentLevel->getLevel();
if (level) {
TXshSimpleLevel *simpleLevel = level->getSimpleLevel();
// Devo aggiornare la paletta corrente
if (simpleLevel) {
m_paletteController->getCurrentLevelPalette()->setPalette(
simpleLevel->getPalette());
// Se il nuovo livello selezionato e' un ovl,
// la paletta corrente e' una cleanup palette
// => setto come handle corrente quello della paletta di cleanup.
TPalette *currentPalette =
m_paletteController->getCurrentPalette()->getPalette();
if (simpleLevel->getType() == OVL_XSHLEVEL && currentPalette &&
currentPalette->isCleanupPalette())
m_paletteController->editCleanupPalette();
return;
}
TXshPaletteLevel *paletteLevel = level->getPaletteLevel();
if (paletteLevel) {
m_paletteController->getCurrentLevelPalette()->setPalette(
paletteLevel->getPalette());
return;
}
}
m_paletteController->getCurrentLevelPalette()->setPalette(0);
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:33,代码来源:tapp.cpp
示例6: onImageChanged
/*! Notify change of image in \b fid: update icon and notify level change.
*/
void TTool::notifyImageChanged(const TFrameId &fid) {
onImageChanged();
if (!m_application) return;
m_application->getCurrentScene()->setDirtyFlag(true);
if (m_application->getCurrentFrame()->isEditingLevel()) {
TXshLevel *xl = m_application->getCurrentLevel()->getLevel();
if (!xl) return;
TXshSimpleLevel *sl = xl->getSimpleLevel();
if (!sl) return;
sl->setDirtyFlag(true);
IconGenerator::instance()->invalidate(sl, fid);
IconGenerator::instance()->invalidateSceneIcon();
} else {
int row = m_application->getCurrentFrame()->getFrame();
int col = m_application->getCurrentColumn()->getColumnIndex();
if (col < 0) return;
TXsheet *xsh = m_application->getCurrentXsheet()->getXsheet();
if (!xsh) return;
TXshCell cell = xsh->getCell(row, col);
TXshSimpleLevel *sl = cell.getSimpleLevel();
if (sl) {
IconGenerator::instance()->invalidate(sl, fid);
IconGenerator::instance()->invalidateSceneIcon();
sl->setDirtyFlag(true);
}
}
m_application->getCurrentLevel()->notifyLevelChange();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:32,代码来源:tool.cpp
示例7: getImage
void StylePickerTool::mouseMove(const TPointD &pos, const TMouseEvent &e) {
if (!m_passivePick.getValue()) return;
/*--- PassiveにStyleを拾う機能 ---*/
PaletteController *controller =
TTool::getApplication()->getPaletteController();
TImageP image = getImage(false);
TToonzImageP ti = image;
TVectorImageP vi = image;
TXshSimpleLevel *level =
getApplication()->getCurrentLevel()->getSimpleLevel();
if ((!ti && !vi) || !level || !m_viewer->getGeometry().contains(pos)) {
controller->notifyStylePassivePicked(-1, -1, -1);
return;
}
int subsampling = level->getImageSubsampling(getCurrentFid());
StylePicker picker(image);
TPointD pickPos(TScale(1.0 / subsampling) * pos + TPointD(-0.5, -0.5));
int inkStyleId =
picker.pickStyleId(pickPos, getPixelSize() * getPixelSize(), 1);
int paintStyleId =
picker.pickStyleId(pickPos, getPixelSize() * getPixelSize(), 0);
int tone = picker.pickTone(pickPos);
controller->notifyStylePassivePicked(inkStyleId, paintStyleId, tone);
}
开发者ID:hvfrancesco,项目名称:opentoonz,代码行数:26,代码来源:stylepickertool.cpp
示例8: updateChooseLevelComboItems
/*! update combo items when the contents of scene cast are changed
*/
void Filmstrip::updateChooseLevelComboItems() {
// clear items
m_chooseLevelCombo->clear();
m_levels.clear();
std::map<TXshSimpleLevel *, TFrameId> new_workingFrames;
// correct and register items
ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
if (scene) {
std::vector<TXshLevel *> levels;
scene->getLevelSet()->listLevels(levels);
std::vector<TXshLevel *>::iterator it;
for (it = levels.begin(); it != levels.end(); ++it) {
// register only TLV and PLI
TXshSimpleLevel *sl = (*it)->getSimpleLevel();
if (sl) {
// register only used level in xsheet
if (!scene->getTopXsheet()->isLevelUsed(sl)) continue;
m_levels.push_back(sl);
// create new m_workingFrames map with the new levelset
TFrameId fId;
std::map<TXshSimpleLevel *, TFrameId>::iterator WFit =
m_workingFrames.find(sl);
if (WFit != m_workingFrames.end())
fId = WFit->second;
else
fId = sl->getFirstFid();
new_workingFrames.insert(std::make_pair(sl, fId));
QString levelName = QString::fromStdWString(sl->getName());
if (sl->getProperties()->getDirtyFlag()) levelName += " *";
// append the current working frame number to the item name
if (fId != sl->getFirstFid() && fId.getNumber() >= 0)
levelName +=
QString(" [#") + QString::number(fId.getNumber()) + QString("]");
m_chooseLevelCombo->addItem(levelName);
}
}
}
m_chooseLevelCombo->addItem(tr("- No Current Level -"));
// swap the list
m_workingFrames.clear();
m_workingFrames = new_workingFrames;
// synchronize the current index of combo to the current level
updateCurrentLevelComboItem();
}
开发者ID:jcome,项目名称:opentoonz,代码行数:59,代码来源:filmstrip.cpp
示例9: setCurrentFrame
void FilmstripFrameHeadGadget::setCurrentFrame(int index) const
{
TXshSimpleLevel *level = m_filmstrip->getLevel();
if (!level)
return;
TFrameId fid = level->index2fid(index);
if (fid >= TFrameId(1))
TApp::instance()->getCurrentFrame()->setFid(fid);
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:9,代码来源:frameheadgadget.cpp
示例10: undo
void undo() const
{
TXshSimpleLevel *sl = getLevel();
if (!sl)
return;
TRasterImageP ri = sl->getFrame(m_fid, true);
if (!ri)
return;
TRasterImageP oldRaster = TImageCache::instance()->get(m_rasId, false);
ri->getRaster()->copy(oldRaster->getRaster());
notify(sl);
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:13,代码来源:binarizepopup.cpp
示例11: redo
void redo() const
{
TXshSimpleLevel *sl = getLevel();
if (!sl)
return;
TRasterImageP ri = sl->getFrame(m_fid, true);
if (!ri)
return;
TRaster32P ras = ri->getRaster();
if (!ras)
return;
TBinarizer binarizer;
binarizer.enableAlpha(m_alphaEnabled);
binarizer.process(ras);
notify(sl);
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:16,代码来源:binarizepopup.cpp
示例12: item
int BinarizePopup::getSelectedFrames()
{
m_frames.clear();
TSelection *selection = TSelection::getCurrent();
TCellSelection *cellSelection;
TFilmstripSelection *filmstripSelection;
int count = 0;
if ((cellSelection = dynamic_cast<TCellSelection *>(selection))) {
std::set<TRasterImage *> images;
int r0, c0, r1, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
int c, r;
for (c = c0; c <= c1; c++) {
for (r = r0; r <= r1; r++) {
TXshCell cell = xsheet->getCell(r, c);
TRasterImageP rasImage = cell.getImage(false);
if (!rasImage || !rasImage->getRaster())
continue;
Frames::value_type item(cell.getSimpleLevel(), cell.getFrameId());
Frames::iterator it;
it = std::lower_bound(m_frames.begin(), m_frames.end(), item);
if (it == m_frames.end() || *it != item) {
m_frames.insert(it, item);
count++;
}
}
}
} else if ((filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection))) {
TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel();
if (sl) {
std::set<TFrameId> fids = filmstripSelection->getSelectedFids();
std::set<TFrameId>::iterator it;
for (it = fids.begin(); it != fids.end(); ++it) {
TRasterImageP rasImage = sl->getFrame(*it, false);
if (!!rasImage && !!rasImage->getRaster()) {
m_frames.push_back(std::make_pair(sl, *it));
count++;
}
}
}
} else {
}
m_frameIndex = 0;
return count;
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:46,代码来源:binarizepopup.cpp
示例13: undo
void undo() const
{
TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
TXshCell cell = xsheet->getCell(m_r, m_c);
TRasterImageP rasImage = (TRasterImageP)cell.getImage(true);
if (!rasImage)
return;
rasImage->setRaster(((TRasterImageP)TImageCache::instance()->get(m_rasId, true))->getRaster()->clone());
TXshSimpleLevel *simpleLevel = cell.getSimpleLevel();
assert(simpleLevel);
simpleLevel->touchFrame(cell.getFrameId());
simpleLevel->setDirtyFlag(false);
IconGenerator::instance()->invalidate(simpleLevel, cell.getFrameId());
if (m_isLastInBlock) {
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:18,代码来源:brightnessandcontrastpopup.cpp
示例14: setCurrentColorWithUndo
void setCurrentColorWithUndo(const TPixel32 &color) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
if (palette)
TUndoManager::manager()->add(
new UndoPickRGBM(palette, styleId, color, level));
setCurrentColor(color);
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:18,代码来源:rgbpickertool.cpp
示例15: acquirePreview
void MeshifyPopup::acquirePreview()
{
m_viewer->clear();
// Assign preview input to the viewer
bool enabled = false;
::xshPos(m_r, m_c);
m_cell = TApp::instance()->getCurrentXsheet()->getXsheet()->getCell(m_r, m_c);
// Redirect mesh case to texture
TXshSimpleLevel *sl = m_cell.getSimpleLevel();
if (sl && sl->getType() == MESH_XSHLEVEL) {
// Mesh image case
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
TStageObject *meshObj = xsh->getStageObject(TStageObjectId::ColumnId(m_c));
const TStageObjectId &childId = ::firstChildLevelColumn(*xsh, *meshObj);
if (childId.isColumn())
// Retrieved the associated texture cell - redirect acquisition there
m_cell = xsh->getCell(m_r, childId.getIndex());
}
if ((sl = m_cell.getSimpleLevel())) {
// Standard image case
m_viewer->m_img = sl->getFullsampledFrame(m_cell.getFrameId(), ImageManager::dontPutInCache);
enabled = true;
} else if (TXshChildLevel *cl = m_cell.getChildLevel()) {
// Sub-xsheet case
TXsheet *xsh = cl->getXsheet();
int row = m_cell.getFrameId().getNumber() - 1;
m_viewer->m_xsh = xsh, m_viewer->m_row = row;
enabled = true;
}
m_okBtn->setEnabled(enabled);
// Update the corresponding processed image in the viewer
updateMeshPreview();
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:43,代码来源:meshifypopup.cpp
示例16: 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;
}
开发者ID:opentoonz,项目名称:opentoonz,代码行数:52,代码来源:columnselection.cpp
示例17: 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;
}
开发者ID:luc--,项目名称:opentoonz,代码行数:42,代码来源:columnselection.cpp
示例18: updateCurrentFrame
void TApp::updateCurrentFrame() {
ToonzScene *scene = m_currentScene->getScene();
m_currentFrame->setSceneFrameSize(scene->getFrameCount());
int f0, f1, step;
scene->getProperties()->getPreviewProperties()->getRange(f0, f1, step);
if (f0 > f1) {
f0 = 0;
f1 = scene->getFrameCount() - 1;
}
if (f0 != m_currentFrame->getStartFrame() ||
f1 != m_currentFrame->getEndFrame()) {
m_currentFrame->setFrameRange(f0, f1);
std::vector<TFrameId> fids;
TXshSimpleLevel *sl = m_currentLevel->getSimpleLevel();
if (sl) {
sl->getFids(fids);
m_currentFrame->setFrameIds(fids);
}
}
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:20,代码来源:tapp.cpp
示例19: onPaletteChanged
void TApp::onLevelColorStyleChanged() {
onPaletteChanged();
TXshLevel *level = m_currentLevel->getLevel();
if (!level) return;
TPalette *palette = getCurrentPalette()->getPalette();
TXshSimpleLevel *simpleLevel = level->getSimpleLevel();
if (simpleLevel && simpleLevel->getPalette() == palette) {
notifyPaletteChanged(simpleLevel);
} else {
TLevelSet *levelSet = getCurrentScene()->getScene()->getLevelSet();
for (int i = 0; i < levelSet->getLevelCount(); i++) {
if (levelSet->getLevel(i)) {
simpleLevel = levelSet->getLevel(i)->getSimpleLevel();
if (simpleLevel && simpleLevel->getPalette() == palette) {
notifyPaletteChanged(simpleLevel);
}
}
}
}
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:20,代码来源:tapp.cpp
示例20: pd
void BinarizePopup::apply()
{
if (getSelectedFrames() <= 0) {
DVGui::error(tr("No raster frames selected"));
return;
}
DVGui::ProgressDialog pd(tr("Binarizing images"), tr("Cancel"), 0, (int)m_frames.size(), 0);
pd.show();
qApp->processEvents();
TBinarizer binarizer;
binarizer.enableAlpha(!!m_alphaChk->checkState());
TUndoManager::manager()->beginBlock();
int count = 0;
Frames::iterator it;
for (it = m_frames.begin(); it != m_frames.end(); ++it) {
TXshSimpleLevel *sl = it->first;
if (!!m_alphaChk->checkState())
sl->getProperties()->setHasAlpha(true);
TFrameId fid = it->second;
TBinarizeUndo *undo = new TBinarizeUndo(sl, fid, binarizer.isAlphaEnabled());
TUndoManager::manager()->add(undo);
TRasterImageP ri = sl->getFrame(fid, true);
if (!ri)
continue; // should never happen
TRaster32P ras32 = ri->getRaster();
if (!ras32)
continue; // not yet handled
binarizer.process(ras32);
pd.setValue(count++);
qApp->processEvents();
sl->touchFrame(fid);
sl->setDirtyFlag(true);
IconGenerator::instance()->invalidate(sl, fid);
}
TUndoManager::manager()->endBlock();
TApp::instance()->getCurrentLevel()->notifyLevelChange();
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:41,代码来源:binarizepopup.cpp
注:本文中的TXshSimpleLevel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论