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


C++ Contour::InvNform方法代码示例

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


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

示例1: RenderImages

void ViewPort::RenderImages( RECT region, double pixel_size, double offset_x, double offset_y, bool use_proxy )
{
	Transform *transform;									// render image onto view using pixel_size
	Point *p, min, max;
	Contour *domain;
	RECT r, labeled;
	double x, y, area;
	int index, i;
	char txt[128];
	Image_Ptr images[MAX_DOMAINS];						// number of domains is limited by 8bit mask size
	Nform_Ptr nforms[MAX_DOMAINS];
	POINT mins[MAX_DOMAINS], maxs[MAX_DOMAINS];
// begin debug logging...
	DWORD byteswritten;
	char line[MAX_PATH];
	if ( debugLogFile != INVALID_HANDLE_VALUE )
		{
		sprintf(line,"Entered ViewPort::RenderImages\r\n");
		WriteFile(debugLogFile, line, strlen(line), &byteswritten, NULL);
		}
// ...end debug logging
startTime3 = GetTickCount();
															// check for valid render region
	if ( (region.right - region.left) < 0 ) return;
	if ( (region.bottom - region.top) < 0 ) return;
															// limit render region to view pixels
	if ( region.left < 0 ) r.left = 0; else r.left = region.left;
	if ( region.right >= width ) r.right = width-1; else r.right = region.right;
	if ( region.top < 0 ) r.top = 0; else r.top = region.top;
	if ( region.bottom >= height ) r.bottom = height-1; else r.bottom = region.bottom;
	
	ClearImages( r );								// clear the region to all zeros before rendering
	
	for (index=0; index < MAX_DOMAINS; index++)		// clear the image and nform pointer arrays
		{
		images[index] = NULL;
		nforms[index] = NULL;
		}

	if ( section->transforms )
		{											// FIRST PASS... Create index mask for images on view
		index = 0;													// count every domain in section with index
		transform = section->transforms->first;						// render in order, back to front
		while ( transform && (index < MAX_DOMAINS) )
			{			
			if ( transform->image ) 								// do only if image is present and not hidden
				{
				if ( transform->domain && !transform->domain->hidden )
					{												// use domain boundary to define render area...
					index++;										
					domain = new Contour( *(transform->domain) );	// create a copy of domain
					domain->Scale( transform->image->mag );			// go from pixels to units
					domain->InvNform( transform->nform );			// transform into section
					domain->Shift( -offset_x, -offset_y );			// shift from view offset			
					labeled = view->Mask( domain, pixel_size, index, r );	// label pixels for rendering
					if ( labeled.left <= labeled.right )			// only use if some interior pixels were set
						{									
						images[index] = transform->image;			// store ptr to image for later rendering step
						nforms[index] = transform->nform;
						mins[index].x = labeled.left; mins[index].y = labeled.top;
						maxs[index].x = labeled.right; maxs[index].y = labeled.bottom;
						}
					delete domain;									// delete copy of domain
					}
				}
			transform = transform->next;				// do next transform in list
			}

		while ( index > 0 )							// SECOND PASS... render each indexed subregion from image sources
			{										
			view->MaskXform( images[index], nforms[index], index, mins[index], maxs[index],
																	pixel_size, offset_x, offset_y, use_proxy );
			index--;
			}
		}
totalTime3 += GetTickCount() - startTime3;	// DEBUGGING
nTime3++;
}
开发者ID:meawoppl,项目名称:reconstruct-1101,代码行数:78,代码来源:viewport.cpp


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