当前位置: 首页>>代码示例>>C++>>正文


C++ Application::getCurrentLevel方法代码示例

本文整理汇总了C++中ttool::Application::getCurrentLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::getCurrentLevel方法的具体用法?C++ Application::getCurrentLevel怎么用?C++ Application::getCurrentLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ttool::Application的用法示例。


在下文中一共展示了Application::getCurrentLevel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateLevel

	void updateLevel()
	{
		TTool::Application *app = TTool::getApplication();
		if (!app->getCurrentLevel()->getLevel())
			return;
		TXshSimpleLevelP xl = app->getCurrentLevel()->getLevel()->getSimpleLevel();
		if (app->getCurrentFrame()->getFrameType() != TFrameHandle::LevelFrame)
			return;

		TFrameId fid = app->getCurrentFrame()->getFid();
		TVectorImageP src = xl->getFrame(fid, true);
		int count = src->getStrokeCount();

		for (int i = 1; i < 10; i++) {
			++fid;
			if (!xl->isFid(fid)) {
				TVectorImageP vi = new TVectorImage();
				xl->setFrame(fid, vi);
			}
			TVectorImageP vi = xl->getFrame(fid, true);
			TVectorImageP dst = src->clone();
			deform(dst.getPointer(), src.getPointer(), (double)i / (double)9);
			count = dst->getStrokeCount();
			vi->mergeImage(dst, TAffine());
			app->getCurrentTool()->getTool()->notifyImageChanged(fid);
		}
	}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:27,代码来源:morphtool.cpp

示例2: onImageChanged

  void onImageChanged() override {
    if (!m_multi.getValue()) return;
    TTool::Application *app = TTool::getApplication();
    TXshSimpleLevel *xshl   = 0;
    if (app->getCurrentLevel()->getLevel())
      xshl = app->getCurrentLevel()->getSimpleLevel();

    if (!xshl || m_level.getPointer() != xshl ||
        (m_closeType.getValue() == RECT_CLOSE && m_selectingRect.isEmpty()) ||
        ((m_closeType.getValue() == FREEHAND_CLOSE ||
          m_closeType.getValue() == POLYLINE_CLOSE) &&
         !m_firstStroke))
      resetMulti();
    else if (m_firstFrameId == getFrameId())
      m_firstFrameSelected = false;  // nel caso sono passato allo stato 1 e
                                     // torno all'immagine iniziale, torno allo
                                     // stato iniziale
    else {                           // cambio stato.
      m_firstFrameSelected = true;
      if (m_closeType.getValue() == RECT_CLOSE) {
        assert(!m_selectingRect.isEmpty());
        m_firstRect = m_selectingRect;
      }
    }
  }
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:25,代码来源:rastertapetool.cpp

示例3: resetMulti

 void resetMulti() {
   m_firstFrameSelected = false;
   m_firstRect.empty();
   m_firstPoint = TPointD();
   m_selectingRect.empty();
   TTool::Application *app = TTool::getApplication();
   m_level                 = app->getCurrentLevel()->getLevel()
                 ? app->getCurrentLevel()->getSimpleLevel()
                 : 0;
   m_firstFrameId = m_veryFirstFrameId = getFrameId();
   m_firstStroke                       = 0;
 }
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:12,代码来源:rastertapetool.cpp

示例4: leftButtonUp

void FullColorBrushTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e)
{
	m_brushPos = m_mousePos = pos;

	TRasterImageP ri = (TRasterImageP)getImage(true);
	if (!ri)
		return;

	if (m_points.size() != 1) {
		double maxThickness = m_thickness.getValue().second;
		double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness;
		double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
		TPointD rasCenter = ri->getRaster()->getCenterD();
		TThickPoint point(pos + rasCenter, thickness);
		m_points.push_back(point);
		int m = m_points.size();
		vector<TThickPoint> points;
		points.push_back(m_points[m - 3]);
		points.push_back(m_points[m - 2]);
		points.push_back(m_points[m - 1]);
		TRect bbox = m_brush->getBoundFromPoints(points);
		updateWorkAndBackupRasters(bbox);
		m_tileSaver->save(bbox);
		m_brush->addArc(points[0], points[1], points[2], m_oldOpacity, opacity);
		m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01);
		TRectD invalidateRect = ToolUtils::getBounds(points, maxThickness);
		invalidate(invalidateRect.enlarge(2) - rasCenter);
		m_strokeRect += bbox;
		m_lastRect.empty();
	}

	if (m_brush) {
		delete m_brush;
		m_brush = 0;
	}

	m_workRaster->unlock();

	if (m_tileSet->getTileCount() > 0) {
		delete m_tileSaver;
		TTool::Application *app = TTool::getApplication();
		TXshLevel *level = app->getCurrentLevel()->getLevel();
		TXshSimpleLevelP simLevel = level->getSimpleLevel();
		TFrameId frameId = getCurrentFid();
		TRasterP ras = ri->getRaster()->extract(m_strokeRect)->clone();
		TUndoManager::manager()->add(new FullColorBrushUndo(m_tileSet, simLevel.getPointer(), frameId,
															m_isFrameCreated, ras, m_strokeRect.getP00()));
	}

	notifyImageChanged();
	m_strokeRect.empty();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:52,代码来源:fullcolorbrushtool.cpp

