• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TRasterP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getViewer

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

	Viewer *viewer = getViewer();
	if (!viewer)
		return;

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

	if (!ri)
		return;

	TRasterP ras = ri->getRaster();
	TDimension dim = ras->getSize();

	if (!(m_workRaster && m_backUpRas))
		setWorkAndBackupImages();

	m_workRaster->lock();

	double maxThick = m_thickness.getValue().second;
	double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThick;
	double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
	TPointD rasCenter = TPointD(dim.lx * 0.5, dim.ly * 0.5);
	TThickPoint point(pos + rasCenter, thickness);
	TPointD halfThick(maxThick * 0.5, maxThick * 0.5);
	TRectD invalidateRect(pos - halfThick, pos + halfThick);

	m_points.clear();
	m_points.push_back(point);

	m_tileSet = new TTileSetFullColor(ras->getSize());
	m_tileSaver = new TTileSaverFullColor(ras, m_tileSet);
	double hardness = m_hardness.getValue() * 0.01;

	m_brush = new BluredBrush(m_workRaster, maxThick, m_brushPad, hardness == 1.0);
	m_strokeRect = m_brush->getBoundFromPoints(m_points);
	updateWorkAndBackupRasters(m_strokeRect);
	m_tileSaver->save(m_strokeRect);
	m_brush->addPoint(point, opacity);
	m_brush->updateDrawing(ras, m_backUpRas, m_currentColor, m_strokeRect, m_opacity.getValue().second * 0.01);
	m_oldOpacity = opacity;
	m_lastRect = m_strokeRect;

	invalidate(invalidateRect.enlarge(2));
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:49,代码来源:fullcolorbrushtool.cpp


示例17: makeStereoRaster

void TRop::makeStereoRaster(const TRasterP &left, const TRasterP &right) {
  assert(left->getSize() == right->getSize());

  left->lock();

  if ((TRaster32P)left && (TRaster32P)right)
    doMakeStereoRaster<TPixel32>(left, right);
  else if ((TRaster64P)left && (TRaster64P)right)
    doMakeStereoRaster<TPixel64>(left, right);
  else {
    left->unlock();
    throw TRopException("setChannel: unsupported pixel type");
  }

  left->unlock();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:16,代码来源:trop.cpp


示例18: computeBBox

void TRop::computeBBox(TRasterP ras, TRect &bbox) {
  TRaster32P ras32 = ras;
  if (ras32) {
    ::computeBBox<TPixel32, UCHAR>(ras32, bbox);
    return;
  }

  TRaster64P ras64 = ras;
  if (ras64) {
    ::computeBBox<TPixel64, USHORT>(ras64, bbox);
    return;
  }

  TRasterCM32P rasCM32 = ras;
  if (rasCM32) {
    computeBBoxCM32(rasCM32, bbox);
    return;
  }

  TRasterGR8P ras8 = ras;
  if (ras8) {
    bbox = ras->getBounds();
    return;
  }
  assert(0);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:26,代码来源:bbox.cpp


示例19: dbounds

void TRop::over(const TRasterP &out, const TRasterP &up, const TPoint &pos, const TAffine &aff,
				ResampleFilterType filterType)
{
	if (aff.isIdentity())
		//simple over with offset
		TRop::over(out, up, pos);
	else {
		TRect rasterBounds = up->getBounds();
		TRectD dbounds(rasterBounds.x0, rasterBounds.y0, rasterBounds.x1, rasterBounds.y1);
		dbounds = aff * dbounds;
		TRect bounds(tfloor(dbounds.x0), tfloor(dbounds.y0), tceil(dbounds.x1), tceil(dbounds.y1));
		TRasterP tmp = up->create(bounds.getLx(), bounds.getLy());
		resample(tmp, up, TTranslation(-dbounds.getP00()) * aff, filterType);
		TRop::over(out, tmp, pos);
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:16,代码来源:tover.cpp


示例20: copy

void TRop::copy(TRasterP dst, const TRasterP &src) {
  assert(!((TRasterCM32P)src) || (TRasterCM32P)dst);
  if (dst->getPixelSize() == src->getPixelSize())
    dst->copy(src);
  else {
    if (dst->getBounds() != src->getBounds()) {
      TRect rect = dst->getBounds() * src->getBounds();
      if (rect.isEmpty()) return;
      TRop::convert(dst->extract(rect), src->extract(rect));
    } else
      TRop::convert(dst, src);
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:13,代码来源:trop.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TRawEvent类代码示例发布时间:2022-05-31
下一篇:
C++ TRasterImageP类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap