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


C++ TRasterP::clear方法代码示例

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


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

示例1: getRaster

//! 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

示例2: eraseRect

TRect TRasterImageUtils::eraseRect(const TRasterImageP &ri, const TRectD &area)
{
	TRasterP ras = ri->getRaster();
	TRect rect = convertWorldToRaster(area, ri) * ras->getBounds();
	if (rect.isEmpty())
		return rect;
	ras->lock();
	TRasterP workRas = ras->extract(rect);
	if (workRas->getPixelSize() == 4)
		workRas->clear();
	else {
		TRasterGR8P rasGR8(workRas);
		if (rasGR8)
			rasGR8->fill(TPixelGR8::White);
	}
	ras->unlock();
	return rect;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:18,代码来源:trasterimageutils.cpp

示例3: add

QString ImageBuilder::add(const TImageP &img, const TAffine &aff) {
  if (fabs(aff.det()) < 0.001) return "";
  if (m_img && (m_img->getType() != img->getType()))
    return "Image type mismatch";

  if (!m_img && img->getType() != TImage::VECTOR && m_width > 0 &&
      m_height > 0) {
    TRasterP ras = img->raster()->create(m_width, m_height);
    if (img->getType() == TImage::RASTER)
      m_img = TRasterImageP(ras);
    else if (img->getType() == TImage::TOONZ_RASTER) {
      m_img = TToonzImageP(ras, ras->getBounds());
      m_img->setPalette(img->getPalette());
    } else
      return "Bad image type";
  }

  if (!m_img && aff.isIdentity()) {
    m_img = img->cloneImage();
  } else if (img->getType() == TImage::VECTOR) {
    // vector image
    if (!m_img) {
      // transform
      TVectorImageP vi = img->cloneImage();
      vi->transform(aff);
      m_img = vi;
    } else {
      // merge
      TVectorImageP up = img;
      TVectorImageP dn = m_img;
      dn->mergeImage(up, aff);
    }
  } else {
    if (img->getType() != TImage::TOONZ_RASTER &&
        img->getType() != TImage::RASTER) {
      // this should not ever happen
      return "Bad image type";
    }
    TRasterP up = img->raster();
    if (!m_img) {
      // create an empty bg
      TRasterP ras = up->create();
      ras->clear();
      if (img->getType() == TImage::TOONZ_RASTER) {
        TRasterCM32P rasCm = ras;
        m_img              = TToonzImageP(rasCm,
                             TRect(0, 0, ras->getLx() - 1, ras->getLy() - 1));
        m_img->setPalette(img->getPalette());
      } else {
        m_img = TRasterImageP(ras);
      }
    }
    TRasterP dn = m_img->raster();
    if (aff.isTranslation() && aff.a13 == floor(aff.a13) &&
        aff.a23 == floor(aff.a23)) {
      // just a integer coord translation
      TPoint delta = -up->getCenter() + dn->getCenter() +
                     TPoint((int)aff.a13, (int)aff.a23);
      TRop::over(dn, up, delta);
    } else {
      TAffine aff1 = TTranslation(dn->getCenterD()) * aff *
                     TTranslation(-up->getCenterD());
      TRop::over(dn, up, aff1, TRop::Mitchell);
    }
  }
  return "";
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:67,代码来源:scriptbinding_image_builder.cpp


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