AttrFractalFill Class Reference

Fractal Fill Attribute class. More...

#include <fillattr2.h>

Inheritance diagram for AttrFractalFill:

AttrBitmapFill AttrFillGeometry NodeAttribute NodeRenderable Node CCObject SimpleCCObject AttrTextureColourFill AttrTextureTranspFill AttrFractalColourFill AttrNoiseColourFill AttrFractalTranspFill AttrNoiseTranspFill List of all members.

Public Member Functions

 AttrFractalFill ()
 AttrFractalFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
virtual void Transform (TransformBase &)
 Transform a grad fill attribute by moving the start and end points.
virtual BOOL CanTransform ()
 Indicate that this attribute can be transformed.
virtual BOOL HidingNode ()
 This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc.
virtual BOOL ShowingNode ()
 This virtual function is called whenever the node is re-shown after being Hidden. It allows the node to reconstruct itself if it was optimised or send a message to let others know it is back etc.
virtual BOOL IsAFractalFill () const
 Virtual function for determining if the node is an attribute.
virtual void SetAspectRatio (double Ratio)
virtual NodeAttributeGetOtherAttrToApply (BOOL *IsMutate)
 Some attributes require a secondary atribute to be changed when they are changed. This routine obtains a pointer to the secondary attribute to apply.

Protected Member Functions

virtual void ValidateAttributeValue ()
 Makes sure the Coords of the Fill are sensible. Defaults to natural size of the bitmap.
BOOL CopyNodeContents (AttrFractalFill *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Detailed Description

Fractal Fill Attribute class.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/94
See also:
FractalFillAttribute

Definition at line 2028 of file fillattr2.h.


Constructor & Destructor Documentation

AttrFractalFill::AttrFractalFill  )  [inline]
 

Definition at line 2033 of file fillattr2.h.

02033 : AttrBitmapFill() {}

AttrFractalFill::AttrFractalFill Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
[inline]
 

Definition at line 2034 of file fillattr2.h.

02039                                          : 
02040             AttrBitmapFill(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}


Member Function Documentation

BOOL AttrFractalFill::CanTransform  )  [virtual]
 

Indicate that this attribute can be transformed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Returns:
TRUE => transform this attribute.
See also:
NodeRenderable::CanTransform

Reimplemented from AttrBitmapFill.

Definition at line 15882 of file fillattr.cpp.

15883 {
15884     return TRUE;
15885 }

BOOL AttrFractalFill::CopyNodeContents AttrFractalFill NodeCopy  )  [protected]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Parameters:
A copy of this node [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Definition at line 15900 of file fillattr.cpp.

15901 {
15902     ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFractalFill::CopyNodeContents!");
15903 
15904     AttrFillGeometry::CopyNodeContents( NodeCopy );
15905 
15906     // Copy contents specific to derived class here
15907     return TRUE;
15908 } 

NodeAttribute * AttrFractalFill::GetOtherAttrToApply BOOL *  IsMutate  )  [virtual]
 

Some attributes require a secondary atribute to be changed when they are changed. This routine obtains a pointer to the secondary attribute to apply.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/95
Returns:
The secondary attribute to apply, or NULL if none to apply

Reimplemented from AttrBitmapFill.

Definition at line 16065 of file fillattr.cpp.

16066 {
16067 #if !defined(EXCLUDE_FROM_RALPH)
16068     ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
16069 
16070     // A Fractal fill change also needs to set the Fill Mapping
16071 
16072     NodeAttribute* OtherAttr = NULL;
16073 
16074     BOOL Tileable = GetTileable();
16075 
16076     if (GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry))
16077     {
16078         OtherAttr = new AttrFillMappingLinear;
16079     }
16080     else
16081     {
16082         OtherAttr = new AttrTranspFillMappingLinear;
16083     }
16084 
16085     if (OtherAttr == NULL)
16086         return NULL;
16087 
16088     if (Tileable)
16089         ((AttrFillMappingLinear*)OtherAttr)->SetRepeat(RT_Repeating);
16090     else
16091         ((AttrFillMappingLinear*)OtherAttr)->SetRepeat(RT_RepeatInverted);
16092 
16093     *IsMutate = FALSE;
16094 
16095     return OtherAttr;
16096 #else
16097     return NULL;
16098 #endif
16099 }

BOOL AttrFractalFill::HidingNode  )  [virtual]
 

This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/11/94
Returns:
TRUE if all was ok. FALSE if an error occured.
ALWAYS CALL THE BASE CLASS' FUNCTION FROM YOUR OVERRIDDEN FUNCTION.

Reimplemented from AttrBitmapFill.

Definition at line 15925 of file fillattr.cpp.

15926 {
15927     // Call the base class first
15928     if (!AttrFillGeometry::HidingNode())
15929         return FALSE;
15930 
15931     ((FillGeometryAttribute*)GetAttributeValue())->DetachBitmap();
15932 
15933     return TRUE;
15934 }

virtual BOOL AttrFractalFill::IsAFractalFill  )  const [inline, virtual]
 

Virtual function for determining if the node is an attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/2/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node is a NodeAttribute, will return TRUE

Errors:

Reimplemented from NodeAttribute.

Definition at line 2048 of file fillattr2.h.

02048 { return TRUE; } 

void AttrFractalFill::SetAspectRatio double  Ratio  )  [virtual]
 

Reimplemented from AttrBitmapFill.

Definition at line 16101 of file fillattr.cpp.

