AttrStrokeType Class Reference

StrokeType attribute StrokeType attributes are very simple, and merely contain a StrokeTypeAttrValue, which is the entity which holds all the info and does all the work. More...

#include <strkattr.h>

Inheritance diagram for AttrStrokeType:

NodeAttribute NodeRenderable Node CCObject SimpleCCObject List of all members.

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 NodeSimpleCopy ()
 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 AttributeValueGetAttributeValue ()
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.
PathProcessorStrokeGetPathProcessor ()
 Convenience function.

Protected Attributes

StrokeTypeAttrValue Value

Detailed Description

StrokeType attribute StrokeType attributes are very simple, and merely contain a StrokeTypeAttrValue, which is the entity which holds all the info and does all the work.

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

Definition at line 197 of file strkattr.h.


Constructor & Destructor Documentation

AttrStrokeType::AttrStrokeType  ) 
 

Default constructor for AttrStrokeType.

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

Definition at line 150 of file strkattr.cpp.

00151 {
00152 }

AttrStrokeType::AttrStrokeType Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

Constructs an AttrStrokeType Attribute.

Definition at line 171 of file strkattr.cpp.

00177                 : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)
00178 {
00179 }


Member Function Documentation

void AttrStrokeType::CopyNodeContents AttrStrokeType NodeCopy  )  [virtual]
 

Copies the node's contents to the node pointed to by NodeCopy.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
NodeCopy - returned containing a copy of this node [OUTPUTS]

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 }

BOOL AttrStrokeType::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.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/2000
Parameters:
pBecomeA - the becomeA object that tells us what to do [INPUTS] pParent - the node that this attribute is applied to
[OUTPUTS] 
Returns:
TRUE if everything went ok,

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 }

virtual AttrIndex AttrStrokeType::GetAttributeIndex  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 217 of file strkattr.h.

00217 { return ATTR_STROKETYPE; }

virtual AttributeValue* AttrStrokeType::GetAttributeValue  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 224 of file strkattr.h.

00224 { return(&Value); };

UINT32 AttrStrokeType::GetAttrNameID void   )  [virtual]
 

Retrieves a string resource ID describing this attribute.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Returns:
Attribute description string-resource ID

Reimplemented from NodeAttribute.

Definition at line 323 of file strkattr.cpp.

00324 {
00325     return(_R(IDS_ATTRSTROKETYPE));
00326 }

void AttrStrokeType::GetDebugDetails StringBase Str  )  [virtual]
 

Produces debug details about this node.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
On return, Str is filled in with details on this node [OUTPUTS]

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 }

UINT32 AttrStrokeType::GetNodeSize  )  const [virtual]
 

For finding the size of the node, in bytes.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Returns:
The size of this node, in bytes

Reimplemented from Node.

Definition at line 468 of file strkattr.cpp.

00469 {
00470     return(sizeof(AttrStrokeType));
00471 }

PathProcessorStroke * AttrStrokeType::GetPathProcessor void   ) 
 

Convenience function.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
the path processor of our attribute value

Definition at line 425 of file strkattr.cpp.

00426 {
00427     return Value.GetPathProcessor();
00428 }

BOOL AttrStrokeType::HasPathProcessor  ) 
 

A good way to determine if this is one of the default attributes.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if attribute value has a path processor, FALSE otherwise

Definition at line 404 of file strkattr.cpp.

00405 {
00406     if (Value.GetPathProcessor() == NULL)
00407         return FALSE;
00408     return TRUE;
00409 }

BOOL AttrStrokeType::NeedsTransparency void   )  const [virtual]
 

Strokes like the airbrush require transparency to be turned on to work.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/2/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this Attribute requires transparency mode to render properly.

Errors: -

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 }

INT32 AttrStrokeType::operator== const NodeAttribute NodeAttrib  )  [virtual]
 

Comparison operator - determines if the AttributeValues of both objects are ==.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
NodeAttrib - The node to compare this node to [INPUTS]
Returns:
TRUE if the nodes are considered equal

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 }

void AttrStrokeType::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

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 }

void AttrStrokeType::Render RenderRegion pRender  )  [virtual]
 

Renders this attribute (by simply calling the Render function of its contained AttributeValue).

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

Reimplemented from NodeAttribute.

Definition at line 195 of file strkattr.cpp.

00196 {
00197     GetAttributeValue()->Render(pRender);
00198 }

Node * AttrStrokeType::SimpleCopy void   )  [virtual]
 

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.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Returns:
A copy of the node, or NULL if memory runs out

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 }

BOOL AttrStrokeType::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

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 }

BOOL AttrStrokeType::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes out a record that represents the node, to either Native or Web file format.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
pFilter - filter to write to [INPUTS]
Returns:
TRUE if the Node has written out a record to the filter
This function is called before any of the AttrStrokeType's children are written to the filter.

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

See also:
Node::WritePreChildrenNative; Node::WritePreChildrenWeb; StrokeAttrRecordHandler::HandleRecord

Reimplemented from Node.

Definition at line 510 of file strkattr.cpp.

00511 {
00512     return(WritePreChildrenNative(pFilter));
00513 }


Member Data Documentation

StrokeTypeAttrValue AttrStrokeType::Value [protected]
 

Definition at line 233 of file strkattr.h.


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