本文整理汇总了C++中NodeAttribute::Blend方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeAttribute::Blend方法的具体用法?C++ NodeAttribute::Blend怎么用?C++ NodeAttribute::Blend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeAttribute
的用法示例。
在下文中一共展示了NodeAttribute::Blend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BlendAttributes
/********************************************************************************************
> BOOL BlendHelpers::BlendAttributes(BlendNodeParam * pParam, CCAttrMap* pBlendedAttrMap)
Author: David_McClarnon (Xara Group Ltd) <[email protected]> based on blender code
Created: 21/2/2000
Inputs: pParam - the blend node param
Outputs: -
Returns: TRUE if successful, FALSE otherwise
Purpose: Blends the attributes of the two BlendPath objects by the amount specified in BlendRatio
SeeAlso: -
********************************************************************************************/
BOOL BlendHelpers::BlendAttributes(BlendNodeParam * pParam, CCAttrMap* pBlendedAttrMap)
{
// Check entry params
double BlendRatio = pParam->GetAttrBlendRatio();
BOOL ok = (pParam != NULL && pBlendedAttrMap != NULL);
ERROR3IF(!ok,"One or more NULL entry params");
if (!ok) return FALSE;
// Find the attributes that are applied to the blend paths
BlendPath * pBlendPathStart = pParam->GetStartBlendPath();
BlendPath * pBlendPathEnd = pParam->GetEndBlendPath();
ok = (pBlendPathStart != NULL && pBlendPathEnd != NULL);
ERROR3IF(!ok, "Blend paths are NULL");
if (!ok) return FALSE;
ok = (pBlendPathStart->GetCreatedByNode() != NULL &&
pBlendPathEnd->GetCreatedByNode() != NULL);
ERROR3IF(!ok, "Blend path created by nodes are NULL");
if (!ok) return FALSE;
BOOL startExludeGLAs = TRUE, endExcludeGLAs = TRUE;
NodeAttribute * pAttr = NULL;
if(pBlendPathStart->GetCreatedByNode()->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFeather),&pAttr))
{
startExludeGLAs = FALSE;
}
if(pBlendPathEnd->GetCreatedByNode()->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFeather),&pAttr))
{
endExcludeGLAs = FALSE;
}
CCAttrMap* pAttrMapStart = CCAttrMap::MakeAppliedAttrMap(pBlendPathStart->GetCreatedByNode(), startExludeGLAs);
CCAttrMap* pAttrMapEnd = CCAttrMap::MakeAppliedAttrMap(pBlendPathEnd->GetCreatedByNode(), endExcludeGLAs);
if (!pAttrMapStart || !pAttrMapEnd)
return FALSE;
// find the attributes on the nodes
if (pParam->GetNodeBlendPath() != NULL)
{
Trans2DMatrix* pRotateStart = GetRotateMatrix(pParam->GetNodeStart(),
360.0 - pParam->GetAngleStart());
Trans2DMatrix* pRotateEnd = GetRotateMatrix(pParam->GetNodeEnd(),
360.0 - pParam->GetAngleEnd());
if (pRotateStart) pAttrMapStart->Transform(*pRotateStart);
if (pRotateEnd) pAttrMapEnd ->Transform(*pRotateEnd);
if (pRotateStart)
delete pRotateStart;
if (pRotateEnd)
delete pRotateEnd;
}
// These vars are used as params to the CCAttrMap funcs
CCRuntimeClass *pTypeStart;
void *pValStart;
void *pValEnd;
double OldBlendRatio = pParam->GetBlendRatio();
// Process each attribute in turn
CCAttrMap::iterator PosStart = pAttrMapStart->GetStartPosition();
CCAttrMap::iterator EndStart = pAttrMapStart->GetEndPosition();
for (;PosStart != EndStart;)
{
// Get a ptr to the attr at position PosStart in the start node's attr map
pAttrMapStart->GetNextAssoc(PosStart,pTypeStart,pValStart);
NodeAttribute* pNodeAttrStart = (NodeAttribute *)pValStart;
BlendRatio = OldBlendRatio;
// Diccon 10/99 When using non-linear profiles for the objects those attributes
// that make use of control points were not being profiled, making the objects look strange.
// to avoid this those attributes now share the same profiles as the objects.
if (pNodeAttrStart->IsAGradFill())
{
if (!((AttrFillGeometry*)pNodeAttrStart)->IsAColourFill())
{
BlendRatio = pParam->GetObjectRatio();
}
else
{
//.........这里部分代码省略.........