BlendPath Class Reference

This contains a NodePath, plus other data, generated by an object that is blended. More...

#include <nodebldr.h>

Inheritance diagram for BlendPath:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 BlendPath ()
 Default constructor.
 ~BlendPath ()
 Default destructor.
BOOL Initialise (NodeRenderableInk *pThisBlendNode, INT32 Index, NodeRenderableInk *pThisCreatedByNode, UINT32 SubpathID, UINT32 SubPathNum, CCAttrMap *pAttrMap, BOOL CheckDirection=TRUE)
 Inits the BlendPath object to use the given NodePath. NOTE: pThisNodePath should point to isolated instance, and not to a used NodePath linked into the tree! 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.
BOOL Initialise (BlendPath *pBlendPath, NodeRenderableInk *pNodeToBlend)
 Inits this blend path, replacing the blend node with the one given.
NodeRenderableInkGetBlendNode ()
PathGetPath ()
NodeRenderableInkGetCreatedByNode ()
INT32 GetOrigMapping ()
PathTypeEnum GetPathType ()
UINT32 GetSubPathID ()
UINT32 GetSubPathNum ()
INT32 GetNumElements ()
BOOL UniqueAppliedAttrs ()
MILLIPOINT GetAppliedLineWidth ()
 Returns the cached line width applying to this blendpath.
BOOL IsLine ()
BOOL IsShape ()
void Transform (TransformBase &Trans)
 Transforms the NodePath attached to this blend path, plus any applied attrs it may have.
void RenderBlendBlobs (RenderRegion *pRender, Trans2DMatrix *pMatrix)
 Renders the blend blobs by asking the pNodePath's Path to render its path blobs.
BOOL IsFilled ()
 Find out if the path is filled.
BOOL IsStroked ()
 Find out if the path is Stroked.
DocCoord GetPathCoord (INT32 Index)
 Access to path's coord array.
BOOL IsPointOverBlob (DocCoord *pPointerPos, INT32 *pIndex, Trans2DMatrix *pMatrix)
 This sees if the point given lies on a selected blob. If a match is found, the index to blob element is updated.
INT32 MapPath (INT32 Index)
 This will ensure that the path's first element is the element at Index. It does this by rotating the path until element at index 'Index' is at index 0. The value returned can be used to undo the mapping, i.e. to apply an inverse mapping.
DocCoord MapPath (DocCoord Index)
 This will ensure that the path's first element is the element closest to Pos. It does this by rotating the path until element at Pos is at index 0. The value returned can be used to undo the mapping, i.e. to apply an inverse mapping.
INT32 FindBottomLeft ()
 This scans the path for the bottom left most element, and returns the index to it.
CCAttrMapFindAppliedAttributes ()
 This calls FindAppliedAttributes() on the node that created this blend path. It will only do this if this is the first call since the last FreeAppliedAttributes() or is the first ever call (in other words, it is cached).
void FreeAppliedAttributes ()
 This will free any memory used to store the applied attributes of this blend path.
AttrBitmapFillGetAppliedBitmapColourFill ()
 as above
AttrBitmapFillGetAppliedBitmapTranspFill ()
 as above
void SetAppliedAttributes (CCAttrMap *pMap)
 Designed specifically for use when blending brush attributes, which need to generate blendpaths and attribute maps by hand,so to speak. This function allows you to set an external attribute map for this blendpath.
void SetPath (Path *pPath)
 Designed specifically for use when blending brush attributes, which need to generate blendpaths and attribute maps by hand,so to speak. This function allows you to set an external path for this blendpath.
void DeleteAttributesAndPath ()
 Sets m_SubPathID to zero thus ensuring that all the attributes and the attribute map are deleted. We need to do this for blendpaths created by blending brush attributes as mentioned in the previous two functions. I don't recommend use of this function under normal circumstances.
void SetPathType (PathTypeEnum PathType)
void Transform (Matrix *pTransMatrix, BOOL TransformLines, BOOL Tile=FALSE)
 Transforms the NodePath attached to this blend path, plus any applied attrs it may have Plus it also records transforms in the member variable, so that later they may be undone This is specifically required by brush attributes.
BOOL TransformBrushAttributesBeforeSave ()
 Undoes the transformations performed on the attributes of this blendpath. This function must be called prior to saving a brush attribute. If you wish to keep using the attribute after the save call TransformBrushAttributesAfterSave or else your attributes will be all over the place.
BOOL TransformBrushAttributesAfterSave ()
 Undoes the transformations performed on the attributes by the previous function.
void SetBlendNode (NodeRenderableInk *pInk)
void SetFreeAttributeFlag (BOOL Value)
 Sets the flag which indicates whether or not we definitely want to delete the attribute map upon destruction of this blendpath. This was designed pretty specifically for use with the Brush code so if you want to use it for other purposes you should be careful.
void SetCreatedViaNodeBlendPath (BOOL val)
BOOL GetCreatedViaNodeBlendPath ()
BOOL MakeCopyPathAndAttributes ()
 Because of all the imprecision problems we've been having I've decided it is best if we never ever access the orignal blendpath path and attribute data for rendering. Instead what we will do is generate copies of this data and supply it to anyone who wants to render with this brush. The copies will then be destroyed after we have finished rendering.
BOOL UpdateCopyPathAndAttributes ()
 Because of all the imprecision problems we've been having I've decided it is best if we never ever access the orignal blendpath path and attribute data for rendering. Instead what we will do is generate copies of this data and supply it to anyone who wants to render with this brush. The copies will then be destroyed after we have finished rendering.
CCAttrMapMakeAttributeMapCopy ()
 To make a complete copy of the applied attribute map.
CCAttrMapUpdateAttributeMapCopy (CCAttrMap *pCopyMap)
 To make a complete copy of the applied attribute map.
void DeleteCopyPathAndAttributes ()
 Deletes the copies we made of the paths and attributes.
void DeleteAttributeMapAndAttributes (CCAttrMap *pMap)
 Counterpart to MakeAttributeMap, deletes all the copied attributes and then the map.
PathGetCopyPath ()
 access
CCAttrMapGetCopyAttributes ()
 access

Public Attributes

Pathm_pPath

Private Member Functions

 CC_DECLARE_MEMDUMP (BlendPath)
void ProcessVerbs ()
 This processes the verbs so the GBlend can cope with them. It clears any PT_CLOSEFIGURE flags it finds. If it finds one or more PT_CLOSEFIGURE, CloseFigure = PT_CLOSEFIGURE.
void CorrectDirection (INT32 Index)
 This ensures that the path is going in the correct direction. It doesn't matter which direction, as long as the direction is the same for all blend paths.

Private Attributes

NodeRenderableInkm_pBlendNode
NodeRenderableInkm_pCreatedByNode
CCAttrMapm_pAppliedAttrs
UINT32 m_CloseFigure
INT32 m_OrigMapping
PathTypeEnum m_PathType
BOOL m_DirChanged
BOOL m_UniqueAttrs
UINT32 m_SubPathID
UINT32 m_SubPathNum
INT32 m_NumElements
DocCoord m_BrushStartCoord
DocCoord m_BrushCurrentCoord
BOOL m_bDeleteAll
BOOL m_bFreeAttrMapOnDestruct
MILLIPOINT m_AppliedLineWidth
BOOL m_bCreatedViaNodeBlendPath
Pathm_pCopyPath
CCAttrMapm_pCopyAttrs

Detailed Description

This contains a NodePath, plus other data, generated by an object that is blended.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/94

Definition at line 138 of file nodebldr.h.


Constructor & Destructor Documentation

BlendPath::BlendPath  ) 
 

Default constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 4757 of file nodebldr.cpp.

