#include <strkattr.h>
Inheritance diagram for StrokeTypeAttrValue:
Public Member Functions | |
StrokeTypeAttrValue (PathProcessorStroke *pPathProcessor=NULL) | |
Default Constuctor for StrokeTypeAttrValue. | |
~StrokeTypeAttrValue () | |
Destructor Deletes any attached PathProcessor (see the constructor). | |
virtual void | Render (RenderRegion *pRegion, BOOL Temp=FALSE) |
Sets the StrokeTypeAttrValue attribute for the given render region. | |
virtual void | Restore (RenderRegion *pRegion, BOOL Temp) |
Restores the StrokeTypeAttrValue attribute for the given render region. | |
virtual void | GoingOutOfScope (RenderRegion *pRegion) |
A sister function to Render(). | |
virtual void | SimpleCopy (AttributeValue *pValue) |
See AttributeValue::SimpleCopy. | |
virtual NodeAttribute * | MakeNode () |
Make a new attribute node for this type of attr value - see base class. | |
virtual BOOL | IsDifferent (AttributeValue *pAttr) |
Determines if this AttrValue is different from the given one. | |
virtual StrokeTypeAttrValue & | operator= (StrokeTypeAttrValue &Attrib) |
Assignment operator. | |
virtual INT32 | operator== (const StrokeTypeAttrValue &Attrib) |
Comparison operator. | |
void | SetPathProcessor (PathProcessorStroke *pNewProcessor) |
To set the path processor used by this object. The processor is now "owned" by this attribute, and will be auto-deleted upon destruction. | |
PathProcessorStroke * | GetPathProcessor (void) const |
BOOL | DoBecomeA (BecomeA *pBecomeA, Node *pParent) |
To convert our stroke into something more palatable. pParent should always be a nodepath. | |
Static Public Member Functions | |
static BOOL | Init (void) |
Registers a default attribute of this type with the attribute manager. | |
Private Attributes | |
PathProcessorStroke * | pProcessor |
Definition at line 147 of file strkattr.h.
|
Default Constuctor for StrokeTypeAttrValue.
Definition at line 617 of file strkattr.cpp. 00618 { 00619 // Remember our processor, and let it know that we "own" it 00620 pProcessor = pPathProcessor; 00621 if (pProcessor != NULL) 00622 pProcessor->SetParentAttr(this); 00623 }
|
|
Destructor Deletes any attached PathProcessor (see the constructor).
Definition at line 639 of file strkattr.cpp. 00640 { 00641 if (pProcessor != NULL) 00642 delete pProcessor; 00643 }
|
|
To convert our stroke into something more palatable. pParent should always be a nodepath.
Definition at line 967 of file strkattr.cpp. 00968 { 00969 ERROR2IF(pBecomeA == NULL, FALSE, "BecomeA pointer is NULL in VariableWidthAttrValue::DoBecomeA"); 00970 ERROR2IF(pParent == NULL, FALSE, "Parent node is NULL in VariableWidthAttrValue::DoBecomeA"); 00971 00972 if (pProcessor == NULL) 00973 return FALSE; 00974 00975 if (!pBecomeA->BAPath()) 00976 return FALSE; 00977 00978 BOOL Success = FALSE; 00979 // UINT32 Dummy = 0; 00980 // if we have a nodepath then we can simply use its member path, otherwise we 00981 // have to ask it to become a nodepath 00982 if (pParent->IsNodePath()) 00983 { 00984 // we have a special calculation for nodepaths, because we can use their path 00985 Success = pProcessor->DoBecomeA(pBecomeA, &((NodePath*)pParent)->InkPath, pParent); 00986 } 00987 else if (pParent->CanBecomeA(pBecomeA)) 00988 { 00989 // we must be applied to some arbitrary shape. The thing is that we need to have 00990 // a path to pass to the PPB, so want to get a passback of all the paths in 00991 // the node 00992 00993 // we need to allocate a path 00994 Path* pPath = new Path; 00995 if (pPath != NULL && pPath->Initialise()) 00996 { 00997 PathBecomeA BecomeAPath(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), NULL, FALSE, pPath); 00998 if (pParent->DoBecomeA(&BecomeAPath)) 00999 { 01000 Success = pProcessor->DoBecomeA(pBecomeA, pPath, pParent); 01001 } 01002 delete pPath; 01003 } 01004 } 01005 return Success; 01006 }
|
|
Definition at line 174 of file strkattr.h. 00174 { return(pProcessor); };
|
|
A sister function to Render().
It gives the attribute a chance to remove any PathProcessor(s) it added to the RenderRegion when it was Render()ed. Notes: This attribute makes sure it removes any PathProcessor it added to handle path stroking in StrokeTypeAttrValue::Render
Reimplemented from AttributeValue. Definition at line 764 of file strkattr.cpp. 00765 { 00766 if (pProcessor != NULL) 00767 pRegion->PopPathProcessor(); 00768 }
|
|
Registers a default attribute of this type with the attribute manager.
Reimplemented from SimpleCCObject. Definition at line 660 of file strkattr.cpp. 00661 { 00662 // The default attribute is one that has no effect (i.e. produces old-style "lines") 00663 StrokeTypeAttrValue *pAttr = new StrokeTypeAttrValue; 00664 if (pAttr == NULL) 00665 return FALSE; 00666 00667 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(StrokeTypeAttrValue), 00668 pAttr); 00669 00670 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising StrokeTypeAttrValue"); 00671 00672 return(TRUE); 00673 }
|
|
Determines if this AttrValue is different from the given one.
Reimplemented from AttributeValue. Definition at line 842 of file strkattr.cpp. 00843 { 00844 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(StrokeTypeAttrValue)), 00845 "Different attribute types in StrokeTypeAttrValue::IsDifferent()"); 00846 00847 // Check they are NOT the same using the == operator 00848 return ( !(*((StrokeTypeAttrValue *)pAttr) == *this) ); 00849 }
|
|
Make a new attribute node for this type of attr value - see base class.
Reimplemented from AttributeValue. Definition at line 811 of file strkattr.cpp. 00812 { 00813 // Create new attribute node 00814 AttrStrokeType *pAttr = new AttrStrokeType; 00815 if (pAttr == NULL) 00816 return NULL; 00817 00818 // Copy attribute value (if any) into the new node. 00819 if (pAttr->GetAttributeValue() != NULL) 00820 pAttr->GetAttributeValue()->SimpleCopy(this); 00821 00822 return(pAttr); 00823 }
|
|
Assignment operator.
Definition at line 866 of file strkattr.cpp. 00867 { 00868 // Get rid of our old processor (if any) 00869 if (pProcessor != NULL) 00870 delete pProcessor; 00871 pProcessor = NULL; 00872 00873 // Copy the other attr's processor. If this fails, we'll get back a NULL pointer, 00874 // and will simply "convert" into a simple no-stroke attribute. 00875 if (Attrib.pProcessor != NULL) 00876 { 00877 pProcessor = Attrib.pProcessor->Clone(); 00878 if (pProcessor != NULL) 00879 pProcessor->SetParentAttr(this); 00880 } 00881 00882 return(*this); 00883 }
|
|
Comparison operator.
Definition at line 902 of file strkattr.cpp. 00903 { 00904 ERROR3IF(!Attrib.IsKindOf(CC_RUNTIME_CLASS(StrokeTypeAttrValue)), 00905 "Other attribute value isn't an StrokeTypeAttrValue"); 00906 00907 StrokeTypeAttrValue *Other = (StrokeTypeAttrValue *) &Attrib; 00908 00909 // Equal if they both have same processor (only applies if they are both NULL) 00910 if (pProcessor == Other->pProcessor) 00911 return(TRUE); 00912 00913 // Otherwise, if one of them is NULL, they can't be the same 00914 if (pProcessor == NULL || Other->pProcessor == NULL) 00915 return(FALSE); 00916 00917 // Finally, ask the processors if they are of the same type 00918 return(!pProcessor->IsDifferent(Other->pProcessor)); 00919 }
|
|
Sets the StrokeTypeAttrValue attribute for the given render region.
Implements AttributeValue. Definition at line 696 of file strkattr.cpp. 00697 { 00698 // Stack the current attribute and set ourselves up as the new one 00699 pRegion->SetStrokeType(this, Temp); 00700 00701 // Find if we have a path processor to do the stroking, and if we do, 00702 // stack a copy of it (a copy must be used to be thread-safe & bgrender-safe) 00703 if (pProcessor != NULL) 00704 { 00705 PathProcessorStroke *pNewProcessor = pProcessor->Clone(); 00706 if (pNewProcessor != NULL) 00707 pRegion->PushPathProcessor(pNewProcessor); 00708 } 00709 }
|
|
Restores the StrokeTypeAttrValue attribute for the given render region.
Implements AttributeValue. Definition at line 731 of file strkattr.cpp. 00732 { 00733 pRegion->RestoreStrokeType(this, Temp); 00734 }
|
|
To set the path processor used by this object. The processor is now "owned" by this attribute, and will be auto-deleted upon destruction.
Definition at line 938 of file strkattr.cpp. 00939 { 00940 if (pProcessor != NULL) 00941 delete pProcessor; 00942 00943 pProcessor = pNewProcessor; 00944 if (pProcessor != NULL) 00945 pProcessor->SetParentAttr(this); 00946 }
|
|
See AttributeValue::SimpleCopy.
Implements AttributeValue. Definition at line 785 of file strkattr.cpp. 00786 { 00787 ERROR3IF(!IS_A(pValue, StrokeTypeAttrValue), 00788 "Invalid Attribute value passed to StrokeTypeAttrValue::SimpleCopy"); 00789 00790 // Just uses the assignment operator 00791 *this = *((StrokeTypeAttrValue *) pValue); 00792 }
|
|
Definition at line 179 of file strkattr.h. |