示例5: connect

FullColorBrushToolNotifier::FullColorBrushToolNotifier(FullColorBrushTool *tool)
	: m_tool(tool)
{
	TTool::Application *app = m_tool->getApplication();
	TXshLevelHandle *levelHandle;
	if (app)
		levelHandle = app->getCurrentLevel();
	bool ret = false;
	if (levelHandle) {
		bool ret = connect(levelHandle, SIGNAL(xshCanvasSizeChanged()), this, SLOT(onCanvasSizeChanged()));
		assert(ret);
	}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:13,代码来源:fullcolorbrushtool.cpp

示例6: 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

示例7: onImageChanged

void RGBPickerTool::onImageChanged() {
  if (m_currentStyleId != 0 && m_makePick &&
      (m_pickType.getValue() == POLYLINE_PICK ||
       m_pickType.getValue() == RECT_PICK)) {
    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, m_currentValue, level));
    setCurrentColor(m_currentValue);
    if (level) {
      std::vector<TFrameId> fids;
      level->getFids(fids);
      invalidateIcons(level, fids);
    }
  }
  m_makePick = false;
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:21,代码来源:rgbpickertool.cpp

示例8: pick

void RGBPickerTool::pick(TPoint pos) {
  TImageP image = TImageP(getImage(false));

  TTool::Application *app = TTool::getApplication();
  TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
  int styleId             = ph->getStyleIndex();
  TPalette *palette       = ph->getPalette();
  if (!palette) return;

  TRectD area = TRectD(pos.x - 1, pos.y - 1, pos.x + 1, pos.y + 1);
  StylePicker picker(image, palette);

  // iwsw commented out temporarily
  // if (m_viewer->get3DLutUtil() &&
  // Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
  //	m_viewer->get3DLutUtil()->bindFBO();

  m_currentValue = picker.pickColor(area);

  // iwsw commented out temporarily
  // if (m_viewer->get3DLutUtil() &&
  // Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
  //	m_viewer->get3DLutUtil()->releaseFBO();

  TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
  UndoPickRGBM *cmd = new UndoPickRGBM(palette, styleId, m_currentValue, level);
  TUndoManager::manager()->add(cmd);
  cmd->redo();
  /*
setCurrentColor(m_currentValue);
if(level)
{
vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level,fids);
}
*/
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:38,代码来源:rgbpickertool.cpp

示例9: pickStroke

void RGBPickerTool::pickStroke() {
  TImageP image = TImageP(getImage(false));

  TTool::Application *app = TTool::getApplication();
  TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
  int styleId             = ph->getStyleIndex();
  TPalette *palette       = ph->getPalette();
  if (!palette) return;

  StylePicker picker(image, palette);
  TStroke *stroke = new TStroke(*m_stroke);

  // iwsw commented out temporarily
  // if (m_viewer->get3DLutUtil() &&
  // Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
  //	m_viewer->get3DLutUtil()->bindFBO();

  m_currentValue = picker.pickColor(stroke);

  // iwsw commented out temporarily
  // if (m_viewer->get3DLutUtil() &&
  // Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
  //	m_viewer->get3DLutUtil()->releaseFBO();

  if (!(m_pickType.getValue() == POLYLINE_PICK)) {
    TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
    TUndoManager::manager()->add(
        new UndoPickRGBM(palette, styleId, m_currentValue, level));
    setCurrentColor(m_currentValue);
    if (level) {
      std::vector<TFrameId> fids;
      level->getFids(fids);
      invalidateIcons(level, fids);
    }
  }
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:36,代码来源:rgbpickertool.cpp


注:本文中的ttool::Application::getCurrentLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。