16102 {
16103 #if !defined(EXCLUDE_FROM_RALPH)
16104     // Get the current Control Point Positions
16105     DocCoord StartPoint = *GetStartPoint();
16106     DocCoord EndPoint = *GetEndPoint();
16107     DocCoord EndPoint2 = *GetEndPoint2();
16108 
16109     DocCoord CentrePoint;
16110     DocCoord Drag2Blob;
16111     DocCoord Drag3Blob;
16112 
16113     GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
16114                             &CentrePoint, &Drag2Blob, &Drag3Blob);
16115 
16116     Drag3Blob = MakeLineAtAngle(CentrePoint, 
16117                                 Drag2Blob, 
16118                                 90, 
16119                                 INT32(CentrePoint.Distance(Drag2Blob) * Ratio)
16120                                 );
16121 
16122     GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob,
16123                             &StartPoint, &EndPoint, &EndPoint2);
16124 
16125     // Store the new points back in the Fill
16126     SetStartPoint(&StartPoint);
16127     SetEndPoint(&EndPoint);
16128     SetEndPoint2(&EndPoint2);
16129 #endif
16130 }

BOOL AttrFractalFill::ShowingNode  )  [virtual]
 

This virtual function is called whenever the node is re-shown after being Hidden. It allows the node to reconstruct itself if it was optimised or send a message to let others know it is back etc.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/11/94
Returns:
TRUE if all was ok. FALSE if an error occured (eg Out of memory).
ALWAYS CALL THE BASE CLASS' FUNCTION FROM YOUR OVERRIDDEN FUNCTION.

Reimplemented from AttrBitmapFill.

Definition at line 15952 of file fillattr.cpp.

15953 {
15954     // Call the base class first
15955     if (!AttrFillGeometry::ShowingNode())
15956         return FALSE;
15957 
15958     RecalcFractal();
15959 
15960     return TRUE;
15961 }

void AttrFractalFill::Transform TransformBase Trans  )  [virtual]
 

Transform a grad fill attribute by moving the start and end points.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Parameters:
Trans - the transform object to apply to this attribute. [INPUTS]
See also:
NodeRenderable::Transform

Reimplemented from AttrBitmapFill.

Definition at line 15855 of file fillattr.cpp.

15856 {
15857     if ( Trans.TransFills )
15858     {
15859         Trans.Transform( GetStartPoint(), 1);
15860         Trans.Transform( GetEndPoint(), 1);
15861         Trans.Transform( GetEndPoint2(), 1);
15862         Trans.Transform( GetEndPoint3(), 1);
15863 
15864         // Ensure the transformed Points are sensible
15865 //      ValidateAttributeValue();
15866         SetFractalDPI(GetDPI());
15867     }
15868 }

void AttrFractalFill::ValidateAttributeValue  )  [protected, virtual]
 

Makes sure the Coords of the Fill are sensible. Defaults to natural size of the bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94

Reimplemented from AttrBitmapFill.

Definition at line 15974 of file fillattr.cpp.

15975 {
15976 #if !defined(EXCLUDE_FROM_RALPH)
15977     if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0) &&
15978         (*GetEndPoint2()) != DocCoord(0,0))
15979         return;
15980 
15981     // Make some defaults
15982     DocRect AttrBounds = DocRect(0,0,0,0);
15983 
15984     INT32 Width  = DEFAULT_FILLWIDTH;
15985     INT32 Height = DEFAULT_FILLHEIGHT;
15986 
15987     // Are we an Orphan ?
15988     if (FindParent() != NULL)
15989     {
15990         // Nope, so we can use Daddies Bounding Box
15991         SelRange* Selected = GetApplication()->FindSelection();
15992                  
15993         if (Selected == NULL || Selected->Count() <= 1)
15994             AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
15995         else
15996             AttrBounds = Selected->GetBoundingRect();
15997 
15998         Width  = AttrBounds.Width();
15999         Height = Width;
16000     }
16001 
16002     // Find the middle of the Attributes Bounds
16003     DocCoord Centre = CentreOf(AttrBounds);
16004 
16005     // Get the current control positions
16006     DocCoord StartPoint = *GetStartPoint();
16007     DocCoord EndPoint = *GetEndPoint();
16008     DocCoord EndPoint2 = *GetEndPoint2();
16009 
16010     BOOL recalc = FALSE;
16011 
16012     // If the StartPoint is 'NULL' then make all points sensible
16013     if (StartPoint == DocCoord(0,0))
16014     {
16015         // Start in the middle
16016         StartPoint = DocCoord(Centre.x - Width/2, Centre.y - Height/2);
16017         // End on the Middle Right
16018         EndPoint = DocCoord(StartPoint.x + Width, StartPoint.y);
16019         // and Middle Top
16020         EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + Height);
16021 
16022         recalc = TRUE;
16023     }
16024 
16025     // If the EndPoint is 'NULL' then make end points sensible
16026     if (EndPoint == DocCoord(0,0))
16027     {
16028         EndPoint = DocCoord(StartPoint.x + Width, StartPoint.y);
16029         EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + Height);
16030 
16031         recalc = TRUE;
16032     }
16033 
16034     // If the EndPoint2 is 'NULL' then make it sensible
16035     if (EndPoint2 == DocCoord(0,0))
16036     {
16037         EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + Height);
16038 
16039         recalc = TRUE;
16040     }
16041 
16042     // Store the validated positions back
16043     SetStartPoint(&StartPoint);
16044     SetEndPoint(&EndPoint);
16045     SetEndPoint2(&EndPoint2);
16046 
16047     if (recalc)
16048         ((FillGeometryAttribute*)GetAttributeValue())->RecalcFractal();
16049 #endif
16050 }


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