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


C++ TRasterP类代码示例

本文整理汇总了C++中TRasterP的典型用法代码示例。如果您正苦于以下问题:C++ TRasterP类的具体用法?C++ TRasterP怎么用?C++ TRasterP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addGlobalNumbering

void TRasterImageUtils::addGlobalNumbering(const TRasterImageP &ri, const std::wstring &sceneName, int globalIndex)
{
	if (!ri)
		return;
	TRasterP raster = ri->getRaster();
	int lx = raster->getLx(), ly = raster->getLy();
	QColor greyOverlay(100, 100, 100, 140);
	QImage image = rasterToQImage(raster, true, false);
	QPainter p(&image);
	QFont numberingFont = QFont();
	numberingFont.setPixelSize(ly * 0.04);
	numberingFont.setBold(true);
	p.setFont(numberingFont);
	QMatrix matrix;
	p.setMatrix(matrix.translate(0, ly).scale(1, -1), true);
	QFontMetrics fm = p.fontMetrics();
	int fontHeight = fm.height();
	int offset = fontHeight * 0.2;
	QString globalFrame = QString::number(globalIndex);
	while (globalFrame.size() < 4)
		globalFrame.push_front("0");
	QString globalNumberingString = QString::fromStdWString(sceneName) + ": " + globalFrame;

	int globalNumberingWidth = fm.width(globalNumberingString);
	p.setPen(Qt::NoPen);
	p.setBrush(QColor(255, 255, 255, 255));
	p.drawRect(offset, ly - offset - fontHeight, globalNumberingWidth + offset * 2, fontHeight);
	p.setBrush(greyOverlay);
	p.drawRect(offset, ly - offset - fontHeight, globalNumberingWidth + offset * 2, fontHeight);
	p.setPen(Qt::white);
	p.drawText(2 * offset, ly - 2 * offset, globalNumberingString);
	p.end();
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:33,代码来源:trasterimageutils.cpp

示例2: TImageP

void FullColorBrushTool::updateWorkAndBackupRasters(const TRect &rect)
{
	TRasterImageP ri = TImageP(getImage(false, 1));
	if (!ri)
		return;

	TRasterP ras = ri->getRaster();

	TRect _rect = rect * ras->getBounds();
	TRect _lastRect = m_lastRect * ras->getBounds();

	if (_rect.isEmpty())
		return;

	if (m_lastRect.isEmpty()) {
		m_workRaster->extract(_rect)->clear();
		m_backUpRas->extract(_rect)->copy(ras->extract(_rect));
		return;
	}

	QList<TRect> rects = ToolUtils::splitRect(_rect, _lastRect);
	for (int i = 0; i < rects.size(); i++) {
		m_workRaster->extract(rects[i])->clear();
		m_backUpRas->extract(rects[i])->copy(ras->extract(rects[i]));
	}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:26,代码来源:fullcolorbrushtool.cpp

示例3: sl

//! Returns for the first not-busy raster
TRasterP RasterPool::getRaster() {
  QMutexLocker sl(&m_repositoryLock);

  RasterRepository::iterator it = m_rasterRepository.begin();
  while (it != m_rasterRepository.end()) {
    RasterItem *rasItem = *it;
    if (rasItem->m_busy == false) {
      TRasterP raster = rasItem->getRaster();

      if (!raster) {
        delete rasItem;
        m_rasterRepository.erase(it++);
        continue;
      }

      rasItem->m_busy = true;
      raster->clear();
      return raster;
    }

    ++it;
  }

  RasterItem *rasItem = new RasterItem(m_size, m_bpp, true);
  m_rasterRepository.push_back(rasItem);

  return rasItem->getRaster();
}
开发者ID:merckhung,项目名称:opentoonz,代码行数:29,代码来源:trenderer.cpp

示例4: getDpiAffine

void ShiftTraceTool::updateBox() {
  if (0 <= m_ghostIndex && m_ghostIndex < 2 && m_row[m_ghostIndex] >= 0) {
    int col      = TApp::instance()->getCurrentColumn()->getColumnIndex();
    int row      = m_row[m_ghostIndex];
    TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();

    TXshCell cell       = xsh->getCell(row, col);
    TXshSimpleLevel *sl = cell.getSimpleLevel();
    if (sl) {
      m_dpiAff    = getDpiAffine(sl, cell.m_frameId);
      TImageP img = cell.getImage(false);
      if (img) {
        if (TRasterImageP ri = img) {
          TRasterP ras = ri->getRaster();
          m_box        = (convert(ras->getBounds()) - ras->getCenterD()) *
                  ri->getSubsampling();
        } else if (TToonzImageP ti = img) {
          TRasterP ras = ti->getRaster();
          m_box        = (convert(ras->getBounds()) - ras->getCenterD()) *
                  ti->getSubsampling();
        } else if (TVectorImageP vi = img) {
          m_box = vi->getBBox();
        }
      }
    }
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:27,代码来源:shifttracetool.cpp

示例5: pickColor

TPixel32 StylePicker::pickColor(const TPointD &pos, double radius2) const
{
	TToonzImageP ti = m_image;
	TRasterImageP ri = m_image;
	if (!!ri) // !!ti || !!ri)
	{
		TRasterP raster;
		//if(ti)
		//  raster = ti->getRGBM(true);
		//else
		raster = ri->getRaster();

		TPoint point = getRasterPoint(pos);
		if (!raster->getBounds().contains(point))
			return TPixel32::Transparent;

		TRaster32P raster32 = raster;
		if (raster32)
			return raster32->pixels(point.y)[point.x];

		TRasterGR8P rasterGR8 = raster;
		if (rasterGR8)
			return toPixel32(rasterGR8->pixels(point.y)[point.x]);
	} else if (TVectorImageP vi = m_image) {
		const TPalette *palette = m_palette.getPointer();
		if (!palette)
			return TPixel32::Transparent;
		int styleId = pickStyleId(pos, radius2);
		if (0 <= styleId && styleId < palette->getStyleCount())
			return palette->getStyle(styleId)->getAverageColor();
	}
	return TPixel32::Transparent;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:33,代码来源:stylepicker.cpp

示例6: createCellRaster

inline TRasterP TCacheResource::createCellRaster(int rasterType, const std::string &cacheId)
{
	TRasterP result;

	if (rasterType == TCacheResource::NONE) {
		assert(!"Unknown raster type!");
		return result;
	}

	TImageP img;
	if (rasterType == TCacheResource::RGBM32) {
		result = TRaster32P(latticeStep, latticeStep);
		img = TRasterImageP(result);
	} else if (rasterType == TCacheResource::RGBM64) {
		result = TRaster64P(latticeStep, latticeStep);
		img = TRasterImageP(result);
	} else if (rasterType == TCacheResource::CM32) {
		result = TRasterCM32P(latticeStep, latticeStep);
		img = TToonzImageP(result, result->getBounds());
	}

	TImageCache::instance()->add(cacheId, img);
	++m_cellsCount;

	//DIAGNOSTICS_GLOADD("crCellsCnt", 1);

	return result;
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:28,代码来源:tcacheresource.cpp

示例7: despeckle

void TRop::despeckle(const TRasterP &ras, int sizeThreshold, bool check,
                     bool transparentIsWhite) {
  ras->lock();

  if (TRasterCM32P(ras)) {
    doDespeckleCM32(ras, sizeThreshold, check);
    return;
  }
  if (TRaster32P(ras)) {
    doDespeckleRGBM<TPixel32, UCHAR>(ras, sizeThreshold, transparentIsWhite);
    return;
  }
  if (TRaster64P(ras)) {
    doDespeckleRGBM<TPixel64, USHORT>(ras, sizeThreshold, transparentIsWhite);
    return;
  }
  if (TRasterGR8P(ras)) {
    doDespeckleGR<TPixelGR8, UCHAR>(ras, sizeThreshold);
    return;
  }
  if (TRasterGR16P(ras)) {
    doDespeckleGR<TPixelGR16, USHORT>(ras, sizeThreshold);
    return;
  }

  ras->unlock();
}
开发者ID:luc--,项目名称:opentoonz,代码行数:27,代码来源:tdespeckle.cpp

示例8: draw

void PlaneViewer::draw(TRasterP ras, double dpiX, double dpiY, TPalette *pal) {
  TPointD rasCenter(ras->getCenterD());

  TRaster32P aux(rasterBuffer());

  aux->lock();
  ras->lock();

  glGetDoublev(GL_MODELVIEW_MATRIX, m_matrix);
  TAffine viewAff(m_matrix[0], m_matrix[4], m_matrix[12], m_matrix[1],
                  m_matrix[5], m_matrix[13]);
  viewAff = viewAff * TScale(Stage::inch / dpiX, Stage::inch / dpiY) *
            TTranslation(-rasCenter);

  pushGLWinCoordinates();

  aux->clear();
  if (pal)
    TRop::quickPut(aux, (TRasterCM32P)ras, pal, viewAff);
  else
    TRop::quickPut(aux, ras, viewAff);

  flushRasterBuffer();
  popGLCoordinates();
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:25,代码来源:planeviewer.cpp

示例9: TRect

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);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:10,代码来源:trasterimageutils.cpp

示例10: switch

void SceneViewer::onButtonPressed(FlipConsole::EGadget button) {
  if (m_freezedStatus != NO_FREEZED) return;
  switch (button) {
  case FlipConsole::eSaveImg: {
    if (m_previewMode == NO_PREVIEW) {
      DVGui::warning(QObject::tr(
          "It is not possible to save images in camera stand view."));
      return;
    }
    TApp *app = TApp::instance();
    int row   = app->getCurrentFrame()->getFrame();

    Previewer *previewer =
        Previewer::instance(m_previewMode == SUBCAMERA_PREVIEW);
    if (!previewer->isFrameReady(row)) {
      DVGui::warning(QObject::tr("The preview images are not ready yet."));
      return;
    }

    TRasterP ras =
        previewer->getRaster(row, m_visualSettings.m_recomputeIfNeeded);

    TImageCache::instance()->add(QString("TnzCompareImg"),
                                 TRasterImageP(ras->clone()));

    break;
  }

  case FlipConsole::eSave:
    Previewer::instance(m_previewMode == SUBCAMERA_PREVIEW)
        ->saveRenderedFrames();
    break;

  case FlipConsole::eHisto: {
    QAction *action = CommandManager::instance()->getAction(MI_Histogram);
    action->trigger();
    break;
  }

  case FlipConsole::eDefineSubCamera:
    m_editPreviewSubCamera = !m_editPreviewSubCamera;
    update();
    break;

  // open locator. Create one for the first time
  case FlipConsole::eLocator:
    if (!m_locator) m_locator = new LocatorPopup(this);
    m_locator->show();
    m_locator->raise();
    m_locator->activateWindow();
    break;
  }
}
开发者ID:hvfrancesco,项目名称:opentoonz,代码行数:53,代码来源:sceneviewerevents.cpp

示例11: if

void ShiftTraceTool::drawControlRect() {
  if (m_ghostIndex < 0 || m_ghostIndex > 1) return;
  int row = m_row[m_ghostIndex];
  if (row < 0) return;
  int col       = TApp::instance()->getCurrentColumn()->getColumnIndex();
  TXsheet *xsh  = TApp::instance()->getCurrentXsheet()->getXsheet();
  TXshCell cell = xsh->getCell(row, col);
  if (cell.isEmpty()) return;
  TImageP img = cell.getImage(false);
  if (!img) return;
  TRectD box;
  if (TRasterImageP ri = img) {
    TRasterP ras = ri->getRaster();
    box =
        (convert(ras->getBounds()) - ras->getCenterD()) * ri->getSubsampling();
  } else if (TToonzImageP ti = img) {
    TRasterP ras = ti->getRaster();
    box =
        (convert(ras->getBounds()) - ras->getCenterD()) * ti->getSubsampling();
  } else if (TVectorImageP vi = img) {
    box = vi->getBBox();
  } else {
    return;
  }
  glPushMatrix();
  tglMultMatrix(getGhostAff());
  TPixel32 color;
  color = m_highlightedGadget == TranslateGadget ? TPixel32(200, 100, 100)
                                                 : TPixel32(120, 120, 120);
  tglColor(color);
  glBegin(GL_LINE_STRIP);
  glVertex2d(box.x0, box.y0);
  glVertex2d(box.x1, box.y0);
  glVertex2d(box.x1, box.y1);
  glVertex2d(box.x0, box.y1);
  glVertex2d(box.x0, box.y0);
  glEnd();
  color =
      m_highlightedGadget == 2000 ? TPixel32(200, 100, 100) : TPixel32::White;
  double r = 4 * sqrt(tglGetPixelSize2());
  drawDot(box.getP00(), r, color);
  drawDot(box.getP01(), r, color);
  drawDot(box.getP10(), r, color);
  drawDot(box.getP11(), r, color);
  if (m_curveStatus == NoCurve) {
    color =
        m_highlightedGadget == 2001 ? TPixel32(200, 100, 100) : TPixel32::White;
    TPointD c = m_center[m_ghostIndex];
    drawDot(c, r, color);
  }
  glPopMatrix();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:52,代码来源:shifttracetool.cpp

示例12: shrink

TRasterP TRop::shrink(TRasterP rin, int shrink) {
  int pixelSize = rin->getPixelSize();

  int lx = (rin->getLx() - 1) / shrink + 1;
  int ly = (rin->getLy() - 1) / shrink + 1;

  TRasterP rout;

  if ((TRaster32P)rin)
    rout = TRaster32P(lx, ly);
  else if ((TRaster64P)rin)
    rout                      = TRaster64P(lx, ly);
  if ((TRasterCM32P)rin) rout = TRasterCM32P(lx, ly);
  if ((TRasterGR8P)rin) rout  = TRasterGR8P(lx, ly);

  int i, j;

  for (i = 0; i < ly; i++) {
    UCHAR *bufin =
        (UCHAR *)rin->getRawData() + (i * shrink) * rin->getWrap() * pixelSize;
    UCHAR *bufout =
        (UCHAR *)rout->getRawData() + i * rout->getWrap() * pixelSize;
    for (j = 0; j < lx; j++) {
      memcpy(bufout, bufin, pixelSize);
      bufin += shrink * pixelSize;
      bufout += pixelSize;
    }
  }
  return rout;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:30,代码来源:trop.cpp

示例13: gammaCorrect

void TRop::gammaCorrect(TRasterP raster, double gamma) {
  if (gamma <= 0) gamma = 0.01;
  raster->lock();

  if ((TRaster32P)raster)
    doGammaCorrect<TPixel32, UCHAR>(raster, gamma);
  else if ((TRaster64P)raster)
    doGammaCorrect<TPixel64, USHORT>(raster, gamma);
  else {
    raster->unlock();
    throw TRopException("isOpaque: unsupported pixel type");
  }
  raster->unlock();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:14,代码来源:trop.cpp

示例14:

std::vector<TRect> TRasterImageUtils::paste(const TRasterImageP &ri, const TTileSetFullColor *tileSet)
{
	std::vector<TRect> rects;
	TRasterP raster = ri->getRaster();
	for (int i = 0; i < tileSet->getTileCount(); i++) {
		const TTileSetFullColor::Tile *tile = tileSet->getTile(i);
		TRasterP ras;
		tile->getRaster(ras);
		assert(ras);
		raster->copy(ras, tile->m_rasterBounds.getP00());
		rects.push_back(tile->m_rasterBounds);
	}
	return rects;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:14,代码来源:trasterimageutils.cpp

示例15: sizeof

AdjustLevelsUndo::AdjustLevelsUndo(int *in0, int *in1, int *out0, int *out1,
								   int r, int c, TRasterP ras)
	: m_r(r), m_c(c), m_rasSize(ras->getLx() * ras->getLy() * ras->getPixelSize())
{
	memcpy(m_in0, in0, sizeof(m_in0));
	memcpy(m_in1, in1, sizeof(m_in1));
	memcpy(m_out0, out0, sizeof(m_out0));
	memcpy(m_out1, out1, sizeof(m_out1));

	static int counter = 0;
	m_rasId = QString("AdjustLevelsUndo") + QString::number(++counter);

	TImageCache::instance()->add(m_rasId, TRasterImageP(ras));
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:14,代码来源:adjustlevelspopup.cpp


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