#include <strkattr.h>
Inheritance diagram for VariableWidthAttrValue:
Public Member Functions | |
VariableWidthAttrValue (ValueFunction *pValueFunction=NULL) | |
Constuctor for VariableWidthAttrValue. | |
~VariableWidthAttrValue () | |
Destructor for VariableWidthAttrValue. | |
virtual void | Render (RenderRegion *pRegion, BOOL Temp=FALSE) |
Sets the VariableWidthAttrValue attribute for the given render region. | |
virtual void | Restore (RenderRegion *pRegion, BOOL Temp) |
Restores the VariableWidthAttrValue attribute for the given render region. | |
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 VariableWidthAttrValue & | operator= (VariableWidthAttrValue &Attrib) |
Assignment operator. | |
virtual INT32 | operator== (const VariableWidthAttrValue &Attrib) |
Comparison operator. | |
void | SetWidthFunction (VariableWidthID PredefinedFuncID) |
To set the width function used in stroking. | |
void | SetWidthFunction (ValueFunction *pNewFunction) |
To set the width function used in stroking. | |
ValueFunction * | GetWidthFunction (void) |
VariableWidthID | GetWidthFunctionID (void) |
Static Public Member Functions | |
static BOOL | Init (void) |
Registers a default attribute of this type with the attribute manager. | |
Private Attributes | |
VariableWidthID | PredefinedFunctionID |
ValueFunction * | WidthFunction |
Definition at line 275 of file strkattr.h.
|
Constuctor for VariableWidthAttrValue.
Definition at line 1400 of file strkattr.cpp. 01401 { 01402 WidthFunction = pValueFunction; 01403 PredefinedFunctionID = VarWidth_NotPredefined; 01404 }
|
|
Destructor for VariableWidthAttrValue.
Definition at line 1419 of file strkattr.cpp. 01420 { 01421 if (WidthFunction != NULL) 01422 delete WidthFunction; 01423 }
|
|
Definition at line 303 of file strkattr.h. 00303 { return(WidthFunction); };
|
|
Definition at line 304 of file strkattr.h. 00304 { return(PredefinedFunctionID); };
|
|
Registers a default attribute of this type with the attribute manager.
Reimplemented from SimpleCCObject. Definition at line 1440 of file strkattr.cpp. 01441 { 01442 // The default attribute is one that has no effect (i.e. produces constant-width "lines") 01443 VariableWidthAttrValue *pAttr = new VariableWidthAttrValue; 01444 if (pAttr == NULL) 01445 return FALSE; 01446 01447 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(VariableWidthAttrValue), 01448 pAttr); 01449 01450 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising VariableWidthAttrValue"); 01451 01452 return(TRUE); 01453 }
|
|
Determines if this AttrValue is different from the given one.
Reimplemented from AttributeValue. Definition at line 1577 of file strkattr.cpp. 01578 { 01579 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(VariableWidthAttrValue)), 01580 "Different attribute types in VariableWidthAttrValue::IsDifferent()"); 01581 01582 // Check they are NOT the same using the == operator 01583 return ( !(*((VariableWidthAttrValue *)pAttr) == *this) ); 01584 }
|
|
Make a new attribute node for this type of attr value - see base class.
Reimplemented from AttributeValue. Definition at line 1546 of file strkattr.cpp. 01547 { 01548 // Create new attribute node 01549 AttrVariableWidth *pAttr = new AttrVariableWidth(); 01550 if (pAttr == NULL) 01551 return NULL; 01552 01553 // Copy attribute value (if any) into the new node. 01554 if (pAttr->GetAttributeValue() != NULL) 01555 pAttr->GetAttributeValue()->SimpleCopy(this); 01556 01557 return(pAttr); 01558 }
|
|
Assignment operator.
Definition at line 1601 of file strkattr.cpp. 01602 { 01603 // Delete our existing WidthFunction (if any) 01604 if (WidthFunction != NULL) 01605 delete WidthFunction; 01606 WidthFunction = NULL; 01607 01608 // Try to clone the other attribute's width function. If this fails, we'll just 01609 // end up as a constant-width line (NULL ValueFunction pointer) 01610 if (Attrib.GetWidthFunction() != NULL) 01611 WidthFunction = Attrib.GetWidthFunction()->Clone(); 01612 01613 // And copy its ID member across too 01614 PredefinedFunctionID = Attrib.PredefinedFunctionID; 01615 01616 return(*this); 01617 }
|
|
Comparison operator.
Definition at line 1636 of file strkattr.cpp. 01637 { 01638 ERROR3IF(!Attrib.IsKindOf(CC_RUNTIME_CLASS(VariableWidthAttrValue)), 01639 "Other attribute value isn't an VariableWidthAttrValue"); 01640 01641 // VariableWidthAttrValue *Other = (VariableWidthAttrValue *) &Attrib; 01642 01643 // If both width functions are NULL, we are equal 01644 if (WidthFunction == NULL && Attrib.WidthFunction == NULL) 01645 return(TRUE); 01646 01647 // If only one function is NULL, we ca't be considered equal 01648 if (WidthFunction == NULL || Attrib.WidthFunction == NULL) 01649 return(FALSE); 01650 01651 // Finally, if both have a valid width function, ask them if they're equal 01652 return(!WidthFunction->IsDifferent(Attrib.WidthFunction)); 01653 }
|
|
Sets the VariableWidthAttrValue attribute for the given render region.
Implements AttributeValue. Definition at line 1474 of file strkattr.cpp. 01475 { 01476 pRegion->SetVariableWidth(this, Temp); 01477 }
|
|
Restores the VariableWidthAttrValue attribute for the given render region.
Implements AttributeValue. Definition at line 1500 of file strkattr.cpp. 01501 { 01502 pRegion->RestoreVariableWidth(this, Temp); 01503 }
|
|
To set the width function used in stroking.
Notes: See the alternative form of this method - it uses predefined function "shapes", which save in a more compact format. Definition at line 1678 of file strkattr.cpp. 01679 { 01680 if (WidthFunction != NULL) 01681 delete WidthFunction; 01682 01683 WidthFunction = pNewFunction; 01684 PredefinedFunctionID = VarWidth_NotPredefined; 01685 }
|
|
To set the width function used in stroking.
Definition at line 1704 of file strkattr.cpp. 01705 { 01706 ERROR3IF(PredefinedFuncID == VarWidth_NotPredefined, "You what?!"); 01707 01708 // get rid of any old width function 01709 if (WidthFunction != NULL) 01710 { 01711 delete WidthFunction; 01712 WidthFunction = NULL; 01713 } 01714 01715 // Remember the new predefined-width-function identifier, so that we 01716 // know that our width is a spaecial predefined form which can be saved 01717 // in a much simpler & smaller format 01718 PredefinedFunctionID = PredefinedFuncID; 01719 01720 switch(PredefinedFunctionID) 01721 { 01722 case VarWidth_Constant: 01723 WidthFunction = new ValueFunctionConstant(1.0); 01724 break; 01725 01726 case VarWidth_LinRamp: 01727 WidthFunction = new ValueFunctionRampLinear(1.0, 0.0); 01728 break; 01729 01730 case VarWidth_SRamp: 01731 WidthFunction = new ValueFunctionRampS(1.0, 0.0); 01732 break; 01733 01734 default: 01735 ERROR3("Unsupported predefined width function"); 01736 break; 01737 } 01738 }
|
|
See AttributeValue::SimpleCopy.
Implements AttributeValue. Definition at line 1520 of file strkattr.cpp. 01521 { 01522 ERROR3IF(!IS_A(pValue, VariableWidthAttrValue), 01523 "Invalid Attribute value passed to VariableWidthAttrValue::SimpleCopy"); 01524 01525 // Just uses the assignment operator 01526 *this = *((VariableWidthAttrValue *) pValue); 01527 }
|
|
Definition at line 304 of file strkattr.h. |
|
Definition at line 308 of file strkattr.h. |