04758 {
04759     m_pBlendNode    = NULL;
04760     m_pPath         = NULL;
04761     m_pCreatedByNode= NULL;
04762     m_pAppliedAttrs = NULL;
04763 
04764     m_CloseFigure   = 0;
04765     m_OrigMapping   = 0;
04766     m_PathType      = PATHTYPE_NONE;
04767     m_SubPathID     = 0;
04768     m_DirChanged    = FALSE;
04769     m_NumElements   = -1;
04770     m_UniqueAttrs   = FALSE;
04771 
04772     m_bDeleteAll    = FALSE;
04773     m_bFreeAttrMapOnDestruct = FALSE;
04774 
04775     m_AppliedLineWidth = -1;
04776 
04777     m_bCreatedViaNodeBlendPath = FALSE;
04778 
04779     m_pCopyPath = NULL;
04780     m_pCopyAttrs = NULL;
04781 }

BlendPath::~BlendPath  ) 
 

Default destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
Notes: This destructor has actually gotten quite complicated as it Blendpaths are an important part of the brush attribute and there are a number of different cases to deal with:
  • The normal case is where the blendpath is part of a blend, in this case it may wish to delete its applied attributes, but more than often will not, as they are still used in the tree.

The brush has two deletion scenarios:

  • normally the m_bFreeAttributes flag is set, as we wish to ensure the attribute map is deleted but we do not wish to delete the attributes (as they are probably shared)
  • if this blendpath has been created specially as part of a blend between two brush attributes, then the m_bDeleteAll flag will be set, which asks that we delete everything

Definition at line 4807 of file nodebldr.cpp.

04808 {
04809     // Delete our copies
04810     DeleteCopyPathAndAttributes();
04811     
04812     // Only delete the applied attr map if this is the first sub path that was generated from the
04813     // source path supplied when making shapes.
04814     // This assumes that all sub-paths within a given path have the same attributes (far assumption)
04815 
04816     if (m_SubPathNum == 0 || m_bDeleteAll)
04817     {
04818         if ((m_UniqueAttrs || m_bDeleteAll) && m_pAppliedAttrs != NULL)
04819         {
04820             CCRuntimeClass *pType;
04821             void       *pVal;
04822             // delete all attrs
04823             CMapPtrToPtr::iterator Pos = m_pAppliedAttrs->GetStartPosition();
04824             CMapPtrToPtr::iterator End = m_pAppliedAttrs->GetEndPosition();
04825             for(; Pos != End;)
04826             {
04827                 // Get attr at CMapPtrToPtr::iterator Pos
04828                 m_pAppliedAttrs->GetNextAssoc( Pos, pType, pVal );
04829                 if (pVal != NULL)
04830                     delete (NodeAttribute*)pVal;
04831             }
04832         }
04833         if (m_pAppliedAttrs != NULL)
04834         {
04835             delete m_pAppliedAttrs;
04836             m_pAppliedAttrs = NULL;
04837         }
04838     }
04839     // m_bFreeAttributes should only really be set by brushing code, so unless you are a 
04840     // brush you should never enter the following section
04841     if (m_bFreeAttrMapOnDestruct)
04842     {
04843         if (m_pAppliedAttrs != NULL)
04844         {
04845             delete m_pAppliedAttrs;
04846             m_pAppliedAttrs = NULL;
04847         }
04848     }
04849 
04850     if (m_pBlendNode)
04851     {
04852         m_pBlendNode->CascadeDelete();
04853         delete m_pBlendNode;
04854     }
04855     
04856     if (m_bDeleteAll)
04857     {
04858         if (m_pPath != NULL)
04859             delete m_pPath;
04860     }
04861     
04862 }


Member Function Documentation

BlendPath::CC_DECLARE_MEMDUMP BlendPath   )  [private]
 

void BlendPath::CorrectDirection INT32  Index  )  [private]
 

This ensures that the path is going in the correct direction. It doesn't matter which direction, as long as the direction is the same for all blend paths.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/11/94
Parameters:
Index = index of the node the blend was attempted from [INPUTS]
pPath potentially reversed so it is rendered in the correct direction [OUTPUTS]
Returns:
-

Definition at line 5042 of file nodebldr.cpp.

05043 {
05044     switch (m_PathType)
05045     {
05046         case PATHTYPE_SHAPE:
05047             {
05048                 // Dummy vars for the GWinding() call
05049                 UINT32 l; POINT p;
05050 
05051                 // Get the direction of the path
05052                 BOOL Direction = GWinding((PPOINT)m_pPath->GetCoordArray(),m_pPath->GetVerbArray(),m_pPath->GetNumCoords(),FLATNESS,l,p);
05053 
05054                 // If clockwise, reverse it so it's anticlockwise (this is ArtWorks compatible!!)
05055                 if (Direction)
05056                     m_pPath->Reverse();
05057 
05058                 m_DirChanged = Direction;
05059             }
05060             break;
05061 
05062         case PATHTYPE_LINE:
05063             {
05064                 // Get num coords
05065                 INT32 NumCoords = m_pPath->GetNumCoords();
05066 
05067                 if (Index != 0 && Index != (NumCoords-1))
05068                 {
05069                     // Get the coords array of the line
05070                     DocCoord* pCoords = m_pPath->GetCoordArray();
05071 
05072                     // Find the coords of the two end points of the line
05073                     DocCoord Coord1 = pCoords[0];
05074                     DocCoord Coord2 = pCoords[NumCoords-1];
05075 
05076                     // if the start of the line is less bottom-left than the end, reverse the line.
05077                     if ((Coord1.x + Coord1.y) > (Coord2.x + Coord2.y))
05078                     {
05079                         m_pPath->Reverse();
05080                         m_OrigMapping = NumCoords-1; // Pretend that user mapped to end of line
05081                     }
05082                 }
05083             }
05084             break;
05085 
05086         default : ERROR3("Unknown path type"); break;
05087     }
05088 }

void BlendPath::DeleteAttributeMapAndAttributes CCAttrMap pMap  ) 
 

Counterpart to MakeAttributeMap, deletes all the copied attributes and then the map.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/9/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 5963 of file nodebldr.cpp.

05964 {
05965 
05966     if (pMap != NULL)
05967     {
05968         pMap->DeleteAttributes();
05969 
05970         delete pMap;
05971         pMap = NULL;
05972     }
05973 
05974 }

void BlendPath::DeleteAttributesAndPath  ) 
 

Sets m_SubPathID to zero thus ensuring that all the attributes and the attribute map are deleted. We need to do this for blendpaths created by blending brush attributes as mentioned in the previous two functions. I don't recommend use of this function under normal circumstances.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 6070 of file nodebldr.cpp.

06071 {
06072     m_bDeleteAll = TRUE;
06073 }

void BlendPath::DeleteCopyPathAndAttributes  ) 
 

Deletes the copies we made of the paths and attributes.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 6346 of file nodebldr.cpp.

06347 {
06348     if (m_pCopyPath != NULL)
06349     {
06350         delete m_pCopyPath;
06351         m_pCopyPath = NULL;
06352     }
06353     if (m_pCopyAttrs != NULL)
06354     {
06355         DeleteAttributeMapAndAttributes(m_pCopyAttrs);
06356         m_pCopyAttrs = NULL;
06357     }
06358 }

CCAttrMap * BlendPath::FindAppliedAttributes  ) 
 

This calls FindAppliedAttributes() on the node that created this blend path. It will only do this if this is the first call since the last FreeAppliedAttributes() or is the first ever call (in other words, it is cached).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Ptr to the attributes applied to this blend path NULL if unable to get attributes
See also:
-

Definition at line 5780 of file nodebldr.cpp.

05781 {
05782     if (m_pAppliedAttrs == NULL)
05783     {
05784         m_pAppliedAttrs = new CCAttrMap(30);
05785         if (m_pAppliedAttrs != NULL)
05786         {
05787             // Ilan 4/5/00
05788             // Ensure geometry linked attributes which are applied to the entire Blend compound
05789             // aren't found
05790             if (!m_pCreatedByNode->FindAppliedAttributes(m_pAppliedAttrs,5000,NULL,TRUE))
05791             {
05792                 delete m_pAppliedAttrs;
05793                 m_pAppliedAttrs = NULL;
05794             }
05795             AttrTranspFillGeometry* pTransp = NULL;
05796             m_pCreatedByNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTranspFillGeometry), (NodeAttribute**)&pTransp);
05797         }
05798     }
05799 
05800     return m_pAppliedAttrs;
05801 }

