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


C++ Path::CopyPathDataFrom方法代码示例

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


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

示例1: FindBoundsAt

DocRect ArrowRec::FindBoundsAt(const DocCoord& ArrowCentre, const DocCoord& Direction, 
							   INT32 ParentLineWidth)
{
	DocRect Bounds(0,0,0,0);

	// Find a matrix to transform the ArrowHead to this Position.
	Trans2DMatrix Trans;
	GetArrowMatrix(ArrowCentre, Direction, ParentLineWidth, &Trans);

	// Note:
	// We should really be able to ask Gavin to Calculate the Bounds,
	// and pass him this Transform Matrix, but he can't do this at the
	// moment, so we'll have to actually transform the path into
	// a tempory path, and then ask him to calc the bounds of that.

	// Make a tempory path to transform
	Path* TransPath = new Path();
	if (TransPath == NULL)
		return Bounds;

	// Copy the path data from the ArrorHead into our tempory path.
	BOOL 	ok = TransPath->Initialise(ArrowShape->GetNumCoords());
	if (ok) ok = TransPath->CopyPathDataFrom(ArrowShape);

	if (!ok)
	{
		// Tidy up if we failed
		delete TransPath;
		return Bounds;
	}

	// Go transform the Tempory path
	Trans.Transform(TransPath->GetCoordArray(), 
					TransPath->GetNumCoords() );

	BOOL GDrawResult = FALSE;
	
	// Find out what the paths bounding rect is, taking into account
	// any bezier curve thingies. 

	GDrawContext *GD = GRenderRegion::GetStaticDrawContext();
	
	if (GD != NULL)
		GDrawResult = GD->CalcStrokeBBox((POINT*)TransPath->GetCoordArray(),
											TransPath->GetVerbArray(), TransPath->GetNumCoords(),
											(RECT *)(&Bounds),
											TRUE, 0, CAPS_ROUND, JOIN_ROUND, NULL) == 0;

	// If Gavin failed, then use backup technique of getting coord array bounds
	if (!GDrawResult)
		Bounds = TransPath->GetBoundingRect();

	// Delete the temporary transformed path
	delete TransPath;

	return Bounds;
}
开发者ID:vata,项目名称:xarino,代码行数:57,代码来源:arrows.cpp

示例2: AddPathToImagemap

void ImagemapRenderRegion::AddPathToImagemap(Path* ppthToAdd, WebAddressAttribute* pwaaCurrent)
{
	//First get the origin of the export area and the DPI
	DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea);
	double dDPI=m_Options.m_dDPI;

	//Now, how many subpaths are there in this path?
	INT32 lNumSubpaths=ppthToAdd->GetNumSubpaths();

	//For each subpath in the path
	for (INT32 l=0; l<lNumSubpaths; l++)
	{
		//Create a new path
		Path pthSubpath;

		pthSubpath.Initialise(ppthToAdd->GetNumCoords());

		//And copy the next subpath into it
		ppthToAdd->MakePathFromSubPath(l, &pthSubpath);

		//Now, if that subpath is closed
		if (pthSubpath.IsSubPathClosed(0))
		{
			//Then we want to add it to the imagemap

			//So scale it to dDPI and by dcOrigin
			pthSubpath.Scale(dcOrigin, dDPI);
	
			//Now we need to flatten it.
			//This means creating a new path, because otherwise Path::Flatten
			//goes wrong

			Path pthFlattened;

			pthFlattened.Initialise(pthSubpath.GetNumCoords());

			//So, if we should flatten the path
			if (m_Options.m_ffApprox!=FF_NOTATALL)
				//Then do it
				pthSubpath.Flatten(m_Options.m_ffApprox, &pthFlattened);
			else
				//Otherwise, simply copy the path across
				pthFlattened.CopyPathDataFrom(&pthSubpath);

			//Then add the flattened path to the imagemap
			m_Imagemap.AddPolygon(&pthFlattened, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame);
		}
	}
			
	
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:51,代码来源:filtirr.cpp

示例3: AddCircleToImagemap

