#include <strkattr.h>
Inheritance diagram for AttrStrokeType:
Public Member Functions | |
AttrStrokeType () | |
Default constructor for AttrStrokeType. | |
AttrStrokeType (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
Constructs an AttrStrokeType Attribute. | |
virtual void | Render (RenderRegion *pRender) |
Renders this attribute (by simply calling the Render function of its contained AttributeValue). | |
virtual void | CopyNodeContents (AttrStrokeType *NodeCopy) |
Copies the node's contents to the node pointed to by NodeCopy. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
virtual INT32 | operator== (const NodeAttribute &NodeAttrib) |
Comparison operator - determines if the AttributeValues of both objects are ==. | |
virtual Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
virtual UINT32 | GetAttrNameID (void) |
Retrieves a string resource ID describing this attribute. | |
virtual AttrIndex | GetAttributeIndex () |
virtual void | GetDebugDetails (StringBase *Str) |
Produces debug details about this node. | |
virtual UINT32 | GetNodeSize () const |
For finding the size of the node, in bytes. | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes out a record that represents the node, to either Native or Web file format. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
virtual AttributeValue * | GetAttributeValue () |
virtual BOOL | NeedsTransparency () const |
Strokes like the airbrush require transparency to be turned on to work. | |
BOOL | DoBecomeA (BecomeA *pBecomeA, Node *pParent) |
Its a little unusual for attributes to have their own dobecomea function but this stroke attribute requires one due to all the work it does on paths. | |
BOOL | HasPathProcessor () |
A good way to determine if this is one of the default attributes. | |
PathProcessorStroke * | GetPathProcessor () |
Convenience function. | |
Protected Attributes | |
StrokeTypeAttrValue | Value |
Definition at line 197 of file strkattr.h.
|
Default constructor for AttrStrokeType.
Definition at line 150 of file strkattr.cpp.
|
|
Constructs an AttrStrokeType Attribute.
Definition at line 171 of file strkattr.cpp. 00177 : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected) 00178 { 00179 }
|
|
Copies the node's contents to the node pointed to by NodeCopy.
Definition at line 215 of file strkattr.cpp. 00216 { 00217 // Let the base class do its bit 00218 NodeAttribute::CopyNodeContents(NodeCopy); 00219 00220 // And then copy our Value 00221 *(NodeCopy->GetAttributeValue()) = *(GetAttributeValue()); 00222 }
|
|
Its a little unusual for attributes to have their own dobecomea function but this stroke attribute requires one due to all the work it does on paths.
Definition at line 447 of file strkattr.cpp. 00448 { 00449 ERROR2IF(pBecomeA == NULL, FALSE, "BecomeA pointer is NULL in AttrBrushType::DoBecomeA"); 00450 ERROR2IF(pParent == NULL, FALSE, "Parent node is NULL in AttrBrushType::DoBecomeA"); 00451 return Value.DoBecomeA(pBecomeA, pParent); 00452 }
|
|
Reimplemented from NodeAttribute. Definition at line 217 of file strkattr.h. 00217 { return ATTR_STROKETYPE; }
|
|
Reimplemented from NodeAttribute. Definition at line 224 of file strkattr.h. 00224 { return(&Value); };
|
|
Retrieves a string resource ID describing this attribute.
Reimplemented from NodeAttribute. Definition at line 323 of file strkattr.cpp. 00324 { 00325 return(_R(IDS_ATTRSTROKETYPE)); 00326 }
|
|
Produces debug details about this node.
Reimplemented from NodeRenderable. Definition at line 367 of file strkattr.cpp. 00368 { 00369 #ifdef _DEBUG 00370 NodeAttribute::GetDebugDetails(Str); 00371 00372 String_256 TempStr; 00373 TempStr._MakeMsg( _T("\r\nStroke type #1%s\r\n"), 00374 (Value.GetPathProcessor() == NULL) ? _T("old-style line") : _T("new stroke:") ); 00375 *Str += TempStr; 00376 00377 if (Value.GetPathProcessor() != NULL) 00378 { 00379 TempStr._MakeMsg( _T(" #1%s\r\n"), 00380 Value.GetPathProcessor()->GetRuntimeClass()->GetClassName() ); 00381 *Str += TempStr; 00382 } 00383 00384 TempStr._MakeMsg( _T("\r\nNeedsTransparency=#1%s\r\n"), NeedsTransparency() ? _T("TRUE") : _T("FALSE") ); 00385 *Str += TempStr; 00386 00387 #endif 00388 }
|
|
For finding the size of the node, in bytes.
Reimplemented from Node. Definition at line 468 of file strkattr.cpp. 00469 { 00470 return(sizeof(AttrStrokeType)); 00471 }
|
|
Convenience function.
Definition at line 425 of file strkattr.cpp. 00426 { 00427 return Value.GetPathProcessor(); 00428 }
|
|
A good way to determine if this is one of the default attributes.
Definition at line 404 of file strkattr.cpp. 00405 { 00406 if (Value.GetPathProcessor() == NULL) 00407 return FALSE; 00408 return TRUE; 00409 }
|
|
Strokes like the airbrush require transparency to be turned on to work.
Reimplemented from Node. Definition at line 340 of file strkattr.cpp. 00341 { 00342 BOOL SoWeDoReallyNeedTransparencyThenDoWe = FALSE; 00343 00344 PathProcessorStroke *pPathProc = Value.GetPathProcessor(); 00345 if(pPathProc != NULL) 00346 { 00347 SoWeDoReallyNeedTransparencyThenDoWe = pPathProc->NeedsTransparency(); 00348 } 00349 00350 return SoWeDoReallyNeedTransparencyThenDoWe; 00351 }
|
|
Comparison operator - determines if the AttributeValues of both objects are ==.
Reimplemented from NodeAttribute. Definition at line 263 of file strkattr.cpp. 00264 { 00265 // First check they are of the same type 00266 if (((NodeAttribute*)&NodeAttrib)->GetAttributeType() != GetAttributeType()) 00267 return FALSE; 00268 00269 // Make a more sensible pointer 00270 AttrStrokeType *Attr = (AttrStrokeType *) &NodeAttrib; 00271 00272 // Now let the AttributeValues compare themselves 00273 return( *((StrokeTypeAttrValue *) Attr->GetAttributeValue()) == 00274 *((StrokeTypeAttrValue *) GetAttributeValue()) ); 00275 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeRenderable. Definition at line 238 of file strkattr.cpp. 00239 { 00240 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00241 ENSURE(IS_A(pNodeCopy, AttrStrokeType), "PolyCopyNodeContents given wrong dest node type"); 00242 00243 if (IS_A(pNodeCopy, AttrStrokeType)) 00244 CopyNodeContents((AttrStrokeType*)pNodeCopy); 00245 }
|
|
Renders this attribute (by simply calling the Render function of its contained AttributeValue).
Reimplemented from NodeAttribute. Definition at line 195 of file strkattr.cpp. 00196 { 00197 GetAttributeValue()->Render(pRender); 00198 }
|
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
Reimplemented from NodeAttribute. Definition at line 293 of file strkattr.cpp. 00294 { 00295 AttrStrokeType* NodeCopy = new AttrStrokeType; 00296 if (NodeCopy == NULL) 00297 return(NULL); 00298 00299 // Call the base class 00300 NodeAttribute::CopyNodeContents(NodeCopy); 00301 00302 // And call our AttributeValue to copy itself too 00303 NodeCopy->GetAttributeValue()->SimpleCopy(GetAttributeValue()); 00304 00305 return(NodeCopy); 00306 }
|
|
Reimplemented from Node. Definition at line 515 of file strkattr.cpp. 00516 { 00517 #ifdef DO_EXPORT 00518 ERROR3IF(pFilter == NULL, "Illegal NULL param"); 00519 00520 BOOL ok = TRUE; 00521 PathProcessorStroke *pProcessor = Value.GetPathProcessor(); 00522 00523 // Jason's being lazy this month, I'm afraid, because he won't be here next month... 00524 if (pProcessor == NULL || 00525 !pProcessor->IsKindOf(CC_RUNTIME_CLASS(PathProcessorStrokeAirbrush))) 00526 { 00527 // It is a simple var-width stroke, or it is a vector stroke. These both export as 00528 // the same basic record tag, but with different "handle" words 00529 StrokeHandle Handle = 0x02000000; 00530 00531 // Get the handle of the stroke 00532 if (pProcessor == NULL) 00533 Handle = 0x01000000; 00534 else if (pProcessor->IsKindOf(CC_RUNTIME_CLASS(PathProcessorStrokeVector))) 00535 { 00536 Handle = ((PathProcessorStrokeVector *)pProcessor)->GetStrokeDefinition(); 00537 ERROR3IF((Handle & 0xff000000) != 0, "Handle overflow"); 00538 00539 // Make sure the stroke definition has preceeded any references to it 00540 ok = StrokeComponent::ExportStroke(pFilter, Handle); 00541 } 00542 //else 00543 // it's a simple variable-width (base class) stroker, so we need not do anything 00544 00545 // And write the record 00546 if (ok) 00547 { 00548 CamelotFileRecord Rec(pFilter, TAG_STROKETYPE, TAG_STROKETYPE_SIZE); 00549 00550 if (ok) ok = Rec.Init(); 00551 if (ok) ok = Rec.WriteUINT32((UINT32) Handle); 00552 if (ok) ok = pFilter->Write(&Rec); 00553 } 00554 } 00555 else 00556 { 00557 PathProcessorStrokeAirbrush *pProcessor = (PathProcessorStrokeAirbrush *) 00558 Value.GetPathProcessor(); 00559 00560 ValueFunction *pFunction = pProcessor->GetIntensityFunction(); 00561 ERROR3IF(pFunction == NULL, "No intensity function!?"); 00562 00563 // Currently, an airbrush record consists only of its intensity ValueFunction 00564 CamelotFileRecord *pRec = pFunction->WriteFileRecord(TAG_STROKEAIRBRUSH, 0, pFilter); 00565 if (pRec != NULL) 00566 { 00567 ok = pFilter->Write(pRec); 00568 delete pRec; 00569 pRec = NULL; 00570 } 00571 else 00572 ok = FALSE; 00573 } 00574 00575 if (!ok) 00576 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00577 00578 return(ok); 00579 #else 00580 return FALSE; 00581 #endif 00582 }
|
|
Writes out a record that represents the node, to either Native or Web file format.
If the AttrStrokeType writes out a record successfully to the file, it will return TRUE. If the AttrStrokeType chooses not to write itself to the filter (e.g. because it is not appropriate for this filter), then this function will return FALSE. Notes: Simple StrokeTypes (not using fancy bitmap/vector brushes) just write out a 4-byte (UINT32) record containing the stroke type. Defined stroke types at this time are: 0 - Simple variable width stroke
Reimplemented from Node. Definition at line 510 of file strkattr.cpp. 00511 { 00512 return(WritePreChildrenNative(pFilter)); 00513 }
|
|
Definition at line 233 of file strkattr.h. |