INT32 BlendPath::FindBottomLeft  ) 
 

This scans the path for the bottom left most element, and returns the index to it.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The index of the bottom left most element (or -1 if something when wrong)

Definition at line 5274 of file nodebldr.cpp.

05275 {
05276     DocCoord* pCoords = m_pPath->GetCoordArray();
05277     if (pCoords == NULL) return -1;
05278 
05279     INT32 BottomLeftIndex = -1;
05280     INT32 Index;
05281     BOOL ok;
05282 
05283     DocCoord VeryMostBottomLeft(0x7fffffff,0x7fffffff);
05284     double   SmallestDist = 1.0e100,ThisDist;
05285 
05286     for (Index=0,ok=TRUE;ok;)
05287     {
05288         if (pCoords[Index].x < VeryMostBottomLeft.x) VeryMostBottomLeft.x = pCoords[Index].x;
05289         if (pCoords[Index].y < VeryMostBottomLeft.y) VeryMostBottomLeft.y = pCoords[Index].y;
05290         ok = m_pPath->FindNextEndPoint(&Index);
05291     }
05292 
05293     for (Index=0,ok=TRUE;ok;)
05294     {
05295         ThisDist = VeryMostBottomLeft.Distance(pCoords[Index]);
05296         if (ThisDist < SmallestDist)
05297         {
05298             BottomLeftIndex = Index;
05299             SmallestDist = ThisDist;
05300         }
05301         ok = m_pPath->FindNextEndPoint(&Index);
05302     }
05303 
05304 //  return BottomLeftIndex;
05305 
05306     UINT32 u; POINT p;
05307 
05308     // Get the direction of the path
05309     GWinding((PPOINT)m_pPath->GetCoordArray(),m_pPath->GetVerbArray(),m_pPath->GetNumCoords(),FLATNESS,u,p);
05310 
05311 //  TRACEUSER( "Markn", _T("\n"));
05312 
05313     INT32 GIndex=-1;
05314     DocCoord Coord(p.x,p.y);
05315     SmallestDist = 1.0e100;
05316     for (Index=0,ok=TRUE;ok;)
05317     {
05318         ThisDist = Coord.Distance(pCoords[Index]);
05319         if ((ThisDist-SmallestDist) < 5.0)
05320         {
05321             // This point is close enough, so remember it's index
05322             GIndex = Index;
05323 
05324             // Only update the smallest dist if it is indeed the smallest so far
05325             if (ThisDist < SmallestDist)
05326                 SmallestDist = ThisDist;
05327         }
05328         //TRACEUSER( "Markn", _T("(%d) %f - "),Index,ThisDist);
05329         ok = m_pPath->FindNextEndPoint(&Index);
05330     }
05331 
05332 //  TRACEUSER( "Markn", _T("\n"));
05333 //  TRACEUSER( "Markn", _T("GIndex          = %ld\n"),GIndex);
05334 //  TRACEUSER( "Markn", _T("BottomLeftIndex = %ld\n"),BottomLeftIndex);
05335 //  if (GIndex != BottomLeftIndex)
05336 //  {
05337 //      TRACEUSER( "Markn", _T("*^*^*^*^*^*^*^*^*^*^*^*^*^*^"));
05338 //  }
05339 
05340 //  ERROR3IF_PF(GIndex != BottomLeftIndex,("GIndex != BottomLeftIndex: GIndex = %ld, BottomLeftIndex = %ld",GIndex,BottomLeftIndex));
05341 
05342     return GIndex;
05343 //  return BottomLeftIndex;
05344 }

void BlendPath::FreeAppliedAttributes  ) 
 

This will free any memory used to store the applied attributes of this blend path.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 5817 of file nodebldr.cpp.

05818 {
05819     if (!m_UniqueAttrs && m_pAppliedAttrs != NULL)
05820     {
05821         delete m_pAppliedAttrs;
05822         m_pAppliedAttrs = NULL;
05823     }
05824 }

AttrBitmapFill * BlendPath::GetAppliedBitmapColourFill  ) 
 

as above

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
the bitmap colour fill attribute applying to this blendpath, if there is one
See also:
-

Definition at line 6090 of file nodebldr.cpp.

06091 {
06092     // Get our applied attribute map
06093     CCAttrMap* pAttrMap = FindAppliedAttributes();
06094     if (pAttrMap == NULL)
06095         return NULL;
06096 
06097     // loop through the map until we find an bitmap fill
06098     CCRuntimeClass     *pType;
06099     void               *pVal;
06100     NodeAttribute* pNodeAttr = NULL;
06101     // iterating all (key, value) pairs
06102     for( CMapPtrToPtr::iterator Pos = pAttrMap->GetStartPosition(); 
06103         Pos != pAttrMap->GetEndPosition();)
06104     {
06105         // Get attr at CMapPtrToPtr::iterator Pos
06106         pAttrMap->GetNextAssoc(Pos,pType,pVal);
06107 
06108         // pVal is actually an attribute, so get a ptr to it 
06109         pNodeAttr = (NodeAttribute *)pVal;
06110     
06111         if (pNodeAttr->IsABitmapFill() &&!pNodeAttr->IsATranspFill())
06112             break;
06113 
06114         pNodeAttr = NULL;
06115     }
06116 
06117     // first get the attribute value from the attribute node
06118     if (pNodeAttr != NULL)
06119     {
06120         return (AttrBitmapFill*)pNodeAttr;
06121     }
06122 
06123     return NULL;
06124         
06125 }   

AttrBitmapFill * BlendPath::GetAppliedBitmapTranspFill  ) 
 

as above

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
the bitmapfill transparent attribute applying to this blendpath, if there is one
See also:
-

Definition at line 6142 of file nodebldr.cpp.

06143 {
06144     // Get our applied attribute map
06145     CCAttrMap* pAttrMap = FindAppliedAttributes();
06146     if (pAttrMap == NULL)
06147         return NULL;
06148 
06149     // loop through the map until we find an bitmap fill
06150     CCRuntimeClass     *pType;
06151     void               *pVal;
06152     NodeAttribute* pNodeAttr = NULL;
06153     // iterating all (key, value) pairs
06154     for( CMapPtrToPtr::iterator Pos = pAttrMap->GetStartPosition(); 
06155         Pos != pAttrMap->GetEndPosition();)
06156     {
06157         // Get attr at CMapPtrToPtr::iterator Pos
06158         pAttrMap->GetNextAssoc(Pos,pType,pVal);
06159 
06160         // pVal is actually an attribute, so get a ptr to it 
06161         pNodeAttr = (NodeAttribute *)pVal;
06162     
06163         if (pNodeAttr->IsABitmapFill() &&pNodeAttr->IsATranspFill())
06164             break;
06165 
06166         pNodeAttr = NULL;
06167     }
06168 
06169     // first get the attribute value from the attribute node
06170     if (pNodeAttr != NULL)
06171     {
06172         return (AttrBitmapFill*)pNodeAttr;
06173     }
06174 
06175     return NULL;
06176         
06177 }   

MILLIPOINT BlendPath::GetAppliedLineWidth  ) 
 

Returns the cached line width applying to this blendpath.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
the applied linewidth, or -1 indicating that no line width was found
See also:
-

Definition at line 6195 of file nodebldr.cpp.

06196 {
06197     // find the line width attribute
06198     NodeAttribute* pAttr = NULL;
06199     m_pCreatedByNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrLineWidth), &pAttr);
06200     if (pAttr != NULL)
06201         m_AppliedLineWidth = ((AttrLineWidth*)pAttr)->Value.LineWidth;  
06202     
06203     return m_AppliedLineWidth;
06204 }

