本文整理汇总了C++中Path::GetCoordArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::GetCoordArray方法的具体用法?C++ Path::GetCoordArray怎么用?C++ Path::GetCoordArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::GetCoordArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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);
}
示例3: BlendPaths
/********************************************************************************************
> BOOL BlendHelpers::BlendPaths(BlendNodeParam * pParam, Path * pPath)
Author: David_McClarnon (Xara Group Ltd) <[email protected]>
Created: 21/2/2000
Inputs: The blend node parameter
Outputs: The blended path is stored in three arrays: the coords, the verbs, and the flags.
The arrays are:
pTempCoords
pTempVerbs
pTempFlags
ArrayLength = the length of all three arrays
This allows the caller to decide what to do with the blended path in a very flexible way.
Returns: TRUE if successful, FALSE otherwise
Purpose: Blends two BlendPath objects by the amount specified in BlendRatio
SeeAlso: -
********************************************************************************************/
BOOL BlendHelpers::BlendPaths(BlendNodeParam * pParam, Path * pPath)
{
// Check entry params
BlendPath * pBlendPathStart = pParam->GetStartBlendPath();
BlendPath * pBlendPathEnd = pParam->GetEndBlendPath();
ERROR2IF(!pBlendPathStart->GetBlendNode()->IsNodePath(), FALSE,
"Start blend path's node isn't a node path");
ERROR2IF(!pBlendPathEnd->GetBlendNode()->IsNodePath(), FALSE,
"End blend path's node isn't a node path");
BOOL ok = (pBlendPathStart != NULL && pBlendPathEnd != NULL);
if (ok) ok = (pBlendPathStart->GetBlendNode() != NULL && pBlendPathEnd->GetBlendNode() != NULL);
ERROR3IF(!ok,"One or more NULL entry params");
if (!ok) return FALSE;
// Get the types of the two paths
PathTypeEnum PathTypeStart = pBlendPathStart->GetPathType();
PathTypeEnum PathTypeEnd = pBlendPathEnd ->GetPathType();
// The blended path will be closed if either of the paths is a shape
BOOL Closed = (PathTypeStart == PATHTYPE_SHAPE) || (PathTypeEnd == PATHTYPE_SHAPE);
Path * pPathStart = NULL;
// Find the paths associated with the start and end blend paths
if (pBlendPathStart->GetBlendNode()->IsNodePath())
{
pPathStart = &(((NodePath *)pBlendPathStart->GetBlendNode())->InkPath);
}
Path * pPathEnd = NULL;
if (pBlendPathEnd->GetBlendNode()->IsNodePath())
{
pPathEnd = &(((NodePath *)pBlendPathEnd->GetBlendNode())->InkPath);
}
// Calculate how large the arrays have to be to store the blended path definition
INT32 DestPathSize = ((pPathStart->GetNumCoords()+pPathEnd->GetNumCoords())*3)+500;
// Get some arrays used to hold the blended path data, and error if any are NULL
DocCoord* pDestCoords = GetCoordArray(DestPathSize);
PathVerb* pDestVerbs = GetVerbArray(DestPathSize);
PathFlags* pDestFlags = GetFlagArray(DestPathSize);
UINT32* pBuff = GetGBlendBuff(DestPathSize);
if (pDestCoords == NULL || pDestVerbs == NULL || pDestFlags == NULL || pBuff == NULL)
return FALSE;
// This section copes with the case when blending a line with a shape.
// In this case we need to get a temp path the is actually a shape version of the line.
// The line is simply reversed back onto itself to form a shape that would look identical to the
// line if rendered. This allows the line to appear to open up to the shape when blended.
Path Shape;
if (PathTypeStart != PathTypeEnd)
{
BOOL ok = FALSE;
if (!Shape.Initialise()) return FALSE;
// if going from a line to a shape, convert the start path to a shape
if (PathTypeStart == PATHTYPE_LINE && PathTypeEnd == PATHTYPE_SHAPE)
{
ok = NodeBlender::ConvertLineToShape(pPathStart,&Shape);
pPathStart = &Shape;
}
// if going from a shape to a line, convert the end path to a shape
if (PathTypeStart == PATHTYPE_SHAPE && PathTypeEnd == PATHTYPE_LINE)
{
ok = NodeBlender::ConvertLineToShape(pPathEnd,&Shape);
pPathEnd = &Shape;
}
if (!ok) return FALSE;
}
// The blend should do a one-to-one mapping when the OneToOne flag is set AND both paths
//.........这里部分代码省略.........