CCAttrMap Class Reference

Class that encapsulates lists of attributes in Camelot. More...

#include <attrmap.h>

Inheritance diagram for CCAttrMap:

CCObject SimpleCCObject List of all members.

Public Types

typedef CMapPtrToPtr::iterator iterator

Public Member Functions

 CCAttrMap (size_t nBlockSize=10)
iterator GetStartPosition ()
iterator GetEndPosition ()
void GetNextAssoc (iterator &iter, CCRuntimeClass *&pClass, void *&pValue) const
bool Lookup (CCRuntimeClass *pKey, void *&pVal)
bool RemoveKey (CCRuntimeClass *pKey)
void SetAt (CCRuntimeClass *pKey, void *pValue)
size_t GetCount () const
void RemoveAll ()
void DeleteAttributes ()
 Deletes all the attributes within this map.
CCAttrMapCopy ()
 Copies all the attributes within this map into a new CCAttrMap. A ptr to the new map is returned, or NULL if it fails.
void Render (RenderRegion *pRegion, BOOL RenderOffscreenAttributes=TRUE)
 Renders the attribute map into the given render region.
void BuildListOfAttributes (List *pList)
 Builds a list of NodeListItems of all the attributes in this attribute map Notes: Includes all attributes - even those which can't be applied to objects Use CanBeAppliedToObject to test.
void Transform (TransformBase &Trans)
 Applies the given transform to all the attrs in this map.
NodeAttributeFindAttribute (NodeAttribute *pTypeAttr)
 Call to retrieve a ptr to the attribute of the supplied type Notes:.
NodeAttributeReplaceAttribute (NodeAttribute *pNewAttr)
 Directly replaces the attribute in this map with the given one Notes:.
void RemoveAttribute (CCRuntimeClass *pAttrClass)
 Removes and Deletes the given attribute type Notes:.
void TransformForBrush (TransformBase &Trans)
 Applies the given transform to all the attrs in this map that need to be rendered at every step of a brush or a blend. This allows us to tile as things such as bitmap fills remain in the same place always.
void TransformBrushFills (TransformBase &Trans)
 Applies the transform to all the attributes that do not have to render for each brush step.
BOOL WillScaleLineWidthToZero (TransformBase &Trans)
 As above, this can be useful information as if we pass GDraw a line width of zero it reverts to zero quality.
void ApplyAttributesToNode (NodeRenderableInk *pNode)
void PostBlendInit (Path *pPath, CCRuntimeClass *pCreatorClass)
void PostBlendDeinit ()
void AttachGeometryLinkedAttrs (Node *pContext)
void RemoveGeometryLinkedAttrs ()
BOOL IsSeeThrough ()
 Test each of the attributes in this map for see-through-ness. This is not the same as transparency - what it means is: if I draw something in white, then draw its outline as retrieved from PathBecomeA in black over the top, will I still be able to see white bits? IsSeeThrough() therefore depends partly on the implementation of PathBecomeA.

Static Public Member Functions

static CCAttrMapMakeAppliedAttrMap (NodeRenderableInk *pInkNode, BOOL ExcludeIndirectlyAppliedGLAs=TRUE, BOOL bStrictEffectStatus=TRUE)
 This creates a new CCAttrMap and fills it with ptrs to applied attrs of pInkNode.
static CCAttrMapMakeAttrMapFromRenderRegion (RenderRegion *pRegion)
 Makes an attribute out of the render region's current attribute state Notes: You MUST call DeleteAttributes afterwards to release memory - delete is not sufficient.

Public Attributes

NodeattrMapCreator

Private Attributes

CMapPtrToPtr m_mapAttr

Detailed Description

Class that encapsulates lists of attributes in Camelot.

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

Definition at line 126 of file attrmap.h.


Member Typedef Documentation

typedef CMapPtrToPtr::iterator CCAttrMap::iterator
 

Definition at line 134 of file attrmap.h.


Constructor & Destructor Documentation

CCAttrMap::CCAttrMap size_t  nBlockSize = 10  )  [inline]
 

Definition at line 131 of file attrmap.h.

