StrokeDefinition Class Reference

Stores a vector stroke definition A static list of these items is held in the StrokeComponent. More...

#include <strkcomp.h>

Inheritance diagram for StrokeDefinition:

LineDefinition CCObject SimpleCCObject List of all members.

Public Member Functions

 StrokeDefinition ()
 StrokeDefinition (Node *pStrokeTree, BOOL repeating=FALSE, INT32 repeats=0)
 Constructor.
 ~StrokeDefinition ()
 Destructor.
void SetStrokeName (StringBase *pName)
 Sets the name text string for this stroke.
void SetStrokeRepeating (BOOL Repeating)
 Sets the repeating flag for this stroke.
void SetNumStrokeRepeats (INT32 NumRepeats)
 Sets the number of repeats for this stroke.
void SetOverrideFill (BOOL Override)
void SetOverrideTrans (BOOL Override)
virtual BOOL IsDifferent (LineDefinition *pOther)
 Determine if 2 StrokeDefinitions are considered different. Used when adding strokes to the global list, so that like strokes can be merged.
NodeGetStrokeTree (void)
String_32GetStrokeName (void)
BOOL IsRepeating (void) const
INT32 NumRepeats (void) const
BOOL OverrideFill (void) const
BOOL OverrideTrans (void) const
BOOL NeedsTransparency (void) const
 Determine if this stroke needs transparency in order to render.
void SetIOStore (UINT32 NewValue)
UINT32 ReadIOStore (void) const

Private Attributes

NodepStroke
String_32 Name
INT32 Repeats
BOOL Repeating
BOOL OverridesFill
BOOL OverridesTrans
BOOL NeedsTrans
UINT32 IOStore

Detailed Description

Stores a vector stroke definition A static list of these items is held in the StrokeComponent.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/2/97
See also:
StrokeComponent

Definition at line 161 of file strkcomp.h.


Constructor & Destructor Documentation

StrokeDefinition::StrokeDefinition  )  [inline]
 

Definition at line 166 of file strkcomp.h.

00166 { ERROR3("Don't use this constructor"); };

StrokeDefinition::StrokeDefinition Node pStrokeTree,
BOOL  repeating = FALSE,
INT32  repeats = 0
 

Constructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/2/97
Parameters:
pStrokeTree - A pointer to a Spread node which is the root of a clipart [INPUTS] subtree which should be used for this stroke definition. It must obey these rules: It must be a Spread It must not be linked into any other parent tree structure It should contain at least one path node (or else the stroke will appear "blank"). You should do Make Shapes on the subtree so that text, blends, quickshapes, etc are all in path form It should be attribute complete, or close thereto
repeating - TRUE if this stroke definition should repeat along the stroke rather than being stretched to fit.

repeats - The number of times the brush should repeat along the stroke, or zero for 'work the best out at rendertime'

See also:
StrokeComponent::AddNewStroke

Definition at line 178 of file strkcomp.cpp.

00179 {
00180     ERROR3IF(pStrokeTree == NULL, "Illegal NULL param");
00181     ERROR3IF(!pStrokeTree->IsSpread(), "StrokeDefinitions must begin with a Spread (for now, at least)");
00182     ERROR3IF(pStrokeTree->FindParent() != NULL, "Stroke Definition looks like it's linked into a tree!");
00183 
00184     Repeating = repeating;
00185     Repeats   = repeats;
00186     pStroke   = pStrokeTree;
00187 
00188     // Check the subtree to see if it contains any transparency
00189     NeedsTrans = pStroke->ChildrenNeedTransparency();
00190 
00191     IOStore = 0;
00192 
00193     Name = TEXT("Custom brush");
00194 
00195     OverridesFill  = FALSE;
00196     OverridesTrans = FALSE;
00197 }

StrokeDefinition::~StrokeDefinition  ) 
 

Destructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/2/97

Definition at line 212 of file strkcomp.cpp.

00213 {
00214     if (pStroke != NULL)
00215     {
00216         pStroke->CascadeDelete();
00217         delete pStroke;
00218     }
00219 }


Member Function Documentation

String_32* StrokeDefinition::GetStrokeName void   )  [inline]
 

Definition at line 185 of file strkcomp.h.

00185 { return(&Name); };

Node* StrokeDefinition::GetStrokeTree void   )  [inline]
 

Definition at line 182 of file strkcomp.h.

00182 { return(pStroke); };

BOOL StrokeDefinition::IsDifferent LineDefinition pTest  )  [virtual]
 

Determine if 2 StrokeDefinitions are considered different. Used when adding strokes to the global list, so that like strokes can be merged.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/2/97
Parameters:
pOther - the stroke to compare this stroke to [INPUTS]
Returns:
TRUE if they're different in any way, FALSE if they are identical definitions

Implements LineDefinition.

Definition at line 296 of file strkcomp.cpp.