void ImagemapRenderRegion::AddCircleToImagemap(Path* ppthToScale, WebAddressAttribute* pwaaCurrent)
{
	//First get the origin of the export area and the DPI
	DocCoord dcOrigin=ImagemapFilterOptions::GetOriginOfExportArea(m_Options.m_stExportArea);
	double dDPI=m_Options.m_dDPI;

	//Now make a copy of the path
	Path pthToAdd;
	
	pthToAdd.Initialise(ppthToScale->GetNumCoords());

	pthToAdd.CopyPathDataFrom(ppthToScale);

	//Scale it
	pthToAdd.Scale(dcOrigin, dDPI);

	//And add it to the imagemap
	m_Imagemap.AddCircle(&pthToAdd, pwaaCurrent->m_url.GetWebAddress(), pwaaCurrent->m_pcFrame);
	
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:20,代码来源:filtirr.cpp

示例4: TTFAddString


//.........这里部分代码省略.........
            ok = GetTextExtentPoint(ScreenDC, *text, (pCurrentChar-(TCHAR*)(*text)), &StringSize);
            ERROR3IF(!ok, "GetTextExtentPoint32() failed");
            if (!ok) break;

            // Get the characters path
            DWORD PathSize = 0;
            ok = TextManager::GetBezierFromChar(&SysDisplay, wchr, pLogFont, &PathSize, (POINT *)NULL, (BYTE *)NULL);
            if (!ok)
            {
                wchr = FontDefaultCharacter;
                ok = TextManager::GetBezierFromChar(&SysDisplay, wchr, pLogFont, &PathSize, (POINT *)NULL, (BYTE *)NULL);
            }
            ERROR3IF(!ok, "GetBezierFromChar returned false");
            if (!ok) break;

            // Pointer to an array of path coordinates
            if(pPolyCordBuffer == NULL)
            {
                TRY
                {
                    pPolyCordBuffer = new DocCoord[PathSize];
                }
                CATCH (CMemoryException, e)
                {
                    pPolyCordBuffer = NULL;
                    /*ERROR(_R(IDS_OUT_OF_MEMORY), FALSE);*/
                }
                END_CATCH
            }

            // Pointer to an array of path verbs
            if(pPolyVerbBuffer == NULL)
            {
                TRY
                {
                    pPolyVerbBuffer = new PathVerb[PathSize];
                }
                CATCH (CMemoryException, e)
                {
                    pPolyVerbBuffer = NULL;
                    /*ERROR(_R(IDS_OUT_OF_MEMORY), FALSE);*/
                }
                END_CATCH
            }

            if (pPolyCordBuffer == NULL || pPolyVerbBuffer == NULL)
            {
                ok = FALSE;
                break;
            }

            CurrentPathSizeAlloc = PathSize;

            // Fill up the buffers until they're bursting with fontyness
            ok = TextManager::GetBezierFromChar(&SysDisplay, wchr, pLogFont, &PathSize, (POINT *)pPolyCordBuffer,
                                                (BYTE *)pPolyVerbBuffer);
            if(!ok) TRACEUSER( "Richard", _T("GetBezierFromChar returned false in second phase...\n"));
            if(!ok)	break;

            // Spaces set PathSize to zero
            if((PathSize > 0)/* && (pPath != NULL)*/)
            {
                pPath = new Path();
                pPath->Initialise(PathSize, 12);
                pPath->CopyPathDataFrom(pPolyCordBuffer, pPolyVerbBuffer, PathSize, TRUE);

                // Major bodge at present with the x spacing...
                Matrix scale(XScale, 0, 0, YScale, (INT32)((XScale*StringSize.cx*72000)/(double)DPI), (INT32)YShift);

                pTransform = new Trans2DMatrix(scale);
                pPathCoords = pPath->GetCoordArray();
                pTransform->Transform( pPathCoords, pPath->GetNumCoords() );
                delete pTransform;

                pPath->InitialiseFlags();

                ok = ALU->GradFillPath(pPath, ForeColour, ForeColour, 0, 0, 0,/*Xsize/2,*/ Ysize, S2BMP_ANTIALIAS);
                ERROR3IF(!ok, "Gradfillpath returned false");
                if(!ok)	break;

                delete pPath;
            }

            // S2BMP_MAGIC is the worderfully fabby constant that mark's getbezierfromchar returns
            // Theory goes that he's going to sort this out sometime...
            if(CurrentPathSizeAlloc != S2BMP_MAGIC)
            {
                delete []pPolyCordBuffer;
                delete []pPolyVerbBuffer;

                pPolyCordBuffer = NULL;
                pPolyVerbBuffer = NULL;
                CurrentPathSizeAlloc = 0;
            }

            pPath = NULL;
            pTransform = NULL;

            pCurrentChar = camStrinc(pCurrentChar);
        }
开发者ID:eradman,项目名称:xara-cairo,代码行数:101,代码来源:fontpgen.cpp


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