00131 { attrMapCreator = NULL; }


Member Function Documentation

void CCAttrMap::ApplyAttributesToNode NodeRenderableInk pNode  ) 
 

Definition at line 643 of file attrmap.cpp.

00644 {
00645     iterator            pos = GetStartPosition();
00646 
00647     while( pos != GetEndPosition() )
00648     {
00649         CCRuntimeClass *pKey;
00650         void           *pVal;
00651         GetNextAssoc(pos, pKey, pVal);
00652 
00653         NodeAttribute * pAttr = (NodeAttribute *)pVal;
00654 
00655         // copy the attribute
00656         if( pAttr->CanBeAppliedToObject() )
00657         {
00658             NodeAttribute * pAttrCopy = NULL;
00659             pAttr->NodeCopy((Node **)(&pAttrCopy));
00660             
00661             pAttrCopy->AttachNode(pInk, LASTCHILD);
00662 
00663             // nb now that GLAs have an independent flag to indicate when
00664             // they are copied from the default, it is safe to fix linkages
00665             // this ensures that GLA defaults get copied when BlendRefs are
00666             // made from complex nodes, and that they are found when MakeAppliedAttributes
00667             // calls FindAppliedAttributes on the unattached subtree
00668             // TODO??
00669             // What about just copying compound node's Parent pointers to 
00670             // pseudo attach the tree, rather than copying applied attrs to unattached tree
00671             // Just need to watch when deleting that it doesn't do anything to the
00672             // parents pointers - which it shouldn't surely?
00673             pAttrCopy->LinkToGeometry(pInk);
00674         }
00675     }
00676 }

void CCAttrMap::AttachGeometryLinkedAttrs Node pContext  ) 
 

Definition at line 745 of file attrmap.cpp.

00746 {
00747     INT32 curr = 0;
00748 
00749     do
00750     {
00751         CCRuntimeClass *pType = (CCRuntimeClass *)GeometryLinkedAttributeClasses[curr];
00752         void           *pVal;
00753                 
00754         if (Lookup(pType,pVal))
00755         {
00756             if (pVal != NULL)
00757             {
00758                 ((NodeAttribute*)pVal)->LinkToGeometry(pContext);
00759             }
00760         }
00761 
00762         curr++;
00763     }
00764     while(curr<NumGLAs);
00765 }

void CCAttrMap::BuildListOfAttributes List pList  ) 
 

Builds a list of NodeListItems of all the attributes in this attribute map Notes: Includes all attributes - even those which can't be applied to objects Use CanBeAppliedToObject to test.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
The list to use [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 474 of file attrmap.cpp.

00475 {
00476     iterator            pos = GetStartPosition();
00477 
00478     NodeListItem       *pItem = NULL;
00479 
00480     while( pos != GetEndPosition() )
00481     {
00482         CCRuntimeClass *pKey;
00483         void           *pVal;
00484         GetNextAssoc( pos, pKey, pVal );
00485 
00486         pItem = new NodeListItem((NodeAttribute *)pVal);
00487 
00488         pList->AddTail(pItem);
00489     }
00490 }

CCAttrMap * CCAttrMap::Copy  ) 
 

Copies all the attributes within this map into a new CCAttrMap. A ptr to the new map is returned, or NULL if it fails.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/96
Parameters:
[INPUTS] 
- [OUTPUTS]
Returns:
Ptr to a new CCAttrMap, or NULL if it fails
The new map contains a list of attrs that are not attached in the tree. If the attrs are not needed or used (e.g. not inserted into the tree) make sure you delete the attrs via DeleteAttributes() before deleting the CCAttrMap, otherwise memory leaks will occur.

See also:
CCAttrMap::DeleteAttributes()

Definition at line 178 of file attrmap.cpp.