NodeRenderableInk* BlendPath::GetBlendNode  )  [inline]
 

Definition at line 172 of file nodebldr.h.

00172 { return m_pBlendNode; }

CCAttrMap * BlendPath::GetCopyAttributes  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
the copy we made of our attribute map
See also:
-

Definition at line 6395 of file nodebldr.cpp.

06396 {
06397     return m_pCopyAttrs;
06398 }

Path * BlendPath::GetCopyPath  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
the copy we made of our path
See also:
-

Definition at line 6375 of file nodebldr.cpp.

06376 {
06377     return m_pCopyPath;
06378 }

NodeRenderableInk* BlendPath::GetCreatedByNode  )  [inline]
 

Definition at line 174 of file nodebldr.h.

00174 { return m_pCreatedByNode; }

BOOL BlendPath::GetCreatedViaNodeBlendPath  )  [inline]
 

Definition at line 221 of file nodebldr.h.

00221 { return (m_bCreatedViaNodeBlendPath); }

INT32 BlendPath::GetNumElements  )  [inline]
 

Definition at line 179 of file nodebldr.h.

00179 { return m_NumElements; }

INT32 BlendPath::GetOrigMapping  )  [inline]
 

Definition at line 175 of file nodebldr.h.

00175 { return m_OrigMapping; }

Path* BlendPath::GetPath  )  [inline]
 

Definition at line 173 of file nodebldr.h.

00173 { return m_pPath; }

DocCoord BlendPath::GetPathCoord INT32  Index  ) 
 

Access to path's coord array.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/11/94
Parameters:
Index = index into the path's coord array of coord required [INPUTS] If index < 0 or index >= num coords in array, an value of 0 used
- [OUTPUTS]
Returns:
The DocCoord at index Index

Definition at line 5607 of file nodebldr.cpp.

05608 {
05609     DocCoord Result(0,0);
05610 
05611     if (m_pPath != NULL)
05612     {
05613         if (m_DirChanged)
05614             m_pPath->Reverse();
05615 
05616         DocCoord*   pCoords = m_pPath->GetCoordArray();
05617         INT32       n       = m_pPath->GetNumCoords();
05618         if (Index >= n || Index < 0) Index = 0;
05619 
05620         if (Index < n && pCoords != NULL)
05621             Result = pCoords[Index];
05622 
05623         if (m_DirChanged)
05624             m_pPath->Reverse();
05625     }
05626 
05627     return Result;
05628 }

PathTypeEnum BlendPath::GetPathType  )  [inline]
 

Definition at line 176 of file nodebldr.h.

00176 { return m_PathType; }

UINT32 BlendPath::GetSubPathID  )  [inline]
 

Definition at line 177 of file nodebldr.h.

00177 { return m_SubPathID; }

UINT32 BlendPath::GetSubPathNum  )  [inline]
 

Definition at line 178 of file nodebldr.h.

00178 { return m_SubPathNum; }

BOOL BlendPath::Initialise BlendPath pBlendPath,
NodeRenderableInk pNodeToBlend
 

Inits this blend path, replacing the blend node with the one given.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/2000
Parameters:
pBlendPath - the blend path to copy from [INPUTS]
- [OUTPUTS]
Returns:
TRUE if Successful, FALSE otherwise

Definition at line 5003 of file nodebldr.cpp.

05005 {
05006     m_pPath             = pBlendPath->GetPath();
05007 
05008     pNodeToBlend->NodeCopy((Node **)(&m_pBlendNode));
05009     m_pCreatedByNode    = pBlendPath->GetCreatedByNode();
05010     m_OrigMapping       = pBlendPath->GetOrigMapping();
05011     m_PathType          = pBlendPath->GetPathType();
05012     m_SubPathID         = pBlendPath->GetSubPathID();
05013     m_SubPathNum        = pBlendPath->GetSubPathNum();
05014     m_NumElements       = pBlendPath->GetNumElements();
05015     m_UniqueAttrs       = pBlendPath->UniqueAppliedAttrs();
05016     m_DirChanged        = pBlendPath->m_DirChanged;
05017     m_BrushStartCoord   = pBlendPath->m_BrushStartCoord;
05018     m_BrushCurrentCoord = pBlendPath->m_BrushCurrentCoord;
05019 
05020     if (m_pAppliedAttrs)
05021         m_pAppliedAttrs     = pBlendPath->m_pAppliedAttrs->Copy();
05022     else
05023         m_pAppliedAttrs     = NULL;
05024 
05025     return TRUE;
05026 }

BOOL BlendPath::Initialise NodeRenderableInk pThisBlendNode,
INT32  Index,
NodeRenderableInk pThisCreatedByNode,
UINT32  ThisSubPathID,
UINT32  ThisSubPathNum,
CCAttrMap pAttrMap,
BOOL  CheckDirection = TRUE
 

Inits the BlendPath object to use the given NodePath. NOTE: pThisNodePath should point to isolated instance, and not to a used NodePath linked into the tree! 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.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
pThisBlendNode = ptr to the node that this BlendPath will use (should NOT be linked in the tree) [INPUTS] Index = index to path element the path should start on (-1 means bottom left most el) pThisCreatedByNode = ptr to the node that created pThisNodePath ThisSubPathID = ID for this subpath (all blend paths generated from the same path have the same subpath ID). Must be >=1 ThisSubPathNum = The sub path number specifying which sub path of the original path this represents. The first sub path is numbered 0. pAttrMap = ptr to applied attrs (or NULL if to use attrs applied to pThisCreatedByNode)
- [OUTPUTS]
Returns:
TRUE if Successful, FALSE otherwise

Definition at line 4894 of file nodebldr.cpp.

04901 {
04902     if (pThisBlendNode == NULL || pThisCreatedByNode == NULL) return FALSE;
04903 
04904     if (pThisBlendNode->IsNodePath())
04905         ERROR3IF(ThisSubPathID == 0,"Invalid subpath ID");
04906 
04907     DELPTR(m_pBlendNode);
04908 
04909     m_pBlendNode    = pThisBlendNode;
04910 
04911     if (m_pBlendNode->IsNodePath())
04912     {
04913         m_pPath         = &(((NodePath *)m_pBlendNode)->InkPath);
04914     
04915     }
04916     else
04917     {
04918         // get the node to blend out of this path node & use this
04919         if (pThisBlendNode->IsCompound())
04920         {
04921             NodeRenderableInk * pInk = ((NodeCompound *)pThisBlendNode)->GetNodeToBlend();
04922 
04923             if (pInk)
04924             {
04925                 if (pInk->IsNodePath())
04926                 {
04927                     m_pPath         = &(((NodePath *)pInk)->InkPath);
04928                 }
04929                 else
04930                 {
04931                     ERROR3("Node to blend isn't a node path");
04932                 }
04933             }
04934             else
04935             {
04936                 ERROR3("No node to blend");
04937             }
04938         }
04939     }
04940 
04941     m_pCreatedByNode= pThisCreatedByNode;
04942     m_SubPathID     = ThisSubPathID;
04943     m_SubPathNum    = ThisSubPathNum;
04944     m_pAppliedAttrs = pAttrMap;
04945     m_UniqueAttrs   = (pAttrMap != NULL);
04946 
04947     if (m_pPath)
04948     {
04949         m_NumElements   = m_pPath->GetNumElements();
04950         m_PathType      = m_pPath->GetPathType();
04951     }
04952     else
04953     {
04954         m_NumElements = 0;
04955         m_PathType = PATHTYPE_SHAPE;
04956     }
04957 
04958     // If we don't have an start element index (i.e. == -1) and its a shape (not a line)
04959     // then pick the bottom left element
04960     if (m_pPath && CheckDirection)
04961     {
04962         
04963         if (Index < 0 && m_PathType == PATHTYPE_SHAPE) Index = FindBottomLeft();
04964         
04965         ProcessVerbs();
04966         MapPath(Index);
04967         CorrectDirection(Index);
04968             
04969     }
04970         
04971     // record the initial CMapPtrToPtr::iterator (used for loading and saving brushes so that we don't get
04972     // the control coordinates of fill attributes wrong)
04973     DocRect BRect;
04974 
04975     if (m_pPath)
04976     {
04977         BRect = m_pPath->GetBoundingRect();
04978     }
04979     else
04980     {
04981         BRect = m_pBlendNode->GetBoundingRect(FALSE, FALSE);
04982     }
04983 
04984     m_BrushStartCoord = BRect.Centre();
04985 
04986     return TRUE;
04987 }

