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


C++ TVectorImageP::clone方法代码示例

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


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

示例1: tween

TVectorImageP MyInbetweener::tween(double t)
{
	TVectorImageP vi = m_vi0->clone();
	int n = tmin(m_vi0->getStrokeCount(), m_vi1->getStrokeCount());
	for (int i = 0; i < n; i++) {
		TStroke *stroke0 = m_vi0->getStroke(i);
		TStroke *stroke1 = m_vi1->getStroke(i);
		TStroke *stroke = vi->getStroke(i);
		int m = tmin(stroke0->getControlPointCount(), stroke1->getControlPointCount());
		for (int j = 0; j < m; j++) {
			TThickPoint p0 = stroke0->getControlPoint(j);
			TThickPoint p1 = stroke1->getControlPoint(j);
			TThickPoint p = (1 - t) * p0 + t * p1;
			stroke->setControlPoint(j, p);
		}
		/*
    for(int j=2;j+2<m;j+=2)
    {
      TThickPoint p0 = stroke0->getControlPoint(j-2);
      TThickPoint p1 = stroke0->getControlPoint(j-1);
      TThickPoint p2 = stroke0->getControlPoint(j);
      TThickPoint p3 = stroke0->getControlPoint(j+1);
      TThickPoint p4 = stroke0->getControlPoint(j+2);
      if(tdistance2(p0,p1)<0.001 && tdistance2(p3,p4)<0.001)
      {
        p2 = 0.5*(p1+p2);
        stroke->setControlPoint(j,p2);
      }
    }
    */
	}
	return vi;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:33,代码来源:inbetweencommand.cpp

示例2: updateLevel

	void updateLevel()
	{
		TTool::Application *app = TTool::getApplication();
		if (!app->getCurrentLevel()->getLevel())
			return;
		TXshSimpleLevelP xl = app->getCurrentLevel()->getLevel()->getSimpleLevel();
		if (app->getCurrentFrame()->getFrameType() != TFrameHandle::LevelFrame)
			return;

		TFrameId fid = app->getCurrentFrame()->getFid();
		TVectorImageP src = xl->getFrame(fid, true);
		int count = src->getStrokeCount();

		for (int i = 1; i < 10; i++) {
			++fid;
			if (!xl->isFid(fid)) {
				TVectorImageP vi = new TVectorImage();
				xl->setFrame(fid, vi);
			}
			TVectorImageP vi = xl->getFrame(fid, true);
			TVectorImageP dst = src->clone();
			deform(dst.getPointer(), src.getPointer(), (double)i / (double)9);
			count = dst->getStrokeCount();
			vi->mergeImage(dst, TAffine());
			app->getCurrentTool()->getTool()->notifyImageChanged(fid);
		}
	}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:27,代码来源:morphtool.cpp

示例3: vectorToFullColorImage

//!Converts a TVectorImage into a TRasterImage. The input vector image
//!is transformed through the passed affine \b aff, and put into a
//!TRasterImage strictly covering the bounding box of the transformed
//!vector image. The output image has its lower-left position in the
//!world reference specified by the \b pos parameter, which is granted to
//!be an integer displacement of the passed value. Additional parameters
//!include an integer \b enlarge by which the output image is enlarged with
//!respect to the transformed image's bbox, and the bool \b transformThickness
//!to specify whether the transformation should involve strokes' thickensses
//!or not.
TRasterImageP TRasterImageUtils::vectorToFullColorImage(
	const TVectorImageP &vimage, const TAffine &aff, TPalette *palette,
	const TPointD &outputPos, const TDimension &outputSize,
	const std::vector<TRasterFxRenderDataP> *fxs, bool transformThickness)
{
	if (!vimage || !palette)
		return 0;

	//Transform the vector image through aff
	TVectorImageP vi = vimage->clone();
	vi->transform(aff, transformThickness);

	//Allocate the output ToonzImage
	TRaster32P raster(outputSize.lx, outputSize.ly);
	raster->clear();
	TRasterImageP ri(raster);
	ri->setPalette(palette->clone());

	//Shift outputPos to the origin
	vi->transform(TTranslation(-outputPos));

	int strokeCount = vi->getStrokeCount();
	std::vector<int> strokeIndex(strokeCount);
	std::vector<TStroke *> strokes(strokeCount);
	int i;
	for (i = 0; i < strokeCount; ++i) {
		strokeIndex[i] = i;
		strokes[i] = vi->getStroke(i);
	}
	vi->notifyChangedStrokes(strokeIndex, strokes);

	int maxStyleId = palette->getStyleCount() - 1;
	for (i = 0; i < (int)vi->getRegionCount(); ++i) {
		TRegion *region = vi->getRegion(i);
		fastAddPaintRegion(ri, region, tmin(maxStyleId, region->getStyle()), maxStyleId);
	}

	set<int> colors;
	if (fxs) {
		for (i = 0; i < (int)fxs->size(); i++) {
			SandorFxRenderData *sandorData = dynamic_cast<SandorFxRenderData *>((*fxs)[i].getPointer());
			if (sandorData && sandorData->m_type == BlendTz) {
				std::string indexes = toString(sandorData->m_blendParams.m_colorIndex);
				std::vector<std::string> items;
				parseIndexes(indexes, items);
				PaletteFilterFxRenderData paletteFilterData;
				insertIndexes(items, &paletteFilterData);
				colors = paletteFilterData.m_colors;
				break;
			}
		}
	}

	for (i = 0; i < strokeCount; ++i) {
		TStroke *stroke = vi->getStroke(i);

		bool visible = false;
		int styleId = stroke->getStyle();
		TColorStyleP style = palette->getStyle(styleId);
		assert(style);
		int colorCount = style->getColorParamCount();
		if (colorCount == 0)
			visible = true;
		else {
			visible = false;
			for (int j = 0; j < style->getColorParamCount() && !visible; j++) {
				TPixel32 color = style->getColorParamValue(j);
				if (color.m != 0)
					visible = true;
			}
		}
		if (visible)
			fastAddInkStroke(ri, stroke, TRectD(), 1, true);
	}
	return ri;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:86,代码来源:trasterimageutils.cpp


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