00179 {
00180     CCAttrMap          *pNewAttrMap = new CCAttrMap( GetCount() );
00181     if( pNewAttrMap != NULL )
00182     {
00183         // iterating all (key, value) pairs
00184         for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
00185         {
00186             CCRuntimeClass *pType;
00187             void       *pVal;
00188             GetNextAssoc( Pos, pType, pVal );
00189 
00190             // Get the attribute value of this attribute
00191             NodeAttribute* pAttr = (NodeAttribute*)pVal;
00192 
00193             // Copy the attribute
00194             NodeAttribute* pNewAttr = (NodeAttribute*) (pAttr->SimpleCopy());
00195 
00196             // Stick the new attr into the new attr map
00197             if (pNewAttr != NULL)
00198                 pNewAttrMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr);
00199         }
00200     }
00201 
00202     pNewAttrMap->attrMapCreator = attrMapCreator;
00203 
00204     return pNewAttrMap;
00205 }

void CCAttrMap::DeleteAttributes  ) 
 

Deletes all the attributes within this map.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/96
Parameters:
[INPUTS] 
- [OUTPUTS]
Returns:
-
NOTE: THIS CAN BE DANGEROUS. Only delete the attributes within this map if you know for sure that they are not being used. This usually means only delete if the attrs in this map are not in the tree.

The blend system generates attrs out of the tree, so they can be deleted. NodeRenderableInk::FindAppliedAttributes() finds a list of attrs in the tree and therefore should not be deleted via this call.

See also:
CCAttrMap::Copy()

Definition at line 137 of file attrmap.cpp.

00138 {
00139     CCRuntimeClass     *pType;
00140     void               *pVal;
00141 
00142     // iterating all (key, value) pairs
00143     for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
00144     {
00145         // Get attr at position Pos
00146         GetNextAssoc( Pos, pType, pVal );
00147 
00148         if (pVal != NULL)
00149         {
00150             RemoveKey(pType);
00151             // Must cast to NodeAttribute before deleting, otherwise wrong destructor gets called
00152             delete (NodeAttribute*)pVal;
00153         }
00154     }
00155 }

NodeAttribute * CCAttrMap::FindAttribute NodeAttribute pTypeAttr  ) 
 

Call to retrieve a ptr to the attribute of the supplied type Notes:.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/6/2000
Parameters:
The attribute type that we are to find. [INPUTS]
The attribute that matches this attribute type [OUTPUTS]
Returns:
-
See also:
-

Definition at line 507 of file attrmap.cpp.

00508 {
00509     void* ptrToAttr = NULL;
00510 
00511     if( Lookup( pTypeAttr->GetAttributeType(), ptrToAttr ) )
00512     {
00513         return (NodeAttribute *)ptrToAttr;
00514     }
00515     
00516     return (NULL);
00517 }

size_t CCAttrMap::GetCount  )  const [inline]
 

Definition at line 176 of file attrmap.h.

00177     {
00178         return m_mapAttr.size();
00179     }

iterator CCAttrMap::GetEndPosition  )  [inline]
 

Definition at line 139 of file attrmap.h.

00140     {
00141         return m_mapAttr.end();
00142     }

void CCAttrMap::GetNextAssoc iterator iter,
CCRuntimeClass *&  pClass,
void *&  pValue
const [inline]
 

Definition at line 144 of file attrmap.h.

00145     {
00146         pClass  = (CCRuntimeClass *)iter->first;
00147         pValue  = iter->second;
00148         ++iter;
00149     }

iterator CCAttrMap::GetStartPosition  )  [inline]
 

Definition at line 135 of file attrmap.h.

00136     {
00137         return m_mapAttr.begin();
00138     }

BOOL CCAttrMap::IsSeeThrough  ) 
 

Test each of the attributes in this map for see-through-ness. This is not the same as transparency - what it means is: if I draw something in white, then draw its outline as retrieved from PathBecomeA in black over the top, will I still be able to see white bits? IsSeeThrough() therefore depends partly on the implementation of PathBecomeA.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/02/2001
Returns:
TRUE if at least one of our attrs IsSeeThrough(), FALSE otherwise.
Examples: Transparency is always see-through unless it is a zero transparency. Line width is not see through - PathBecomeA can cope with this attr. Fill colour is not see-through unless it is COLOUR_NONE. Brush attrs are normally see-through, as PathBecomeA ignores them.

See Also: NodeRenderableInk::IsSeeThrough()