BOOL BlendPath::IsFilled  ) 
 

Find out if the path is filled.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the associated path is filled

Definition at line 5564 of file nodebldr.cpp.

05565 {
05566     if (m_pPath != NULL)
05567         return (m_pPath->IsFilled);
05568     else
05569         return FALSE;
05570 }

BOOL BlendPath::IsLine  )  [inline]
 

Definition at line 183 of file nodebldr.h.

00183 { return m_PathType == PATHTYPE_LINE;  }

BOOL BlendPath::IsPointOverBlob DocCoord pPointerPos,
INT32 *  pIndex,
Trans2DMatrix pMatrix
 

This sees if the point given lies on a selected blob. If a match is found, the index to blob element is updated.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/11/94
Parameters:
pPointerPos = point to check against [INPUTS] pIndex = ptr to place to store index if match is found pMatrix = matrix to apply to the path points before testing with pointer pos
*pIndex,updated if TRUE returned, undefined otherwise [OUTPUTS]
Returns:
TRUE if match found, FALSE otherwise
Markn 26-5-99: Modified so that if the function returns TRUE, *pPointerPos is updated so that it contains the coords of the blob it is over
See also:
-

Definition at line 5714 of file nodebldr.cpp.

05715 {
05716 #if !defined(EXCLUDE_FROM_RALPH)
05717     BOOL Found = FALSE;
05718 
05719     if (m_pPath != NULL && pIndex != NULL)
05720     {
05721         Path* pPath = m_pPath;
05722         if (pMatrix)
05723         {
05724             pPath = new Path;
05725             if (pPath != NULL && pPath->Initialise())
05726             {
05727                 pPath->MergeTwoPaths(*m_pPath);
05728                 pMatrix->Transform((DocCoord*)(pPath->GetCoordArray()), pPath->GetNumCoords() );
05729             }
05730         }
05731 
05732         Found = pPath->FindNearestPoint(*pPointerPos,POINTFLAG_ENDPOINTS,pIndex);
05733 
05734         if (Found)
05735         {
05736             if (m_PathType == PATHTYPE_LINE)
05737                 Found = ((*pIndex == 0) || (*pIndex == (pPath->GetNumCoords()-1)));
05738             else if (m_DirChanged)
05739             {
05740                 pPath->Reverse();
05741                 pPath->FindNearestPoint(*pPointerPos,POINTFLAG_ENDPOINTS,pIndex);
05742                 pPath->Reverse();
05743             }
05744 
05745             if (Found)
05746             {
05747                 *pPointerPos = GetPathCoord(*pIndex);
05748                 if (pMatrix)
05749                     pMatrix->Transform(pPointerPos,1);
05750             }
05751         }
05752 
05753         if (pMatrix) 
05754             DELPTR(pPath);
05755     }
05756 
05757     return Found;
05758 #else
05759     return FALSE;
05760 #endif
05761 }

BOOL BlendPath::IsShape  )  [inline]
 

Definition at line 184 of file nodebldr.h.

00184 { return m_PathType == PATHTYPE_SHAPE; }

BOOL BlendPath::IsStroked  ) 
 

Find out if the path is Stroked.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the associated path is Stroked

Definition at line 5585 of file nodebldr.cpp.

05586 {
05587     if (m_pPath != NULL)
05588         return (m_pPath->IsStroked);
05589     else
05590         return FALSE;
05591 }

CCAttrMap * BlendPath::MakeAttributeMapCopy  ) 
 

To make a complete copy of the applied attribute map.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/9/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A copy of the applied attributes of this blendpath, or NULL if we fail
See also:
-

Definition at line 5841 of file nodebldr.cpp.

05842 {
05843     // easiest thing to do is get the attribute pointers the normal way
05844     // and then copy them one by one
05845     CCAttrMap* pAttrMap = FindAppliedAttributes();
05846 
05847     if (pAttrMap == NULL)
05848     {
05849         ERROR3("Unable to find attributes in BlendPath::MakeAttributeMap");
05850         return NULL; 
05851     }
05852 
05853     // make a new map
05854     CCAttrMap* pCopyMap = new CCAttrMap(30);
05855     if (pCopyMap == NULL)
05856         return NULL;
05857 
05858     // now copy each one and set it back to the map
05859     CCRuntimeClass     *pType;
05860     void               *pVal;
05861     NodeAttribute* pNodeAttr = NULL;
05862     NodeAttribute* pAttrCopy = NULL;
05863 
05864     // iterating all (key, value) pairs
05865     for( CMapPtrToPtr::iterator Pos = pAttrMap->GetStartPosition(); 
05866         Pos != pAttrMap->GetEndPosition();)
05867     {
05868         // Get attr at CMapPtrToPtr::iterator Pos
05869         pAttrMap->GetNextAssoc(Pos,pType,pVal);
05870 
05871         // pVal is actually an attribute, so get a ptr to it and render it
05872         pNodeAttr = (NodeAttribute *)pVal;
05873 
05874         pAttrCopy = (NodeAttribute*)pNodeAttr->SimpleCopy();
05875         if (pAttrCopy == NULL)
05876         {
05877             ERROR3("Unable to make attribute copy in BlendPath::MakeAttributeMap");
05878             DeleteAttributeMapAndAttributes(pCopyMap);
05879             return NULL;
05880         }
05881         
05882         pCopyMap->SetAt( pAttrCopy->GetAttributeType(), (void *)pAttrCopy );
05883         pAttrCopy = NULL;
05884     }
05885 
05886     return pCopyMap;
05887 }

BOOL BlendPath::MakeCopyPathAndAttributes  ) 
 

Because of all the imprecision problems we've been having I've decided it is best if we never ever access the orignal blendpath path and attribute data for rendering. Instead what we will do is generate copies of this data and supply it to anyone who wants to render with this brush. The copies will then be destroyed after we have finished rendering.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise
This function makes copies of the paths and attributes and and assigns them to our member pointers.
See also:
-

Definition at line 6228 of file nodebldr.cpp.

06229 {
06230     // if we've no path then fail
06231     ERROR2IF(m_pPath == NULL, FALSE, "Path is NULL in BlendPath::MakeCopyPathAndAttributes");
06232 
06233     // likewise we need the attributes
06234     CCAttrMap* pAttrMap = FindAppliedAttributes();
06235     
06236     ERROR2IF(pAttrMap == NULL, FALSE, "Unable to find attributes in BlendPath::MakeCopyPathAndAttributes");
06237 
06238     // if we've already got them then get rid of the existing ones
06239     if (m_pCopyPath != NULL || m_pCopyAttrs != NULL)
06240         DeleteCopyPathAndAttributes();
06241 
06242     // first copy the path
06243     m_pCopyPath = new Path;
06244 
06245     if (m_pCopyPath == NULL)
06246         return FALSE;
06247 
06248     if (!m_pCopyPath->Initialise(m_pPath->GetNumCoords()))
06249     {
06250         delete m_pCopyPath;
06251         m_pCopyPath = NULL;
06252         return FALSE;
06253     }
06254     if (!m_pCopyPath->CopyPathDataFrom(m_pPath))
06255     {
06256         delete m_pCopyPath;
06257         m_pCopyPath = NULL;
06258         return FALSE;
06259     }
06260 
06261     // get a copy of our attributes
06262     m_pCopyAttrs = MakeAttributeMapCopy();
06263 
06264     if (m_pCopyAttrs == NULL)
06265     {
06266         delete m_pCopyPath;
06267         m_pCopyPath = NULL;
06268         return FALSE;
06269     }
06270     return TRUE;
06271 }

