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


C++ TRaster32P::getSize方法代码示例

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


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

示例1: overPixOnWhite

void Naa2TlvConverter::setSourceImage(const TRaster32P &srcRas) {
  int lx = srcRas->getSize().lx;
  int ly = srcRas->getSize().ly;

  m_colors.clear();
  m_regions.clear();
  delete m_regionRas;
  m_regionRas = new WorkRaster<unsigned short>(lx, ly);
  delete m_borderRas;
  m_borderRas = 0;

  delete m_dotRas;
  m_dotRas = 0;

  delete m_syntheticInkRas;
  m_syntheticInkRas = 0;

  QMap<TPixel32, int> colorTable;
  for (int y = 0; y < ly; y++) {
    TPixel32 *srcScanLine          = srcRas->pixels(y);
    unsigned short *regionScanLine = m_regionRas->pixels(y);
    for (int x = 0; x < lx; x++) {
      TPixel32 srcPix = overPixOnWhite(srcScanLine[x]);
      QMap<TPixel32, int>::ConstIterator it = colorTable.find(srcPix);
      if (it == colorTable.end()) {
        // found new color (and therefore new region)
        RegionInfo r;
        // add new color
        r.colorIndex = m_colors.count();
        m_colors.append(srcPix);
        r.pixelCount = 1;
        // add new region
        int regionIndex = m_regions.count();
        m_regions.append(r);
        // update raster and colorTable
        regionScanLine[x] = regionIndex;
        colorTable.insert(srcPix, regionIndex);
        if (m_colors.count() > MaxColorCount) {
          return;
        }
      } else {
        // already defined color
        int regionIndex   = it.value();
        regionScanLine[x] = regionIndex;
        m_regions[regionIndex].pixelCount++;
      }
    }
  }
  m_valid = true;
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:50,代码来源:Naa2TlvConverter.cpp

示例2: do_over

void do_over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color)
{
	assert(rout->getSize() == rup->getSize());
	for (int y = rout->getLy(); --y >= 0;) {
		TPixel32 *out_pix = rout->pixels(y);
		TPixel32 *const out_end = out_pix + rout->getLx();
		const TPixelGR8 *up_pix = rup->pixels(y);

		for (; out_pix < out_end; ++out_pix, ++up_pix) {
			double v = up_pix->value / 255.0;
			TPixel32 up(troundp(v * color.r), troundp(v * color.g), troundp(v * color.b), troundp(v * color.m));
			*out_pix = overPix(*out_pix, up);
		}
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:15,代码来源:tover.cpp

示例3: my_do_over

//Usata tinylinetest
static void my_do_over(TRaster32P rout, const TRasterGR8P &rup)
{
	assert(rout->getSize() == rup->getSize());
	for (int y = rout->getLy(); --y >= 0;) {
		TPixel32 *out_pix = rout->pixels(y);
		TPixel32 *const out_end = out_pix + rout->getLx();
		const TPixelGR8 *up_pix = rup->pixels(y);

		for (; out_pix < out_end; ++out_pix, ++up_pix) {
			int v = up_pix->value;
			out_pix->r = out_pix->r * v / 255;
			out_pix->g = out_pix->r;
			out_pix->b = out_pix->r;
		}
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:17,代码来源:tover.cpp

示例4: copyAndSwapRBChannels

TRaster32P TRop::copyAndSwapRBChannels(const TRaster32P &srcRaster) {
  TRaster32P newRaster(srcRaster->getSize());
  int lx = srcRaster->getLx();
  int y  = srcRaster->getLy();
  srcRaster->lock();
  newRaster->lock();
  while (--y >= 0) {
    TPixel32 *pix    = srcRaster->pixels(y);
    TPixel32 *newpix = newRaster->pixels(y);
    TPixel32 *endPix = pix + lx;
    while (pix < endPix) {
      newpix->r = pix->b;
      newpix->g = pix->g;
      newpix->b = pix->r;
      newpix->m = pix->m;
      ++pix;
      ++newpix;
    }
  }
  srcRaster->unlock();
  newRaster->unlock();

  return newRaster;
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:24,代码来源:trop.cpp


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