Definition at line 817 of file attrmap.cpp.

00818 {
00819     CCRuntimeClass     *pKey;
00820     void               *pVal;
00821     BOOL                bIsSeeThrough = FALSE;
00822 
00823     for ( iterator  pos = GetStartPosition();
00824                     pos != GetEndPosition() && !bIsSeeThrough;  )
00825     {
00826         GetNextAssoc(pos, pKey, pVal);
00827         NodeAttribute* pAttr = (NodeAttribute*)pVal;
00828 
00829         bIsSeeThrough = pAttr->IsSeeThrough(FALSE);
00830     }
00831 
00832     return bIsSeeThrough;
00833 }

bool CCAttrMap::Lookup CCRuntimeClass pKey,
void *&  pVal
[inline]
 

Definition at line 151 of file attrmap.h.

00152     {
00153         iterator    iter = m_mapAttr.find( pKey );
00154         if( m_mapAttr.end() == iter )
00155             return false;
00156 
00157         pVal = iter->second;
00158         return true;
00159     }

CCAttrMap * CCAttrMap::MakeAppliedAttrMap NodeRenderableInk pInkNode,
BOOL  ExcludeIndirectlyAppliedGLAs = TRUE,
BOOL  bStrictEffectStatus = TRUE
[static]
 

This creates a new CCAttrMap and fills it with ptrs to applied attrs of pInkNode.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/1/96
Parameters:
pInkNode = ptr to an ink node [INPUTS] ExcludeIndirectlyAppliedGLAs - whether they should be excluded from this attrmap
- [OUTPUTS]
Returns:
Ptr to a new CCAttrMap, or NULL if it fails
pInkNode must be a node that is inserted in the tree, and is not hidden.

It is the caller's responsibility to delete the returned CCAttrMap. Note: As the map contains ptrs to attrs in the tree. Do not call DeleteAttributes() on the returned CCAttrMap

See also:
CCAttrMap::Copy()

Definition at line 231 of file attrmap.cpp.

00234 {
00235     ERROR2IF(pInkNode == NULL,NULL,"pInkNode is NULL");
00236     // ERROR2IF(pInkNode->FindParent() == NULL,NULL,"pInkNode has no parent");
00237 
00238     CCAttrMap* pAttrMap = new CCAttrMap(30);
00239     if (pAttrMap != NULL)
00240     {
00241         if (!pInkNode->FindAppliedAttributes(pAttrMap,
00242                                              5000,
00243                                              NULL,
00244                                              ExcludeIndirectlyAppliedGLAs,
00245                                              bStrictEffectStatus))
00246         {
00247             delete pAttrMap;
00248             pAttrMap = NULL;
00249         }
00250         else
00251         {
00252             pAttrMap->attrMapCreator = (Node*) pInkNode;
00253         }
00254     }
00255 
00256     return pAttrMap;
00257 }

CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion RenderRegion pRegion  )  [static]
 

Makes an attribute out of the render region's current attribute state Notes: You MUST call DeleteAttributes afterwards to release memory - delete is not sufficient.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/2/2000
Parameters:
The render region to get the attribute map from [INPUTS]
An attribute map (copied) from the render region [OUTPUTS]
Returns:
-
See also:
-

Definition at line 598 of file attrmap.cpp.

00599 {
00600     CCAttrMap * pMap = new CCAttrMap;
00601     ENSURE(pMap,"No mem for attrmap");
00602     if(!pMap)
00603         return NULL;
00604 
00605     // let's get every attribute in the render region
00606     AttributeValue * pAttrVal = NULL;
00607     NodeAttribute * pNewAttr = NULL;
00608 
00609     for (UINT32 i = 0; i < ATTR_FIRST_FREE_ID; i++)
00610     {
00611         pAttrVal = pRegion->GetCurrentAttribute(i);
00612 
00613         // make a new node out of this attribute value
00614         pNewAttr = pAttrVal->MakeNode();
00615         
00616         // Karim 12/04/2000
00617         // AttributeValues _do_not_have_to_have_ a corresponding NodeAttribute,
00618         // so can we please *check* that MakeNode didn't just return NULL!
00619         if (pNewAttr != NULL)
00620         {
00621             if(!pNewAttr->IsLinkedToNodeGeometry())
00622                 pMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr);
00623             else
00624             {
00625                 delete pNewAttr;
00626                 pNewAttr = AttributeManager::GetDefaultAttribute((AttrIndex) i);
00627                 if(pNewAttr)
00628                 {
00629                     ENSURE(pNewAttr->IsLinkedToNodeGeometry(),"Incorrect NodeAttribute returned by GetDefaultAttribute");
00630                     pMap->SetAt(pNewAttr->GetAttributeType(), pNewAttr);
00631                 }
00632                 else
00633                     return NULL;
00634             }
00635         }
00636     }
00637 
00638     pMap->attrMapCreator = NULL;
00639 
00640     return pMap;
00641 }