DocCoord BlendPath::MapPath DocCoord  Pos  ) 
 

This will ensure that the path's first element is the element closest to Pos. It does this by rotating the path until element at Pos is at index 0. The value returned can be used to undo the mapping, i.e. to apply an inverse mapping.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/2/95
Parameters:
Pos = coord of element you want the path to start from [INPUTS]
pPath potentially rotated so it's first el is the one that was closest to 'Pos' [OUTPUTS] OrigMapping will be the mapping that should be applied to the original path to get the same effect.
Returns:
The mapping to apply to invert this mapping

Definition at line 5217 of file nodebldr.cpp.

05218 {
05219     DocCoord InversePos(0,0); 
05220 
05221     ERROR2IF(m_pPath == NULL,InversePos,"m_pPath == NULL");
05222     DocCoord* pCoords = m_pPath->GetCoordArray();
05223     ERROR2IF(pCoords == NULL,InversePos,"pCoords == NULL");
05224 
05225     // The inverse of this op is to remap the element currently at index 0
05226     InversePos = pCoords[0];
05227 
05228     INT32 Index = 0;
05229     INT32 InvIndex = 0;
05230 
05231 /*  {
05232         StringBase Str;
05233         if (Str.Alloc(50000))
05234         {
05235             Str = "";
05236             pNodePath->GetDebugDetails(&Str);
05237             TRACE((TCHAR*)Str);
05238         }
05239     }
05240 */
05241     
05242     if (m_pPath->FindNearestPoint(Pos,POINTFLAG_ENDPOINTS,&Index))
05243         InvIndex = MapPath(Index);
05244     
05245     InversePos = pCoords[InvIndex];
05246 
05247 /*  {
05248         StringBase Str;
05249         if (Str.Alloc(50000))
05250         {
05251             Str = "";
05252             pNodePath->GetDebugDetails(&Str);
05253             TRACE((TCHAR*)Str);
05254         }
05255     }
05256   */
05257     return InversePos;
05258 }

INT32 BlendPath::MapPath INT32  Index  ) 
 

This will ensure that the path's first element is the element at Index. It does this by rotating the path until element at index 'Index' is at index 0. The value returned can be used to undo the mapping, i.e. to apply an inverse mapping.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/11/94
Parameters:
Index = index of element you want the path to start from [INPUTS]
pPath potentially rotated so it's first el is the one that was indexed by Index [OUTPUTS] OrigMapping will be the mapping that should be applied to the original path to get the same effect.
Returns:
The mapping to apply to invert this mapping

Definition at line 5107 of file nodebldr.cpp.

05108 {
05109     INT32 NumCoords = m_pPath->GetNumCoords();
05110 
05111     INT32 InverseMapping = 0;
05112 
05113     // Make sure Index is in range
05114     if (Index > 0 && Index < NumCoords)
05115     {
05116         // Check that we're trying to remap an end point
05117         PathFlags* pFlags  = m_pPath->GetFlagArray();
05118         PathVerb*  pVerbs  = m_pPath->GetVerbArray();
05119         DocCoord*  pCoords = m_pPath->GetCoordArray();
05120 
05121         ERROR3IF(!pFlags[Index].IsEndPoint,"Index not on end point");
05122         if (!pFlags[Index].IsEndPoint)
05123         {
05124             // If index is not on an end point, choose the index of the end point that
05125             // appears before this index.
05126             INT32 OldIndex = Index;
05127             INT32 PrevIndex = 0;
05128             while (PrevIndex < OldIndex)
05129             {
05130                 Index = PrevIndex;
05131                 if (!m_pPath->FindNextEndPoint(&PrevIndex))
05132                 {
05133                     Index = 0;
05134                     break;
05135                 }
05136             }
05137         }
05138 
05139         switch (m_PathType)
05140         {
05141             case PATHTYPE_SHAPE:
05142 
05143                 if (m_DirChanged)
05144                 {
05145                     DocCoord Pos = pCoords[Index];
05146                     m_pPath->Reverse();
05147                     m_pPath->FindNearestPoint(Pos,POINTFLAG_ENDPOINTS,&Index);
05148                 }
05149 
05150                 // Change the path so the el at index 'Index' is now at index 0
05151                 m_pPath->ChangeStartElement(Index);
05152 
05153                 // The above call will introduce a PT_CLOSEFIGURE flag into the end verb, so
05154                 // we need to clear this flag from the last verb
05155                 pVerbs[NumCoords-1] &= ~PT_CLOSEFIGURE;
05156 
05157                 // Work out a mapping that can be applied to the original path in order to get the same effect
05158                 // This is used when the blender reinitialises after its been deinitialised
05159                 m_OrigMapping += Index;
05160 
05161                 if (m_OrigMapping >= (NumCoords-1))
05162                     m_OrigMapping = (m_OrigMapping+1) % NumCoords;
05163 
05164                 InverseMapping = NumCoords-Index-1;
05165 
05166                 if (m_DirChanged) 
05167                 {
05168                     DocCoord Pos = pCoords[InverseMapping];
05169                     m_pPath->Reverse();
05170                     m_pPath->FindNearestPoint(Pos,POINTFLAG_ENDPOINTS,&InverseMapping);
05171                 }
05172                 break;
05173 
05174             case PATHTYPE_LINE:
05175                 // If it's a line then we will only try and remap if the index is the end element
05176                 // In this case, this just means reversing the path
05177                 if (Index == (NumCoords-1))
05178                 {
05179                     // Make the end of the line the start of the line
05180                     m_pPath->Reverse();
05181 
05182                     // The mapping to apply to the orig path to get the same effect if the opposite end point index
05183                     if (m_OrigMapping == 0)
05184                         m_OrigMapping = NumCoords-1;
05185                     else
05186                         m_OrigMapping = 0;
05187 
05188                     InverseMapping = NumCoords-1;
05189                 }
05190                 break;
05191 
05192             default : ERROR3("Unknown path type"); break;
05193         }
05194     }
05195 
05196     return InverseMapping;
05197 }

void BlendPath::ProcessVerbs  )  [private]
 

This processes the verbs so the GBlend can cope with them. It clears any PT_CLOSEFIGURE flags it finds. If it finds one or more PT_CLOSEFIGURE, CloseFigure = PT_CLOSEFIGURE.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/11/94
Parameters:
- [INPUTS]
Contents of pPath's verb array potentially changed [OUTPUTS] CloseFigure = PT_CLOSEFIGURE if one or more PT_CLOSEFIGURE flags are found in the verbs 0 otherwise
Returns:
-

Definition at line 5363 of file nodebldr.cpp.

05364 {
05365     PathVerb* pPathVerb = m_pPath->GetVerbArray();
05366     INT32 n = m_pPath->GetNumCoords()-1;
05367 
05368     m_CloseFigure = 0;
05369 
05370     for (;n>=0;n--)
05371     {
05372         // Get the next verb
05373         PathVerb Verb = pPathVerb[n];
05374 
05375         // Have we found a close figure flag yet?
05376         if (m_CloseFigure == 0) m_CloseFigure = Verb & PT_CLOSEFIGURE;
05377 
05378         // Remove any wierd flags from the verb, as GBlend doesn't like them.
05379         pPathVerb[n] = Verb & ~PT_CLOSEFIGURE;
05380     }
05381 }

void BlendPath::RenderBlendBlobs RenderRegion pRender,
Trans2DMatrix pMatrix
 

Renders the blend blobs by asking the pNodePath's Path to render its path blobs.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/11/94
Parameters:
pRender = region to render blobs into. [INPUTS] pMatrix = matrix to apply to blob coords
- [OUTPUTS]
Returns:
-

Definition at line 5644 of file nodebldr.cpp.