00297 {
00298     ERROR3IF(pTest == NULL, "Illegal NULL param");
00299 
00300     // check to make sure that pOther is in fact a StrokeDef so that
00301     // we can recast it
00302     StrokeDefinition* pOther = NULL;
00303     if (pTest->IS_KIND_OF(StrokeDefinition))
00304         pOther = (StrokeDefinition*)pTest;
00305     else
00306     {
00307         ERROR3("Parameter is not a stroke definition");
00308         return TRUE;
00309     }
00310 
00311     if (pOther->Repeating != Repeating)
00312         return(TRUE);
00313 
00314     if (pOther->Repeats != Repeats)
00315         return(TRUE);
00316 
00317     if (!Name.IsIdentical(pOther->Name))
00318         return(TRUE);
00319 
00320     if (pOther->pStroke == NULL || pStroke == NULL)
00321     {
00322         ERROR3("StrokeDefinition has not been properly initialised");
00323         return(TRUE);
00324     }
00325 
00326     // --- Check to see if the brush bounds are equal
00327     DocRect OtherBounds = ((Spread *)(pOther->pStroke))->GetBoundingRect();
00328     DocRect Bounds = ((Spread *)pStroke)->GetBoundingRect();
00329     if (Bounds != OtherBounds)
00330         return(TRUE);
00331 
00332     // --- Check the subtrees node-for-node to see if they are the same
00333     Node *pCurNode1 = pStroke->FindFirstDepthFirst();
00334     Node *pCurNode2 = pOther->pStroke->FindFirstDepthFirst();
00335 
00336     while (pCurNode1 != NULL && pCurNode2 != NULL)
00337     {
00338         // See if the nodes are equivalent - if not, we can return immediately
00339         if (pCurNode1->IsDifferent(pCurNode2))
00340             return(TRUE);
00341 
00342         // And go to the next node in both brushes
00343         pCurNode1 = pCurNode1->FindNextDepthFirst(pStroke);
00344         pCurNode2 = pCurNode2->FindNextDepthFirst(pOther->pStroke);
00345     }
00346 
00347     // If we did the entire search and both pointers ended up NULL simultaneously, then
00348     // we have an exact match
00349     if (pCurNode1 == NULL && pCurNode2 == NULL)
00350         return(FALSE);
00351 
00352     return(TRUE);
00353 }

BOOL StrokeDefinition::IsRepeating void   )  const [inline]
 

Definition at line 187 of file strkcomp.h.

00187 { return(Repeating); };

BOOL StrokeDefinition::NeedsTransparency void   )  const
 

Determine if this stroke needs transparency in order to render.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/97
Returns:
TRUE if this stroke needs transparency in order to render

Reimplemented from LineDefinition.

Definition at line 370 of file strkcomp.cpp.

00371 {
00372     return(NeedsTrans);
00373 }

INT32 StrokeDefinition::NumRepeats void   )  const [inline]
 

Definition at line 190 of file strkcomp.h.

00190 { return(Repeats); };

BOOL StrokeDefinition::OverrideFill void   )  const [inline]
 

Reimplemented from LineDefinition.

Definition at line 193 of file strkcomp.h.

00193 { return(OverridesFill); };

BOOL StrokeDefinition::OverrideTrans void   )  const [inline]
 

Reimplemented from LineDefinition.

Definition at line 194 of file strkcomp.h.

00194 { return(OverridesTrans); };

UINT32 StrokeDefinition::ReadIOStore void   )  const [inline]
 

Reimplemented from LineDefinition.

Definition at line 201 of file strkcomp.h.

00201 { return(IOStore); };

void StrokeDefinition::SetIOStore UINT32  NewValue  )  [inline]
 

Reimplemented from LineDefinition.

Definition at line 200 of file strkcomp.h.

00200 { IOStore = NewValue; };

void StrokeDefinition::SetNumStrokeRepeats INT32  NumRepeats  ) 
 

Sets the number of repeats for this stroke.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/97

Definition at line 271 of file strkcomp.cpp.

00272 {
00273     // Number of times a brush should repeat along a stroke, or zero to just work out the
00274     // optimal value on the fly
00275     Repeats = NumRepeats;
00276 }

void StrokeDefinition::SetOverrideFill BOOL  Override  )  [inline]
 

Reimplemented from LineDefinition.

Definition at line 175 of file strkcomp.h.

00175 { OverridesFill  = Override; };

void StrokeDefinition::SetOverrideTrans BOOL  Override  )  [inline]
 

Reimplemented from LineDefinition.

Definition at line 176 of file strkcomp.h.

00176 { OverridesTrans = Override; };

void StrokeDefinition::SetStrokeName StringBase pName  ) 
 

Sets the name text string for this stroke.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/97

Definition at line 234 of file strkcomp.cpp.

00235 {
00236     ERROR3IF(pName == NULL, "Illegal NULL param");
00237 
00238     pName->Left(&Name, 31);
00239 }

void StrokeDefinition::SetStrokeRepeating BOOL  SetMeToTrueIfYouReallyWantMeToBeRepeating  ) 
 

Sets the repeating flag for this stroke.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/3/97

Definition at line 253 of file strkcomp.cpp.

00254 {
00255     // TRUE if the stroke should repeat along the path, FALSE if it should stretch
00256     Repeating = SetMeToTrueIfYouReallyWantMeToBeRepeating;
00257 }


Member Data Documentation

UINT32 StrokeDefinition::IOStore [private]
 

Reimplemented from LineDefinition.

Definition at line 215 of file strkcomp.h.

String_32 StrokeDefinition::Name [private]
 

Definition at line 206 of file strkcomp.h.

BOOL StrokeDefinition::NeedsTrans [private]
 

Definition at line 213 of file strkcomp.h.

BOOL StrokeDefinition::OverridesFill [private]
 

Definition at line 210 of file strkcomp.h.

BOOL StrokeDefinition::OverridesTrans [private]
 

Definition at line 211 of file strkcomp.h.

Node* StrokeDefinition::pStroke [private]
 

Definition at line 201 of file strkcomp.h.

BOOL StrokeDefinition::Repeating [private]
 

Definition at line 209 of file strkcomp.h.

INT32 StrokeDefinition::Repeats [private]
 

Definition at line 208 of file strkcomp.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:01:32 2007 for Camelot by  doxygen 1.4.4