void CCAttrMap::PostBlendDeinit  ) 
 

Definition at line 720 of file attrmap.cpp.

00721 {
00722     INT32 curr = 0;
00723 
00724     do
00725     {
00726         CCRuntimeClass *pType = (CCRuntimeClass *)GeometryLinkedAttributeClasses[curr];
00727         void           *pVal;
00728                 
00729         if( Lookup( pType, pVal ) )
00730         {
00731             if (pVal != NULL)
00732             {
00733                 NodeAttribute * pAttr = (NodeAttribute *)pVal;
00734 
00735                 pAttr->PostDynCreateDeInit();
00736             }
00737         }
00738 
00739         curr++;
00740     }
00741     while(curr<NumGLAs);
00742 }

void CCAttrMap::PostBlendInit Path pPath,
CCRuntimeClass pCreatorClass
 

Definition at line 682 of file attrmap.cpp.

00683 {
00684     INT32 curr = 0;
00685 
00686     // NB this function is called on a Blended attr map
00687     // The Blend() function should return false if it doesn't want to be in the blended attr map
00688     // ie default GLAs shouldn't be in here!
00689 
00690     do
00691     {
00692         CCRuntimeClass *pType = (CCRuntimeClass *)GeometryLinkedAttributeClasses[curr];
00693         void           *pVal;
00694                 
00695         if( Lookup( pType, pVal ) )
00696         {
00697             if (pVal != NULL)
00698             {
00699                 NodeAttribute * pAttr = (NodeAttribute *)pVal;
00700 
00701                 // call the attributes routine to initialise itself
00702                 if(!pAttr->PostDynCreateInit(this, pPath, pCreatorClass))
00703                 {
00704                     // make sure the node is not going to try and render itself
00705                     TRACEUSER( "Ilan", wxT("Dynamically created attribute failed to post init itself. Removing attribute from map.\n") );
00706                     // NB map must contain copied attrs
00707                     RemoveKey( pType );
00708                     // Must cast to NodeAttribute before deleting, otherwise wrong destructor gets called
00709                     delete (NodeAttribute*)pVal;
00710                 }
00711             }
00712         }
00713 
00714         curr++;
00715     }
00716     while(curr<NumGLAs);
00717 }

void CCAttrMap::RemoveAll  )  [inline]
 

Definition at line 181 of file attrmap.h.

00182     {
00183         return m_mapAttr.clear();
00184     }

void CCAttrMap::RemoveAttribute CCRuntimeClass pAttrClass  ) 
 

Removes and Deletes the given attribute type Notes:.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/11/2005
Parameters:
The attribute class to remove [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 567 of file attrmap.cpp.

00568 {
00569     NodeAttribute* pOldAttr = NULL;
00570     if( Lookup( pAttrClass, (void*&)pOldAttr ) )
00571     {
00572         if (pOldAttr)
00573             delete pOldAttr;
00574 
00575         // We need to Remove and Delete the existing Stroke Colour Attr
00576         RemoveKey( pAttrClass );
00577     }
00578 }

void CCAttrMap::RemoveGeometryLinkedAttrs  ) 
 

Definition at line 767 of file attrmap.cpp.