05645 {
05646 #if !defined(EXCLUDE_FROM_RALPH)
05647     if (m_pPath != NULL)
05648     {
05649 //      PathVerb* pVerbs  = m_pPath->GetVerbArray();
05650         DocCoord* pCoords = m_pPath->GetCoordArray();
05651         INT32      n       = m_pPath->GetNumCoords();
05652         INT32     Index   = 0;
05653 
05654         pRender->SetLineColour(COLOUR_NONE);
05655         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
05656 
05657         INT32 i=0;
05658         DocCoord* pCoordList = (DocCoord*) malloc(n*sizeof(DocCoord));
05659 
05660         if (pCoordList)
05661         {
05662             switch (m_PathType)
05663             {
05664                 case PATHTYPE_SHAPE:
05665 //                  while (m_pPath->FindNextEndPoint(&Index))
05666 //                      pRender->DrawBlob(pCoords[Index], BT_UNSELECTED);
05667                     while (m_pPath->FindNextEndPoint(&Index))
05668                         pCoordList[i++] = pCoords[Index];
05669                     break;
05670 
05671                 case PATHTYPE_LINE:
05672 //                  pRender->DrawBlob(pCoords[0]  , BT_UNSELECTED);
05673 //                  pRender->DrawBlob(pCoords[n-1], BT_UNSELECTED);
05674                     pCoordList[i++] = pCoords[0];
05675                     pCoordList[i++] = pCoords[n-1];
05676                     break;
05677 
05678                 default:
05679                     ERROR3("Unknown pathtype");
05680                     break;
05681             }
05682 
05683             if (pMatrix && i > 0)
05684                 pMatrix->Transform(pCoordList,i);
05685 
05686             for (;i>0;i--)
05687                 pRender->DrawBlob(pCoordList[i-1], BT_UNSELECTED);
05688         }
05689         DELPTR(pCoordList);
05690     }
05691 #endif
05692 }

void BlendPath::SetAppliedAttributes CCAttrMap pMap  ) 
 

Designed specifically for use when blending brush attributes, which need to generate blendpaths and attribute maps by hand,so to speak. This function allows you to set an external attribute map for this blendpath.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
pointer to an attribute map to set for [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 6014 of file nodebldr.cpp.

06015 {
06016     if (pMap == NULL)
06017         return;
06018     
06019     // get rid of any existing attributes
06020     FreeAppliedAttributes();
06021     m_pAppliedAttrs = pMap;
06022 }

void BlendPath::SetBlendNode NodeRenderableInk pInk  )  [inline]
 

Definition at line 217 of file nodebldr.h.

00217 { m_pBlendNode = pInk; }

void BlendPath::SetCreatedViaNodeBlendPath BOOL  val  )  [inline]
 

Definition at line 220 of file nodebldr.h.

00220 { m_bCreatedViaNodeBlendPath = val; }

void BlendPath::SetFreeAttributeFlag BOOL  Value  ) 
 

Sets the flag which indicates whether or not we definitely want to delete the attribute map upon destruction of this blendpath. This was designed pretty specifically for use with the Brush code so if you want to use it for other purposes you should be careful.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Parameters:
Value to set the flag to [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 5993 of file nodebldr.cpp.

05994 {
05995     m_bFreeAttrMapOnDestruct = TRUE;
05996 }

void BlendPath::SetPath Path pPath  ) 
 

Designed specifically for use when blending brush attributes, which need to generate blendpaths and attribute maps by hand,so to speak. This function allows you to set an external path for this blendpath.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
pointer to a path to set [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 6041 of file nodebldr.cpp.

06042 {
06043     if (pPath != NULL)
06044     {
06045         m_pPath = pPath;
06046         m_NumElements   = m_pPath->GetNumElements();
06047         m_PathType      = m_pPath->GetPathType();
06048         m_SubPathNum    = m_pPath->GetNumSubpaths();
06049     }
06050 }

void BlendPath::SetPathType PathTypeEnum  PathType  )  [inline]
 

Definition at line 209 of file nodebldr.h.

00209 { m_PathType = PathType; }

void BlendPath::Transform Matrix pTransMatrix,
BOOL  TransformLines,
BOOL  Tile = FALSE
 

Transforms the NodePath attached to this blend path, plus any applied attrs it may have Plus it also records transforms in the member variable, so that later they may be undone This is specifically required by brush attributes.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/2000
Parameters:
TransMatrix - the matrix describing the transformation [INPUTS] TransformLineWidth - do we transform the line width Tile - flag to say whether to tile or not. If set this means that attributes such as bitmap fills etc. are only rendered once

Definition at line 5439 of file nodebldr.cpp.

05440 {
05441     Trans2DMatrix Trans(*pTransMatrix); 
05442 
05443     if (m_pBlendNode != NULL) 
05444         m_pBlendNode->Transform(Trans);
05445     else
05446     {
05447         // added this for the case where we create the blendpath manually, i.e. when blending
05448         // brush attributes
05449         DocCoord* pCoords = m_pPath->GetCoordArray();
05450         INT32 NumCoords = m_pPath->GetNumCoords();
05451         if (pCoords != NULL && NumCoords > 0)
05452             Trans.Transform(pCoords, NumCoords);
05453         else
05454             ERROR3("No coordinates in BlendPath::Transform");
05455     }
05456 
05457     CCAttrMap* pAttrMap = FindAppliedAttributes();
05458     if (pAttrMap != NULL)
05459     {
05460         if (Tile)
05461             pAttrMap->TransformForBrush(Trans);
05462         else
05463             pAttrMap->Transform(Trans);
05464     }
05465     else
05466     {
05467         ERROR3("No applied attributes");
05468     }
05469 
05470     
05471     return;
05472 }

void BlendPath::Transform TransformBase Trans  ) 
 

Transforms the NodePath attached to this blend path, plus any applied attrs it may have.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/94
Parameters:
Trans - The transform Object [INPUTS]

Definition at line 5396 of file nodebldr.cpp.

05397 {
05398     if (m_pBlendNode != NULL) m_pBlendNode->Transform(Trans);
05399 
05400     if (m_UniqueAttrs && m_pAppliedAttrs != NULL)
05401     {
05402         CCRuntimeClass *pType;
05403         void           *pVal;
05404 
05405         // iterating all (key, value) pairs
05406         for( CMapPtrToPtr::iterator Pos = m_pAppliedAttrs->GetStartPosition(); 
05407             Pos != m_pAppliedAttrs->GetEndPosition();)
05408         {
05409             // Get attr at CMapPtrToPtr::iterator Pos
05410             m_pAppliedAttrs->GetNextAssoc(Pos,pType,pVal);
05411 
05412             // pVal is actually an attribute, so get a ptr to it and render it
05413             NodeAttribute* pNodeAttr = (NodeAttribute *)pVal;
05414 
05415             pNodeAttr->Transform(Trans);
05416         }
05417     }
05418 
05419 }

BOOL BlendPath::TransformBrushAttributesAfterSave  ) 
 

Undoes the transformations performed on the attributes by the previous function.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/2000
Parameters:
- [INPUTS]
Returns:
TRUE if successful , FALSE otherwise

Definition at line 5533 of file nodebldr.cpp.

05534 {
05535     Trans2DMatrix Trans(m_BrushCurrentCoord.x - m_BrushStartCoord.x, 
05536                         m_BrushCurrentCoord.y - m_BrushStartCoord.y);
05537 
05538     CCAttrMap* pAttrMap = FindAppliedAttributes();
05539 
05540     if (pAttrMap == NULL)
05541     {
05542         ERROR3("No applied attributes");
05543         return FALSE;
05544     }
05545 
05546     pAttrMap->TransformForBrush(Trans);
05547 
05548     return TRUE;
05549 }

BOOL BlendPath::TransformBrushAttributesBeforeSave  ) 
 

