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


C++ TRasterImageP::getSavebox方法代码示例

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


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

示例1: build_gr_cum

void build_gr_cum(const TRasterImageP &image, int cum[256])
{
	int lx, ly, wrap, true_lx, true_ly;
	int i, x, y;
	UCHAR *pix, *buffer;
	int histo[256], raster_is_savebox;

	get_virtual_buffer(image, &lx, &ly, &wrap, &buffer);

	for (i = 0; i < 256; i++)
		histo[i] = 0;
	for (y = 0; y < ly; y++) {
		pix = buffer + y * wrap;
		for (x = 0; x < lx; x++)
			histo[*pix++]++;
	}

	raster_is_savebox = 1;
	TRect saveBox = image->getSavebox();
	if ((saveBox.getLx() > 0 && saveBox.getLx() < image->getRaster()->getLx()) ||
		(saveBox.getLy() > 0 && saveBox.getLy() < image->getRaster()->getLy()))
		raster_is_savebox = 0;

	if (raster_is_savebox) {
		true_lx = saveBox.getLx() ? saveBox.getLx() : image->getRaster()->getLx();
		true_ly = saveBox.getLy() ? saveBox.getLy() : image->getRaster()->getLy();
	} else {
		true_lx = image->getRaster()->getLx();
		true_ly = image->getRaster()->getLy();
	}
	histo[255] += true_lx * true_ly - lx * ly;

	build_cum(histo, cum);
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:34,代码来源:autoadjust.cpp

示例2: getResampleValues

bool TCleanupper::getResampleValues(const TRasterImageP &image, TAffine &aff, double &blur,
									TDimension &outDim, TPointD &outDpi, bool isCameraTest, bool &isSameDpi)
{
	double outlp, outlq;
	double scalex, scaley;
	double cxin, cyin, cpout, cqout;
	double max_blur;
	TPointD dpi;

	// Locking the input image to be cleanupped
	image->getRaster()->lock();

	// Retrieve image infos
	int rasterLx = image->getRaster()->getLx();
	int rasterLy = image->getRaster()->getLy();

	/*---入力画像サイズとSaveBoxのサイズが一致しているか?の判定---*/
	TRect saveBox = image->getSavebox();
	bool raster_is_savebox = true;
	if (saveBox == TRect() && (saveBox.getLx() > 0 && saveBox.getLx() < rasterLx ||
							   saveBox.getLy() > 0 && saveBox.getLy() < rasterLy))
		raster_is_savebox = false;

	image->getDpi(dpi.x, dpi.y);
	if (dpi == TPointD()) {
		dpi = getCustomDpi();
		if (dpi == TPointD())
			dpi.x = dpi.y = 65.0; //using 65.0 as default DPI
	} else if (!dpi.x)
		dpi.x = dpi.y;
	else if (!dpi.y)
		dpi.y = dpi.x;

	// Retrieve some cleanup parameters
	int rotate = m_parameters->m_rotate;

	//Build scaling/dpi data
	{
		m_parameters->getOutputImageInfo(outDim, outDpi.x, outDpi.y);

		// input -> output scale factor
		scalex = outDpi.x / dpi.x;
		scaley = outDpi.y / dpi.y;

		outlp = outDim.lx;
		outlq = outDim.ly;
	}

	/*--- 拡大/縮小をしていない場合(DPIが変わらない場合)、NearestNeighborでリサンプリングする。---*/
	isSameDpi = areAlmostEqual(outDpi.x, dpi.x, 0.1) && areAlmostEqual(outDpi.y, dpi.y, 0.1);

	// Retrieve input center
	if (raster_is_savebox) {
		cxin = -saveBox.getP00().x + (saveBox.getLx() - 1) / 2.0;
		cyin = -saveBox.getP00().y + (saveBox.getLy() - 1) / 2.0;
	} else {
		cxin = (rasterLx - 1) / 2.0;
		cyin = (rasterLy - 1) / 2.0;
	}

	// Retrieve output center
	cpout = (outlp - 1) / 2.0;
	cqout = (outlq - 1) / 2.0;
	// Perform autocenter if any is found
	double angle = 0.0;
	double skew = 0.0;
	TAffine pre_aff;
	image->getRaster()->lock();

	bool autocentered =
		doAutocenter(
			angle, skew,
			cxin, cyin, cqout, cpout,
			dpi.x, dpi.y,
			raster_is_savebox, saveBox,
			image, scalex);
	image->getRaster()->unlock();

	// Build the image transform as deduced by the autocenter
	if (m_parameters->m_autocenterType == AUTOCENTER_CTR && skew) {
		pre_aff.a11 = cos(skew * TConsts::pi_180);
		pre_aff.a21 = sin(skew * TConsts::pi_180);
	}

	aff = (TScale(scalex, scaley) * pre_aff) * TRotation(angle);
	aff = aff.place(cxin, cyin, cpout, cqout);

	// Apply eventual additional user-defined transforms
	TPointD pout = TPointD((outlp - 1) / 2.0, (outlq - 1) / 2.0);

	if (m_parameters->m_rotate != 0)
		aff = TRotation(-(double)m_parameters->m_rotate).place(pout, pout) * aff;

	if (m_parameters->m_flipx || m_parameters->m_flipy)
		aff = TScale(m_parameters->m_flipx ? -1 : 1, m_parameters->m_flipy ? -1 : 1).place(pout, pout) * aff;

	if (!isCameraTest)
		aff = TTranslation(m_parameters->m_offx * outDpi.x / 2, m_parameters->m_offy * outDpi.y / 2) * aff;

	max_blur = 20.0 * sqrt(fabs(scalex /*** * oversample_factor ***/));
//.........这里部分代码省略.........
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:101,代码来源:tcleanupper.cpp


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