00768 {
00769     INT32 curr = 0;
00770 
00771     do
00772     {
00773         CCRuntimeClass *pType = (CCRuntimeClass *)GeometryLinkedAttributeClasses[curr];
00774         void           *pVal;
00775                 
00776         if( Lookup( pType, pVal ) )
00777         {
00778             if (pVal != NULL)
00779             {
00780                 RemoveKey( pType );
00781                 delete (NodeAttribute*)pVal;
00782             }
00783         }
00784 
00785         curr++;
00786     }
00787     while(curr<NumGLAs);
00788 }

bool CCAttrMap::RemoveKey CCRuntimeClass pKey  )  [inline]
 

Definition at line 161 of file attrmap.h.

00162     {
00163         iterator    iter = m_mapAttr.find( pKey );
00164         if( m_mapAttr.end() == iter )
00165             return false;
00166 
00167         m_mapAttr.erase( iter );
00168         return true;
00169     }

void CCAttrMap::Render RenderRegion pRegion,
BOOL  RenderOffscreenAttributes = TRUE
 

Renders the attribute map into the given render region.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
pRegion render-region to render into. [INPUTS] RenderOffscreenAttributes whether or not to render offscreen attributes, eg feathers.
- [OUTPUTS]
Returns:
-
Notes: Karim 15/11/2000 Modified so that I can render an attribute map *without* rendering any offscreen attributes contained therein.

See also:
-

Definition at line 436 of file attrmap.cpp.

00437 {
00438     // OK, we have found the full quota of attributes.  Now render them all.
00439     iterator            pos = GetStartPosition();
00440     while( pos != GetEndPosition() )
00441     {
00442         CCRuntimeClass *pKey;
00443         void           *pVal;
00444         GetNextAssoc( pos, pKey, pVal );
00445 
00446         NodeAttribute* pAttr = (NodeAttribute*)pVal;
00447 
00448         if ( pAttr->CanBeAppliedToObject() &&
00449              pAttr->RenderSubtree(pRegion)==SUBTREE_ROOTONLY )
00450         {
00451             // render all attributes, unless we've been specifically asked
00452             // not to render offscreen attributes.
00453             if (RenderOffscreenAttributes || !pAttr->IsAnOffscreenAttribute())
00454                 pAttr->Render(pRegion);
00455         }
00456     }
00457 }

NodeAttribute * CCAttrMap::ReplaceAttribute NodeAttribute pNewAttr  ) 
 

Directly replaces the attribute in this map with the given one Notes:.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/12/99
Parameters:
The attribute to replace [INPUTS]
The old attribute - in case it needs deleting [OUTPUTS]
Returns:
-
See also:
-

Definition at line 534 of file attrmap.cpp.

00535 {
00536     void* pOldAttr = NULL;
00537     if( Lookup( pNewAttr->GetAttributeType(), pOldAttr ) )
00538     {
00539         // We need to Remove and Delete the existing Stroke Colour Attr
00540         RemoveKey( pNewAttr->GetAttributeType() );
00541     }
00542     
00543     // Add the new attr into the attr map
00544     SetAt( pNewAttr->GetAttributeType(), (void*)pNewAttr ); 
00545 
00546     return (NodeAttribute *)pOldAttr;
00547 }

void CCAttrMap::SetAt CCRuntimeClass pKey,
void *  pValue
[inline]
 

Definition at line 171 of file attrmap.h.

00172     {
00173         m_mapAttr[pKey] = pValue;
00174     }

void CCAttrMap::Transform TransformBase Trans  ) 
 

Applies the given transform to all the attrs in this map.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
Trans [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 273 of file attrmap.cpp.

00274 {
00275     CCRuntimeClass     *pType;
00276     void               *pVal;
00277     for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
00278     {
00279         GetNextAssoc(Pos,pType,pVal);
00280         if (pVal != NULL)
00281         {
00282             NodeAttribute* pNodeAttr = (NodeAttribute *)pVal;
00283             pNodeAttr->Transform(Trans);
00284         }
00285     }
00286 }

void CCAttrMap::TransformBrushFills TransformBase Trans  ) 
 

