#include <nodebldr.h>
Inheritance diagram for BlendBecomeA:
Public Member Functions | |
BlendBecomeA (BecomeAReason Reason, CCRuntimeClass *pClass, UndoableOperation *pOp, BlendRef *pThisBlendRef, INT32 ThisIndex, Progress *pThisProgress, BOOL IgnoreEsc, Trans2DMatrix *pMatrix) | |
BOOL | IsBlendBecomeA () |
virtual BOOL | PassBack (NodeRenderableInk *pNewNode, NodeRenderableInk *pCreatedByNode, CCAttrMap *pAttrMap) |
This is called by each node that is blended. When the blend tool asks an object to turn itself into loads of paths, it gives the object a BlendBecomeA ptr. The object calls the PassBack() method of BlendBecomeA (i.e. this routine) for each path that is generated. This generates a BlendPath for each sub-path in the given NodePath, and adds it to a blend reference object. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (BlendBecomeA) | |
NodeRenderableInk * | CreateWrapNode (NodeRenderableInk *pNode, NodeCompound *pTree, CCAttrMap *pMap) |
Private Attributes | |
BlendRef * | pBlendRef |
INT32 | Index |
UINT32 | SubPathID |
Progress * | pProgress |
BOOL | IgnoreEscape |
Trans2DMatrix * | m_pMatrix |
Definition at line 801 of file nodebldr.h.
|
Definition at line 805 of file nodebldr.h. 00812 : 00813 00814 BecomeA(Reason,pClass,pOp), 00815 pBlendRef(pThisBlendRef), 00816 Index(ThisIndex), 00817 SubPathID(0), 00818 pProgress(pThisProgress), 00819 IgnoreEscape(IgnoreEsc), 00820 m_pMatrix(pMatrix) { } ;
|
|
|
|
Definition at line 6456 of file nodebldr.cpp. 06458 { 06459 NodeCompound * pCompound = (NodeCompound *)pTree->FindFirstChild(CC_RUNTIME_CLASS(NodeCompound)); 06460 06461 if (pCompound) 06462 { 06463 // create a wrapped node for the compound node 06464 pNode = CreateWrapNode(pNode, pCompound, pMap); 06465 } 06466 06467 // create the wrapped node from the given compound node 06468 return pTree->CreateTreeFromNodeToBlend(pNode, pMap); 06469 }
|
|
Reimplemented from BecomeA. Definition at line 822 of file nodebldr.h. 00822 { return TRUE; }
|
|
This is called by each node that is blended. When the blend tool asks an object to turn itself into loads of paths, it gives the object a BlendBecomeA ptr. The object calls the PassBack() method of BlendBecomeA (i.e. this routine) for each path that is generated. This generates a BlendPath for each sub-path in the given NodePath, and adds it to a blend reference object.
NOTE: Once you give a BlendPath a NodePath, this becomes property of the BlendPath and can be altered and/or deleted by the BlendPath at any time. DO NOT KEEP A COPY OF THE PTR pThisNodePath!!! If you want a copy of the NodePath at pThisNodePath, make a new copy of the node. NOTE: If it fails, pNewNode will have to be deleted by the caller Reimplemented from BecomeA. Definition at line 6500 of file nodebldr.cpp. 06501 { 06502 ERROR2IF(pBlendRef == NULL,FALSE,"pBlendRef == NULL"); 06503 ERROR2IF(pNewNode == NULL,FALSE,"pNewNode == NULL"); 06504 06505 if (pProgress != NULL) 06506 { 06507 if (!pProgress->Update(pProgress->GetCount(1),TRUE) && !IgnoreEscape) 06508 return FALSE; 06509 } 06510 06511 Path* pInkPath = NULL; 06512 06513 Node * pPathNode = NULL; 06514 06515 // DMc 06516 // we have a game of let's pretend in here 06517 // because all passback nodes can only have 1 path node in them, 06518 // then let's get this node & set up the path appropriately 06519 if (pNewNode->IsNodePath()) 06520 { 06521 pInkPath = &(((NodePath*)pNewNode)->InkPath); 06522 pPathNode = (NodePath *)pNewNode; 06523 } 06524 else if (pNewNode->IsCompound()) 06525 { 06526 NodeRenderableInk * pNodeToBlend = ((NodeCompound *)pNewNode)->GetNodeToBlend(); 06527 06528 if (pNodeToBlend) 06529 { 06530 if (pNodeToBlend->IsNodePath()) 06531 { 06532 pInkPath = &(((NodePath *)pNodeToBlend)->InkPath); 06533 pPathNode = (NodePath *)pNodeToBlend; 06534 } 06535 } 06536 } 06537 06538 INT32 NumCoords = pInkPath->GetNumCoords(); 06539 INT32 StartIndex=0,EndIndex=0; 06540 UINT32 NumSubPaths=0; 06541 06542 Path TempPath; 06543 BOOL ok = TempPath.Initialise(NumCoords); 06544 06545 // All subpaths generated by this call will have the same subpath ID 06546 SubPathID++; 06547 06548 NodeRenderableInk * pTreeNode = NULL; 06549 06550 // This loop interates for each subpath in pInkPath. 06551 while (ok && StartIndex < NumCoords) 06552 { 06553 // Get the start and end indexes for the current subpath 06554 EndIndex = StartIndex; 06555 pInkPath->FindEndElOfSubPath(&EndIndex); 06556 06557 ERROR2IF(EndIndex >= NumCoords,FALSE,"EndIndex gone beyond num coords in path"); 06558 06559 // Clear the temp path we've set up, and copy the subpath into it 06560 TempPath.ClearPath(FALSE); 06561 ok = pInkPath->CopySectionTo(&TempPath,StartIndex,(EndIndex-StartIndex)+1); 06562 06563 if (ok) 06564 { 06565 // Make sure the filled and stroked flags are correct 06566 TempPath.IsFilled = pInkPath->IsFilled; 06567 TempPath.IsStroked = pInkPath->IsStroked; 06568 06569 if (m_pMatrix != NULL) 06570 m_pMatrix->Transform((DocCoord*)TempPath.GetCoordArray(), TempPath.GetNumCoords() ); 06571 06572 // Create a new NodePath for this subpath 06573 NodePath* pNewNodePath = new NodePath; 06574 ok = (pNewNodePath != NULL); 06575 if (ok) 06576 { 06577 // Copy the subpath in TempPath into the new NodePath's path object 06578 Path* pNewPath = &(pNewNodePath->InkPath); 06579 ok = pNewPath->Initialise(TempPath.GetNumCoords()); 06580 06581 if (ok) ok = pNewPath->CopyPathDataFrom(&TempPath); 06582 06583 if (ok) 06584 { 06585 // Create a new BlendPath obect 06586 BlendPath* pBlendPath = new BlendPath; 06587 ok = (pBlendPath != NULL); 06588 06589 // now, have we been passed a compound node ? 06590 // if so, wrap up the given node with the new node 06591 if (pNewNode->IsCompound()) 06592 { 06593 NodeRenderableInk * pWrapNode = CreateWrapNode(pNewNodePath, (NodeCompound *)pNewNode, pAttrMap); 06594 06595 if (!pWrapNode) 06596 return FALSE; 06597 06598 // set up its created by node 06599 ((NodeCompound *)pWrapNode)->SetBlendCreatedByNode(((NodeCompound *)pNewNode)->GetBlendCreatedByNode()); 06600 06601 // now, we can only have start blend nodes on first blend path, and we can 06602 // only have end blend nodes on the last blend path 06603 if (NumSubPaths != 0) 06604 { 06605 pTreeNode = pWrapNode; 06606 06607 while (pTreeNode && pTreeNode->IsCompound()) 06608 { 06609 if (((NodeCompound *)pTreeNode)->IsStartBlendGroupNode()) 06610 { 06611 ((NodeCompound *)pTreeNode)->SetStartBlendGroupNode(FALSE); 06612 } 06613 06614 pTreeNode = (NodeCompound *)pTreeNode->FindFirstChild(CC_RUNTIME_CLASS(NodeCompound)); 06615 } 06616 } 06617 06618 // reset end blend nodes 06619 if (EndIndex != NumCoords-1) 06620 { 06621 pTreeNode = pWrapNode; 06622 06623 while (pTreeNode && pTreeNode->IsCompound()) 06624 { 06625 if (((NodeCompound *)pTreeNode)->IsEndBlendGroupNode()) 06626 { 06627 ((NodeCompound *)pTreeNode)->SetEndBlendGroupNode(FALSE); 06628 } 06629 06630 pTreeNode = (NodeCompound *)pTreeNode->FindFirstChild(CC_RUNTIME_CLASS(NodeCompound)); 06631 } 06632 } 06633 06634 if (pWrapNode->IsCompound()) 06635 { 06636 if (((NodeCompound *)pWrapNode)->IsStartBlendGroupNode()) 06637 { 06638 TRACEUSER( "ChrisS", _T("BlendBecomeA::Start node\n")); 06639 } 06640 06641 if (((NodeCompound *)pWrapNode)->IsEndBlendGroupNode()) 06642 { 06643 TRACEUSER( "ChrisS", _T("BlendBecomeA::End node\n")); 06644 } 06645 } 06646 06647 if (ok) ok = pBlendPath->Initialise(pWrapNode,Index,pCreatedByNode,SubPathID,NumSubPaths,NULL); 06648 if (ok) ok = pBlendRef->AddBlendPath(pBlendPath); 06649 } 06650 else 06651 { 06652 // Initialise the BlendPath object with the generated NodePath 06653 // and add the BlendPath to the BlendRef 06654 if (ok) ok = pBlendPath->Initialise(pNewNodePath,Index,pCreatedByNode,SubPathID,NumSubPaths,pAttrMap); 06655 if (ok) ok = pBlendRef->AddBlendPath(pBlendPath); 06656 06657 if (IS_A (pNewNode, NodeBlendPath)) 06658 { 06659 pBlendPath->SetCreatedViaNodeBlendPath (TRUE); 06660 } 06661 } 06662 } 06663 } 06664 } 06665 Index = -1; 06666 StartIndex = EndIndex+1; // the start of the next subpath begins after the end of the last one 06667 06668 // Get the next sub path 06669 NumSubPaths++; 06670 } 06671 06672 if (pNewNode->IsCompound()) 06673 { 06674 pAttrMap->DeleteAttributes(); 06675 delete pAttrMap; 06676 } 06677 06678 if (ok) 06679 { 06680 pBlendRef->SetAWComplex(NumSubPaths > 1); // This is the 'complex' flag used when exporting to AW EPS 06681 pNewNode->CascadeDelete(); 06682 delete pNewNode; 06683 pNewNode = NULL; 06684 } 06685 06686 return (ok); 06687 06688 }
|
|
Definition at line 832 of file nodebldr.h. |
|
Definition at line 829 of file nodebldr.h. |
|
Definition at line 833 of file nodebldr.h. |
|
Definition at line 828 of file nodebldr.h. |
|
Definition at line 831 of file nodebldr.h. |
|
Definition at line 830 of file nodebldr.h. |