Undoes the transformations performed on the attributes of this blendpath. This function must be called prior to saving a brush attribute. If you wish to keep using the attribute after the save call TransformBrushAttributesAfterSave or else your attributes will be all over the place.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/2000
Parameters:
- [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 5489 of file nodebldr.cpp.

05490 {
05491     if (m_pPath == NULL)
05492     {
05493         ERROR2(FALSE, "This blendpath has no path");
05494         return FALSE;
05495     }
05496     DocRect BRect = m_pPath->GetBoundingRect();
05497     m_BrushCurrentCoord = BRect.Centre();
05498 
05499     Trans2DMatrix Trans(m_BrushStartCoord.x - m_BrushCurrentCoord.x, 
05500                         m_BrushStartCoord.y - m_BrushCurrentCoord.y);
05501 
05502     CCAttrMap* pAttrMap = FindAppliedAttributes();
05503 
05504     if (pAttrMap == NULL)
05505     {
05506         ERROR3("No applied attributes");
05507         return FALSE;
05508     }
05509     
05510     // quick pre-release bodge fix - fractal fills seem to be getting wrongly transformed
05511     // when we do this, so exclude them
05512     AttrFractalFill* pFrac = NULL;
05513     if( pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrFractalFill), (void*&)pFrac ) )
05514         pAttrMap->RemoveKey( CC_RUNTIME_CLASS(AttrFractalFill) );
05515     
05516     pAttrMap->Transform(Trans);
05517 
05518     return TRUE;
05519 }

BOOL BlendPath::UniqueAppliedAttrs  )  [inline]
 

Definition at line 180 of file nodebldr.h.

00180 { return m_UniqueAttrs; }

CCAttrMap * BlendPath::UpdateAttributeMapCopy CCAttrMap pCopyMap  ) 
 

To make a complete copy of the applied attribute map.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/01/2004
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A copy of the applied attributes of this blendpath, or NULL if we fail
See also:
-

Definition at line 5905 of file nodebldr.cpp.

05906 {
05907     // easiest thing to do is get the attribute pointers the normal way
05908     // and then copy them one by one
05909     CCAttrMap* pAttrMap = FindAppliedAttributes();
05910 
05911     if (pAttrMap == NULL)
05912     {
05913         ERROR3("Unable to find attributes in BlendPath::UpdateAttributeMapCopy");
05914         return NULL; 
05915     }
05916 
05917     ERROR2IF(pCopyMap==NULL, NULL, "Unable to find attribute copies in BlendPath::UpdateAttributeMapCopy");
05918 
05919     // now copy the contents of attributes from the original map back into the copy map
05920     CCRuntimeClass     *pType;
05921     void               *pVal;
05922     void               *pCopyVal;
05923     NodeAttribute      *pNodeAttr = NULL;
05924     NodeAttribute      *pAttrCopy = NULL;
05925 
05926     // iterating all (key, value) pairs
05927     for( CMapPtrToPtr::iterator Pos = pAttrMap->GetStartPosition(); 
05928         Pos != pAttrMap->GetEndPosition();)
05929     {
05930         // Get attr at CMapPtrToPtr::iterator Pos
05931         pAttrMap->GetNextAssoc(Pos, pType, pVal);
05932 
05933         pNodeAttr = (NodeAttribute*)pVal;
05934 
05935         BOOL bFound = pCopyMap->Lookup( pType, pCopyVal );
05936         if (bFound)
05937         {
05938             pAttrCopy = (NodeAttribute*)pCopyVal;
05939             pNodeAttr->PolyCopyNodeContents(pAttrCopy);
05940         }
05941     }
05942 
05943     return pCopyMap;
05944 }

BOOL BlendPath::UpdateCopyPathAndAttributes  ) 
 

Because of all the imprecision problems we've been having I've decided it is best if we never ever access the orignal blendpath path and attribute data for rendering. Instead what we will do is generate copies of this data and supply it to anyone who wants to render with this brush. The copies will then be destroyed after we have finished rendering.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise
This function makes copies of the paths and attributes and and assigns them to our member pointers.
See also:
-

Definition at line 6295 of file nodebldr.cpp.

06296 {
06297     // if we've no path then fail
06298     ERROR2IF(m_pPath == NULL, FALSE, "Path is NULL in BlendPath::UpdateCopyPathAndAttributes");
06299     ERROR2IF(m_pCopyPath == NULL, FALSE, "CopyPath is NULL in BlendPath::UpdateCopyPathAndAttributes");
06300 
06301     // likewise we need the attributes
06302     ERROR2IF(m_pAppliedAttrs==NULL, FALSE, "No applied attrs in BlendPath::UpdateCopyPathAndAttributes");
06303     
06304     ERROR2IF(m_pPath->GetNumCoords()!=m_pCopyPath->GetNumCoords(), FALSE, "Mismatching paths in BlendPath::UpdateCopyPathAndAttributes");
06305 
06306     if (!m_pCopyPath->Initialise(m_pPath->GetNumCoords()))
06307     {
06308         delete m_pCopyPath;
06309         m_pCopyPath = NULL;
06310         return FALSE;
06311     }
06312     if (!m_pCopyPath->CopyPathDataFrom(m_pPath))
06313     {
06314         delete m_pCopyPath;
06315         m_pCopyPath = NULL;
06316         return FALSE;
06317     }
06318 
06319     // get a copy of our attributes
06320     m_pCopyAttrs = UpdateAttributeMapCopy(m_pCopyAttrs);
06321 
06322     if (m_pCopyAttrs == NULL)
06323     {
06324         delete m_pCopyPath;
06325         m_pCopyPath = NULL;
06326         return FALSE;
06327     }
06328     return TRUE;
06329 }


Member Data Documentation

MILLIPOINT BlendPath::m_AppliedLineWidth [private]
 

Definition at line 264 of file nodebldr.h.

BOOL BlendPath::m_bCreatedViaNodeBlendPath [private]
 

Definition at line 266 of file nodebldr.h.

BOOL BlendPath::m_bDeleteAll [private]
 

Definition at line 260 of file nodebldr.h.

BOOL BlendPath::m_bFreeAttrMapOnDestruct [private]
 

Definition at line 261 of file nodebldr.h.

DocCoord BlendPath::m_BrushCurrentCoord [private]
 

Definition at line 257 of file nodebldr.h.

DocCoord BlendPath::m_BrushStartCoord [private]
 

Definition at line 255 of file nodebldr.h.

UINT32 BlendPath::m_CloseFigure [private]
 

Definition at line 245 of file nodebldr.h.

BOOL BlendPath::m_DirChanged [private]
 

Definition at line 248 of file nodebldr.h.

INT32 BlendPath::m_NumElements [private]
 

Definition at line 253 of file nodebldr.h.

INT32 BlendPath::m_OrigMapping [private]
 

Definition at line 246 of file nodebldr.h.

CCAttrMap* BlendPath::m_pAppliedAttrs [private]
 

Definition at line 243 of file nodebldr.h.

PathTypeEnum BlendPath::m_PathType [private]
 

Definition at line 247 of file nodebldr.h.

NodeRenderableInk* BlendPath::m_pBlendNode [private]
 

Definition at line 240 of file nodebldr.h.

CCAttrMap* BlendPath::m_pCopyAttrs [private]
 

Definition at line 271 of file nodebldr.h.

Path* BlendPath::m_pCopyPath [private]
 

Definition at line 270 of file nodebldr.h.

NodeRenderableInk* BlendPath::m_pCreatedByNode [private]
 

Definition at line 242 of file nodebldr.h.

Path* BlendPath::m_pPath
 

Definition at line 215 of file nodebldr.h.

UINT32 BlendPath::m_SubPathID [private]
 

Definition at line 251 of file nodebldr.h.

UINT32 BlendPath::m_SubPathNum [private]
 

Definition at line 252 of file nodebldr.h.

BOOL BlendPath::m_UniqueAttrs [private]
 

Definition at line 249 of file nodebldr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:28 2007 for Camelot by  doxygen 1.4.4