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


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

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


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

示例1: fillautoInks

//-----------------------------------------------------------------------------
// questa funzione viene chiamata dopo il fill rect delle aree, e colora gli
// inchiostri di tipo "autoink"
// che confinano con le aree appena fillate con il rect. rbefore e' il rect del
// raster prima del rectfill.
void fillautoInks(TRasterCM32P &rin, TRect &rect, const TRasterCM32P &rbefore,
                  TPalette *plt) {
  assert(plt);
  TRasterCM32P r = rin->extract(rect);
  assert(r->getSize() == rbefore->getSize());
  int i, j;

  for (i = 0; i < r->getLy(); i++) {
    TPixelCM32 *pix  = r->pixels(i);
    TPixelCM32 *pixb = rbefore->pixels(i);
    for (j = 0; j < r->getLx(); j++, pix++, pixb++) {
      int paint = pix->getPaint();
      int tone  = pix->getTone();
      int ink   = pix->getInk();
      if (paint != pixb->getPaint() && tone > 0 && tone < 255 && ink != paint &&
          plt->getStyle(ink)->getFlags() != 0)
        inkFill(rin, TPoint(j, i) + rect.getP00(), paint, 0, NULL, &rect);
    }
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:25,代码来源:fillutil.cpp

示例2: if

void Convert2Tlv::buildToonzRaster(TRasterCM32P &rout, const TRasterP &rin1, const TRasterP &rin2)
{
	if (rin2)
		assert(rin1->getSize() == rin2->getSize());

	rout->clear();

	std::cout << "      computing inks...\n";
	TRaster32P r1 = (TRaster32P)rin1;
	TRasterGR8P r1gr = (TRasterGR8P)rin1;
	TRaster32P r2 = (TRaster32P)rin2;
	TRasterGR8P r2gr = (TRasterGR8P)rin2;
	TRasterP rU, rP;

	if (r1gr) {
		rU = r1gr;
		rP = r2;
	} else if (r2gr) {
		rU = r2gr;
		rP = r1;
	} else if (!r1)
		rU = r2;
	else if (!r2)
		rU = r1;
	else if (firstIsUnpainted(r1, r2)) {
		rU = r1;
		rP = r2;
	} else {
		rU = r2;
		rP = r1;
	}

	TRasterCM32P r;
	if (rout->getSize() != rU->getSize()) {
		int dx = rout->getLx() - rU->getLx();
		int dy = rout->getLy() - rU->getLy();
		assert(dx >= 0 && dy >= 0);

		r = rout->extract(dx / 2, dy / 2, dx / 2 + rU->getLx() - 1, dy / 2 + rU->getLy() - 1);
	} else
		r = rout;

	if ((TRasterGR8P)rU)
		buildInksFromGrayTones(r, rU);
	else if (m_isUnpaintedFromNAA)
		buildInksForNAAImage(r, (TRaster32P)rU);
	else {
		int maxMatte = getMaxMatte((TRaster32P)rU);
		if (maxMatte == -1)
			buildInksFromGrayTones(r, rU);
		else {
			if (maxMatte < 255)
				normalize(rU, maxMatte);
			buildInks(r, (TRaster32P)rU /*rP,*/);
		}
	}

	if (m_autoclose)
		TAutocloser(r, AutocloseDistance, AutocloseAngle, 1, AutocloseOpacity).exec();

	if (rP) {
		std::cout << "      computing paints...\n";
		doFill(r, rP);
	}
	if (m_antialiasType == 2) //remove antialias
		removeAntialias(r);
	else if (m_antialiasType == 1) //add antialias
	{
		TRasterCM32P raux(r->getSize());
		TRop::antialias(r, raux, 10, m_antialiasValue);
		rout = raux;
	}
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:73,代码来源:convert2tlv.cpp

示例3: outDim

CleanupPreprocessedImage *TCleanupper::process(
	TRasterImageP &image, bool first_image, TRasterImageP &onlyResampledImage,
	bool isCameraTest, bool returnResampled, bool onlyForSwatch, TAffine *resampleAff)
{
	TAffine aff;
	double blur;
	TDimension outDim(0, 0);
	TPointD outDpi;

	bool isSameDpi = false;
	bool autocentered = getResampleValues(image, aff, blur, outDim, outDpi, isCameraTest, isSameDpi);
	if (m_parameters->m_autocenterType != AUTOCENTER_NONE && !autocentered)
		DVGui::MsgBox(DVGui::WARNING, QObject::tr("The autocentering failed on the current drawing."));

	bool fromGr8 = (bool)TRasterGR8P(image->getRaster());
	bool toGr8 = (m_parameters->m_lineProcessingMode == lpGrey);

	// If necessary, perform auto-adjust
	if (!isCameraTest && m_parameters->m_lineProcessingMode != lpNone && toGr8 && m_parameters->m_autoAdjustMode != AUTO_ADJ_NONE &&
		!onlyForSwatch) {
		static int ref_cum[256];
		UCHAR lut[256];
		int cum[256];
		double x0_src_f, y0_src_f, x1_src_f, y1_src_f;
		int x0_src, y0_src, x1_src, y1_src;

		//cleanup_message("Autoadjusting... \n");

		TAffine inv = aff.inv();

		x0_src_f = affMV1(inv, 0, 0);
		y0_src_f = affMV2(inv, 0, 0);
		x1_src_f = affMV1(inv, outDim.lx - 1, outDim.ly - 1);
		y1_src_f = affMV2(inv, outDim.lx - 1, outDim.ly - 1);

		x0_src = tround(x0_src_f);
		y0_src = tround(y0_src_f);
		x1_src = tround(x1_src_f);
		y1_src = tround(y1_src_f);

		set_autoadjust_window(x0_src, y0_src, x1_src, y1_src);

		if (!TRasterGR8P(image->getRaster())) {
			//Auto-adjusting a 32-bit image. This means that a white background must be introduced first.
			TRaster32P ras32(image->getRaster()->clone());
			TRop::addBackground(ras32, TPixel32::White);
			image = TRasterImageP(ras32); //old image is released here
			ras32 = TRaster32P();

			TRasterGR8P rgr(image->getRaster()->getSize());
			TRop::copy(rgr, image->getRaster());

			//This is now legit. It was NOT before the clone, since the original could be cached.
			image->setRaster(rgr);
		}
		switch (m_parameters->m_autoAdjustMode) {
		case AUTO_ADJ_HISTOGRAM: {
			if (first_image) {
				build_gr_cum(image, ref_cum);
			} else {
				build_gr_cum(image, cum);
				build_gr_lut(ref_cum, cum, lut);
				apply_lut(image, lut);
			}
		}

			CASE AUTO_ADJ_HISTO_L : histo_l_algo(image, first_image);

			CASE AUTO_ADJ_BLACK_EQ : black_eq_algo(image);

			CASE AUTO_ADJ_NONE : DEFAULT : assert(false);
		}
	}

	fromGr8 = (bool)TRasterGR8P(image->getRaster()); //may have changed type due to auto-adjust

	assert(returnResampled || !onlyForSwatch); //if onlyForSwatch, then returnResampled

	// Allocate output colormap raster
	TRasterCM32P finalRas;
	if (!onlyForSwatch) {
		finalRas = TRasterCM32P(outDim);
		if (!finalRas) {
			TImageCache::instance()->outputMap(outDim.lx * outDim.ly * 4, "C:\\cachelog");
			assert(!"failed finalRas allocation!");
			return 0;
		}
	}

	// In case the input raster was a greymap, we cannot reutilize finalRas's buffer to transform the final
	// fullcolor pixels to colormap pixels directly (1 32-bit pixel would hold 4 8-bit pixels) - therefore,
	// a secondary greymap is allocated.

	//NOTE: This should be considered obsolete? By using TRop::resample( <TRaster32P& instance> , ...) we
	//should get the same effect!!

	TRasterP tmp_ras;

	if (returnResampled || (fromGr8 && toGr8)) {
		if (fromGr8 && toGr8)
//.........这里部分代码省略.........
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:101,代码来源:tcleanupper.cpp

示例4: over

void TRop::over(TRasterP rout, const TRasterCM32P &rup, TPalette *palette, const TPoint &point, const TAffine &aff)
{
	TRaster32P app(rup->getSize());
	TRop::convert(app, rup, palette);
	TRop::over(rout, app, point, aff);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:6,代码来源:tover.cpp


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