#include <nodebldr.h>
Inheritance diagram for BlendRef:
Public Member Functions | |
BlendRef () | |
Default constructor. | |
~BlendRef () | |
Default destructor. | |
BOOL | Initialise (NodeRenderableInk *pThisNode, INT32 Index, UndoableOperation *pUndoOp, Progress *pProgress, BOOL IgnoreEscape, Trans2DMatrix *pMatrix, AttrBrushType *pAttrBrush=NULL) |
This inits the BlendRef object with the given node.This inits the BlendRef object with the given node. | |
BOOL | InitialiseForBrush (NodeRenderableInk *pThisNode) |
This inits the BlendRef object with the given node. | |
NodeRenderableInk * | GetNode () |
void | Transform (TransformBase &Trans) |
Transforms all the BlendPaths attached to this blend reference. | |
void | RenderBlendBlobs (RenderRegion *pRender, Trans2DMatrix *pMatrix) |
Renders all the blend blobs associated with all the blend paths in this blend ref. | |
void | PreBlend () |
Called just before a blender node is about to do its blend. It asks all its blend paths to find their applied attributes. | |
void | PostBlend () |
Called just after a blender node has done its blend. It asks all its blend paths to free their applied attributes. | |
CCAttrMap * | FindAppliedAttributes (BlendPath *pBlendPath) |
Use this to get the attrs of a blend path that belongs to this blend reference. It keeps its own map keyed by the node which created the blend path, so that FindAppliedAttributes() is only called once for each node that created blend paths, rather than once for every blend path produced by the node (potentially many). | |
BOOL | AddBlendPath (BlendPath *pBlendPath) |
Add the blend path object to this blend ref NOTE: Once you add a BlendPath to a BlendRef, it becomes property of the BlendRef which can alter/delete it at any time. DO NOT KEEP A COPY OF THE PTR pBlendPath!!!! It may not be there next time use it. | |
UINT32 | GetNumBlendPaths () |
BlendPath * | GetFirstBlendPath () |
Lets you get the first blend path in the list. | |
BlendPath * | GetNextBlendPath (BlendPath *pCurrentBlendPath) |
Lets you get the next blend path in the list. | |
BlendPath * | GetBlendPath (INT32 Index) |
Lets you get the nth blend path in the list. | |
BOOL | IsPointOverBlob (DocCoord *pPointerPos, BlendPath **ppBlendPath, INT32 *pIndex, Trans2DMatrix *pMatrix) |
This sees if the point given lies on a selected blob. If a match is found, the ptr to the blend path and index to blob element is returned. | |
INT32 | GetOrigMapping () |
The path in question could well have been remapping (i.e. rotated to change the el at index 0) many times. This func returns the mapping (i.e. the index of the el that should be at index 0) that should be appied to the original path in order to get the same result. If the ref has more than one blend path, -1 is returned, meaning choose a default element as the start node (e.g. left most, bottom most element). | |
void | SetAWComplex (BOOL state) |
BOOL | GetAWComplex () |
DocRect | GetBoundingRect () |
BOOL | RemoveLastBlendPath () |
Not a function that most people will have cause to use, removes the tail item in the blendpath list. | |
void | StripRedundantNodeBlendPaths (BlendRef *spouse) |
Strips redundant NodeBlendPaths from the blend refs. This is needed in the case that we are required to blend a blend on a both to a non-blend on a path (and vice versa). | |
Protected Attributes | |
NodeRenderableInk * | m_pNode |
List | m_BlendPathList |
UINT32 | m_NumBlendPaths |
CMapPtrToPtr * | m_pBlendPathAttrMap |
BOOL | m_AWComplex |
Private Member Functions | |
CC_DECLARE_MEMDUMP (BlendRef) |
Definition at line 285 of file nodebldr.h.
|
Default constructor.
Definition at line 4066 of file nodebldr.cpp. 04067 { 04068 m_pNode = NULL; 04069 m_NumBlendPaths = 0; 04070 m_pBlendPathAttrMap = NULL; 04071 }
|
|
Default destructor.
Definition at line 4086 of file nodebldr.cpp. 04087 { 04088 m_BlendPathList.DeleteAll(); 04089 DELPTR(m_pBlendPathAttrMap); 04090 }
|
|
Add the blend path object to this blend ref NOTE: Once you add a BlendPath to a BlendRef, it becomes property of the BlendRef which can alter/delete it at any time. DO NOT KEEP A COPY OF THE PTR pBlendPath!!!! It may not be there next time use it.
Definition at line 4290 of file nodebldr.cpp. 04291 { 04292 m_BlendPathList.AddTail(pBlendPath); 04293 m_NumBlendPaths++; 04294 04295 return TRUE; 04296 }
|
|
|
|
Use this to get the attrs of a blend path that belongs to this blend reference. It keeps its own map keyed by the node which created the blend path, so that FindAppliedAttributes() is only called once for each node that created blend paths, rather than once for every blend path produced by the node (potentially many).
Definition at line 4552 of file nodebldr.cpp. 04553 { 04554 // If the attrs applied to this blend path are unique to the blend path (i.e. not the same 04555 // as the attrs applid to the node that created the blend path) return the unique attrs 04556 if (pBlendPath->UniqueAppliedAttrs()) 04557 return (pBlendPath->FindAppliedAttributes()); 04558 04559 // If we haven't got a map of attr maps yet, try the blend path directly 04560 if (m_pBlendPathAttrMap == NULL) 04561 return (pBlendPath->FindAppliedAttributes()); 04562 04563 // pAttrMap will hold the attrs applied to pBlendPath 04564 CCAttrMap* pAttrMap = NULL; 04565 04566 // the map of attr maps is keyed by the ptr to the node that created the blend path 04567 NodeRenderableInk* pCreatedByNode = pBlendPath->GetCreatedByNode(); 04568 04569 if (pCreatedByNode->IsCompound()) 04570 { 04571 pCreatedByNode = ((NodeCompound *)pCreatedByNode)->GetNodeToBlend(); 04572 } 04573 04574 if (pCreatedByNode != NULL) 04575 { 04576 // Do we have an attr map for pCreatedByNode? 04577 CMapPtrToPtr::iterator iter = m_pBlendPathAttrMap->find( pCreatedByNode ); 04578 if( m_pBlendPathAttrMap->end() != iter ) 04579 pAttrMap = (CCAttrMap *)iter->second; 04580 else 04581 { 04582 // If not, get the blend path to return us an attr map 04583 // and put the ptr in our map of attr maps, keyed by pCreatedByNode. 04584 pAttrMap = pBlendPath->FindAppliedAttributes(); 04585 if (pAttrMap != NULL) 04586 (*m_pBlendPathAttrMap)[pCreatedByNode] = pAttrMap; 04587 } 04588 } 04589 04590 return pAttrMap; 04591 }
|
|
Definition at line 327 of file nodebldr.h. 00327 { return m_AWComplex; }
|
|
Lets you get the nth blend path in the list.
Definition at line 4348 of file nodebldr.cpp. 04349 { 04350 if (m_NumBlendPaths <= 0) 04351 return NULL; 04352 04353 if (Index >= INT32(m_NumBlendPaths)) { ERROR3("Index too big"); Index = m_NumBlendPaths-1; } 04354 if (Index < 0) { ERROR3("Index is -ve "); Index = 0; } 04355 04356 BlendPath* pBlendPath = GetFirstBlendPath(); 04357 while (pBlendPath != NULL && Index > 0) 04358 { 04359 pBlendPath = GetNextBlendPath(pBlendPath); 04360 Index--; 04361 } 04362 ERROR3IF(pBlendPath==NULL,"pBlendPath == NULL"); 04363 return (pBlendPath); 04364 }
|
|
Reimplemented in BrushRef. Definition at line 4608 of file nodebldr.cpp. 04609 { 04610 DocRect Rect; 04611 04612 BlendPath *pBlendPath = GetFirstBlendPath(); 04613 while (pBlendPath != NULL) 04614 { 04615 DocRect PathRect = pBlendPath->m_pPath->GetBoundingRect(); 04616 Rect = Rect.Union(PathRect); 04617 04618 pBlendPath = GetNextBlendPath(pBlendPath); 04619 } 04620 return Rect; 04621 }
|
|
Lets you get the first blend path in the list.
Definition at line 4311 of file nodebldr.cpp. 04312 { 04313 return ((BlendPath*)m_BlendPathList.GetHead()); 04314 }
|
|
Lets you get the next blend path in the list.
Definition at line 4329 of file nodebldr.cpp. 04330 { 04331 return ((BlendPath*)m_BlendPathList.GetNext(pCurrentBlendPath)); 04332 }
|
|
Definition at line 312 of file nodebldr.h. 00312 { return m_pNode; }
|
|
Definition at line 320 of file nodebldr.h. 00320 { return m_NumBlendPaths; }
|
|
The path in question could well have been remapping (i.e. rotated to change the el at index 0) many times. This func returns the mapping (i.e. the index of the el that should be at index 0) that should be appied to the original path in order to get the same result. If the ref has more than one blend path, -1 is returned, meaning choose a default element as the start node (e.g. left most, bottom most element).
Definition at line 4470 of file nodebldr.cpp. 04471 { 04472 INT32 Mapping = -1; 04473 04474 if (GetNumBlendPaths() == 1) 04475 { 04476 BlendPath* pBlendPath = GetFirstBlendPath(); 04477 04478 if (pBlendPath != NULL) 04479 Mapping = pBlendPath->GetOrigMapping(); 04480 } 04481 04482 return Mapping; 04483 }
|
|
This inits the BlendRef object with the given node.This inits the BlendRef object with the given node.
Definition at line 4169 of file nodebldr.cpp. 04171 { 04172 ERROR2IF(pThisNode == NULL,FALSE,"pThisNode == NULL"); 04173 04174 // Reset the member vars of this blend reference 04175 m_pNode = pThisNode; 04176 m_NumBlendPaths = 0; 04177 m_BlendPathList.DeleteAll(); 04178 04179 // Set up a BecomeA derived object, so that we can receive all the paths generated by pNode. 04180 BlendBecomeA ParamBecomeA( BECOMEA_PASSBACK, 04181 CC_RUNTIME_CLASS(NodePath), 04182 pUndoOp, 04183 this, 04184 Index, 04185 pProgress, 04186 IgnoreEscape, 04187 pMatrix); 04188 04189 ERROR2IF(!pThisNode->CanBecomeA(&ParamBecomeA), FALSE, "pThisNode can't become a NodePath!"); 04190 04191 BOOL ok = FALSE; 04192 04193 if (pAttrBrush != NULL) 04194 { 04195 // check to see if it is default, if it is not then let the attribute do the work 04196 if (pAttrBrush->GetBrushHandle() != BrushHandle_NoBrush) 04197 ok = pAttrBrush->DoBecomeA(&ParamBecomeA, pThisNode); 04198 else 04199 ok = m_pNode->DoBecomeA(&ParamBecomeA); 04200 } 04201 else 04202 // Get pNode to generate its paths for us 04203 ok = m_pNode->DoBecomeA(&ParamBecomeA); 04204 04205 if (!ok) 04206 { 04207 // tidy up if things go wrong 04208 m_pNode = NULL; 04209 m_NumBlendPaths = 0; 04210 m_BlendPathList.DeleteAll(); 04211 } 04212 04213 return (ok); 04214 }
|
|
This inits the BlendRef object with the given node.
Definition at line 4231 of file nodebldr.cpp. 04232 { 04233 ERROR2IF(pThisNode == NULL,FALSE,"pThisNode == NULL"); 04234 04235 // Reset the member vars of this blend reference 04236 m_pNode = pThisNode; 04237 m_NumBlendPaths = 0; 04238 m_BlendPathList.DeleteAll(); 04239 04240 // Set up a BecomeA derived object, so that we can receive all the paths generated by pNode. 04241 BrushBecomeA MyBecomeA(BECOMEA_PASSBACK, 04242 CC_RUNTIME_CLASS(NodePath), 04243 NULL, 04244 this); 04245 04246 ERROR2IF(!pThisNode->CanBecomeA(&MyBecomeA), FALSE, "pThisNode can't become a NodePath!"); 04247 04248 // if we've got a stroke attribute applied then we must make a special case 04249 /* AttrStrokeType* pStroke = NULL; 04250 AttrVariableWidth* pVarWidth = NULL; 04251 pThisNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeType), (NodeAttribute**)&pStroke); 04252 pThisNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrVariableWidth), (NodeAttribute**)&pVarWidth); 04253 04254 BOOL ok = FALSE; 04255 if (pStroke && pVarWidth && pVarWidth->HasActiveValueFunction()) 04256 ok = pStroke->DoBecomeA(&BecomeA, m_pNode); 04257 else 04258 */ 04259 BOOL ok = m_pNode->DoBecomeA(&MyBecomeA); 04260 04261 if (!ok) 04262 { 04263 // tidy up if things go wrong 04264 m_pNode = NULL; 04265 m_NumBlendPaths = 0; 04266 m_BlendPathList.DeleteAll(); 04267 } 04268 04269 return (ok); 04270 04271 }
|
|
This sees if the point given lies on a selected blob. If a match is found, the ptr to the blend path and index to blob element is returned.
Definition at line 4435 of file nodebldr.cpp. 04436 { 04437 if (pPointerPos == NULL) return FALSE; 04438 if (GetNumBlendPaths() != 1) return FALSE; 04439 04440 BOOL Found = FALSE; 04441 BlendPath* pBlendPath = GetFirstBlendPath(); 04442 04443 if (pBlendPath != NULL) 04444 { 04445 Found = pBlendPath->IsPointOverBlob(pPointerPos,pIndex,pMatrix); 04446 if (Found) *ppBlendPath = pBlendPath; 04447 } 04448 04449 return Found; 04450 }
|
|
Called just after a blender node has done its blend. It asks all its blend paths to free their applied attributes.
Definition at line 4521 of file nodebldr.cpp. 04522 { 04523 // Free up any memory used to hold applied attribute tables in the blend paths 04524 BlendPath* pBlendPath = GetFirstBlendPath(); 04525 while (pBlendPath != NULL) 04526 { 04527 pBlendPath->FreeAppliedAttributes(); 04528 pBlendPath = GetNextBlendPath(pBlendPath); 04529 } 04530 04531 // Remove all the items in the map of blend path attr maps 04532 if (m_pBlendPathAttrMap != NULL) 04533 m_pBlendPathAttrMap->clear(); 04534 }
|
|
Called just before a blender node is about to do its blend. It asks all its blend paths to find their applied attributes.
Definition at line 4499 of file nodebldr.cpp. 04500 { 04501 // If we haven't got a blend path attr map yet, make one (don't worry if we fail) 04502 if (m_pBlendPathAttrMap == NULL && m_NumBlendPaths > 0) 04503 PORTNOTE("other","Maps aren't hash bashed, so have no initial size") 04504 m_pBlendPathAttrMap = new CMapPtrToPtr(); // (m_NumBlendPaths); 04505 }
|
|
Not a function that most people will have cause to use, removes the tail item in the blendpath list.
Definition at line 4728 of file nodebldr.cpp. 04729 { 04730 if (m_BlendPathList.IsEmpty()) 04731 return FALSE; 04732 04733 m_BlendPathList.RemoveTail(); 04734 m_NumBlendPaths--; 04735 04736 return TRUE; 04737 }
|
|
Renders all the blend blobs associated with all the blend paths in this blend ref.
Definition at line 4403 of file nodebldr.cpp. 04404 { 04405 BlendPath* pBlendPath = GetFirstBlendPath(); 04406 04407 while (pBlendPath != NULL) 04408 { 04409 pBlendPath->RenderBlendBlobs(pRender,pMatrix); 04410 pBlendPath = GetNextBlendPath(pBlendPath); 04411 } 04412 }
|
|
Definition at line 326 of file nodebldr.h. 00326 { m_AWComplex = state; }
|
|
Strips redundant NodeBlendPaths from the blend refs. This is needed in the case that we are required to blend a blend on a both to a non-blend on a path (and vice versa).
Definition at line 4639 of file nodebldr.cpp. 04640 { 04641 INT32 numbBlendPathInited = 0, spouseNumbBlendPathInited = 0; 04642 04643 BlendPath *pBlendPath = GetFirstBlendPath(); 04644 while (pBlendPath != NULL) 04645 { 04646 if (pBlendPath->GetCreatedViaNodeBlendPath ()) 04647 { 04648 numbBlendPathInited++; 04649 } 04650 04651 pBlendPath = GetNextBlendPath(pBlendPath); 04652 } 04653 04654 pBlendPath = spouse->GetFirstBlendPath(); 04655 while (pBlendPath != NULL) 04656 { 04657 if (pBlendPath->GetCreatedViaNodeBlendPath ()) 04658 { 04659 spouseNumbBlendPathInited++; 04660 } 04661 04662 pBlendPath = spouse->GetNextBlendPath(pBlendPath); 04663 } 04664 04665 // only strip in this case .... 04666 if (numbBlendPathInited != spouseNumbBlendPathInited) 04667 { 04668 if ((numbBlendPathInited == 0) && (spouseNumbBlendPathInited > 0)) 04669 { 04670 // strip our spouse .... 04671 04672 pBlendPath = spouse->GetFirstBlendPath(); 04673 while (pBlendPath != NULL) 04674 { 04675 if (pBlendPath->GetCreatedViaNodeBlendPath ()) 04676 { 04677 BlendPath* remover = pBlendPath; 04678 pBlendPath = spouse->GetNextBlendPath(pBlendPath); 04679 delete (spouse->m_BlendPathList.RemoveItem (remover)); 04680 spouse->m_NumBlendPaths--; 04681 } 04682 else 04683 { 04684 pBlendPath = spouse->GetNextBlendPath(pBlendPath); 04685 } 04686 } 04687 } 04688 else if ((spouseNumbBlendPathInited == 0) && (numbBlendPathInited > 0)) 04689 { 04690 // strip ourselves .... 04691 04692 pBlendPath = GetFirstBlendPath(); 04693 while (pBlendPath != NULL) 04694 { 04695 if (pBlendPath->GetCreatedViaNodeBlendPath ()) 04696 { 04697 BlendPath* remover = pBlendPath; 04698 pBlendPath = GetNextBlendPath(pBlendPath); 04699 delete (m_BlendPathList.RemoveItem (remover)); 04700 m_NumBlendPaths--; 04701 } 04702 else 04703 { 04704 pBlendPath = GetNextBlendPath(pBlendPath); 04705 } 04706 } 04707 } 04708 // else - oh well 04709 } 04710 }
|
|
Transforms all the BlendPaths attached to this blend reference.
Definition at line 4378 of file nodebldr.cpp. 04379 { 04380 BlendPath* pBlendPath = GetFirstBlendPath(); 04381 04382 while (pBlendPath != NULL) 04383 { 04384 pBlendPath->Transform(Trans); 04385 pBlendPath = GetNextBlendPath(pBlendPath); 04386 } 04387 }
|
|
Definition at line 345 of file nodebldr.h. |
|
Reimplemented in BrushRef. Definition at line 342 of file nodebldr.h. |
|
Reimplemented in BrushRef. Definition at line 343 of file nodebldr.h. |
|
Reimplemented in BrushRef. Definition at line 344 of file nodebldr.h. |
|
Reimplemented in BrushRef. Definition at line 341 of file nodebldr.h. |