Applies the transform to all the attributes that do not have to render for each brush step.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
Trans [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 348 of file attrmap.cpp.

00349 {
00350     CCRuntimeClass     *pType;
00351     void               *pVal;
00352     for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
00353     {
00354         GetNextAssoc(Pos,pType,pVal);
00355         if (pVal != NULL)
00356         {
00357             NodeAttribute* pNodeAttr = (NodeAttribute *)pVal;
00358             
00359             // check that we are not about to set line width to zero
00360             if( pNodeAttr->IsALineWidthAttr() && Trans.TransLines != FALSE )
00361             {
00362                 INT32 Test = labs( INT32(Trans.GetScalar().MakeDouble() * ((AttrLineWidth*)pNodeAttr)->Value.LineWidth) );      
00363                 if (Test <= 10)
00364                     Trans.TransLines = FALSE;
00365             }
00366 
00367             if (!pNodeAttr->NeedsToRenderAtEachBrushStroke())
00368                 pNodeAttr->Transform(Trans);
00369         }
00370     }
00371 
00372 
00373 }

void CCAttrMap::TransformForBrush TransformBase Trans  ) 
 

Applies the given transform to all the attrs in this map that need to be rendered at every step of a brush or a blend. This allows us to tile as things such as bitmap fills remain in the same place always.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
Trans [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 304 of file attrmap.cpp.

00305 {
00306     CCRuntimeClass     *pType;
00307     void               *pVal;
00308     for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
00309     {
00310         GetNextAssoc(Pos,pType,pVal);
00311         if (pVal != NULL)
00312         {
00313             NodeAttribute* pNodeAttr = (NodeAttribute *)pVal;
00314             
00315             // check that we are not about to set line width to zero
00316             if( pNodeAttr->IsALineWidthAttr() && Trans.TransLines != FALSE )
00317             {
00318                 double Test =  Trans.GetScalar().MakeDouble() * (double)((AttrLineWidth*)pNodeAttr)->Value.LineWidth;
00319         //      TRACEUSER( "Diccon", _T("Scale line width by %f\n"), Test);
00320                 if (Test <= 1.0)
00321                 {
00322                 //  TRACEUSER( "Diccon", _T("Setting line width scaling OFF\n"));
00323                     Trans.TransLines = FALSE;
00324                 }
00325             }
00326 
00327             if (pNodeAttr->NeedsToRenderAtEachBrushStroke())
00328                 pNodeAttr->Transform(Trans);
00329         }
00330     }
00331 }

BOOL CCAttrMap::WillScaleLineWidthToZero TransformBase Trans  ) 
 

As above, this can be useful information as if we pass GDraw a line width of zero it reverts to zero quality.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
Trans - the transformation we wish to test [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this transformation will scale the line width in this map to zero or not
See also:
-

Definition at line 391 of file attrmap.cpp.

00392 {
00393     // first look up the line width
00394     AttrLineWidth* pLineWidth = NULL;
00395     Lookup( CC_RUNTIME_CLASS(AttrLineWidth), (void*&)pLineWidth );
00396     
00397     // if we don't have a line width then we're obviously not going to scale it to zero
00398     if (pLineWidth == NULL)
00399         return FALSE;
00400 
00401     // also look up the stroke colour, if it is fully transparent then the line
00402     // is invisible anyway
00403     AttrStrokeColour* pStrokeCol = NULL;
00404     Lookup( CC_RUNTIME_CLASS(AttrStrokeColour), (void*&)pStrokeCol );
00405     if (pStrokeCol && pStrokeCol->Value.Colour.IsTransparent())
00406         return FALSE;
00407 
00408     double ScaleFactor = Trans.GetScalar().MakeDouble();
00409     INT32 ScaleVal = (INT32)(ScaleFactor * (double)pLineWidth->Value.LineWidth);
00410     if (ScaleVal < 1)
00411         return TRUE;
00412 
00413     return FALSE;
00414 }


Member Data Documentation

Node* CCAttrMap::attrMapCreator
 

Definition at line 233 of file attrmap.h.

CMapPtrToPtr CCAttrMap::m_mapAttr [private]
 

Definition at line 236 of file attrmap.h.


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