NodeBrushMaker Class Reference

The NodeBrushMaker class. More...

#include <ndbrshmk.h>

Inheritance diagram for NodeBrushMaker:

NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Types

typedef std::vector< CPathPointInfoCListOfPointsToRender

Public Member Functions

 NodeBrushMaker ()
 This constructor creates a NodeBrushMaker linked to no other with all status flags false and an uninitialized bounding rectangle. Note: Initialise() must be called before the NodeBrushMaker is in a state in which it can be used.
 NodeBrushMaker (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This constructor initialises the nodes flags and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated.
 ~NodeBrushMaker ()
 Default deconstructor.
BOOL InitialiseInk (NodeRenderableInk **pInkNode, const UINT32 NumInkNodes=1, Progress *pProgress=NULL)
 To initialise the blendref, which creates the blendpaths that are placed along the NodeBrushPath to render the brush.
BOOL InitialisePath (NodeBrushPath *pBrushPath)
 To set the NodeBrushPath that the Brushmaker will use to render the brush objects to.
void InitialiseBrushArray (UINT32 NumObjects)
 Clears out the m_BrushRefPtrArray if it is not empty, and sets the size.
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
 if the bounding rect is valid it is returned, if not, it is recalculated and then returned.
virtual DocRect GetBlobBoundingRect ()
virtual void Render (RenderRegion *pRender)
 Will render the blendpath objects on to the path of the brush.
virtual void RenderEorDrag (RenderRegion *)
 Renders a version of the blender node for EORed dragging of blends.
virtual void Transform (TransformBase &Trans)
 Transforms all the paths attached to this blender node.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
BOOL SetPositionRandomness (double Value)
BOOL SetAttributeRandomness (double Value)
BOOL SetSizeRandomness (double Value)
BOOL SetAlignmentRandomness (double Value)
double GetPositionRandomness ()
double GetAttrRandomness ()
double GetSizeRandomness ()
double GetAlignmentRandomness ()
void SetGRenderBitmap (GRenderBrush *pGRenderBitmap)
 To set the pointer to the 'big' bitmap used to store the view.
MILLIPOINT GetBrushSpacing ()
 As above.
BOOL SetBrushSpacing (MILLIPOINT Spacing)
 To set the spacing between brush objects.
PathOffset GetPathOffsetType ()
 as above
MILLIPOINT GetPathOffsetValue ()
 as above
void SetPathOffsetType (PathOffset Offset)
 to set the offset type for this brush
void SetPathOffsetValue (MILLIPOINT Value)
 to set the offset distance for this brush
void SetBlendRef (BlendRef *pBlendRef)
 To set the used to generate the brush objects.
BOOL GetRotated ()
 as above
void SetRotated (BOOL Rotate)
 To set the rotate member.
void SetUsePathCache (BOOL Value)
 To tell the nbm to ask the nbp to use its cached path processor to get points along the path. This will speed up the first render after an alteration in the path. However after the first rendering pass it should be set to false again because a) the points themselves will be cached and b)the cached processor will probably be deleted.
void SetNumberOfSteps (INT32 Steps)
 To set the number of steps.
BOOL GetStartCoord (DocCoord *Coord)
 To get the starting coordinate of the brush.
void SetStartCoord (DocCoord Coord)
 To set the starting coordinate of the brush.
void RenderStep (INT32 StepNum, Spread *pSpread, CPathPointInfo Point)
 To draw the brush stroke to the screen as quickly as possible. This is achieved by drawing the path and attributes to the render region, the blitting straight away.
NodeRenderableInkGetInkNode ()
 To get the inknode used to make the brush.
BOOL PrepareToRender (Spread *pSpread)
 Sets up the render region and renders the existing view into it. Call this before rendering any brush steps/.
void FinishRender ()
 Informs the NBM that the 'creation' phase of rendering has finished. Deletes the bitmap.
void RecalculateMaxStep ()
 Recalculates the max step of the brush, call this when the path gets changed.
void ClearListOfPointsToRender ()
 Clears out the cached list of points to render, ensures that all points will be rendered on the next Render.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Protected Member Functions

virtual NodeSimpleCopy ()
 Makes a copy of all the data in the node.
void RenderAttributes (RenderRegion *pRender, CCAttrMap *pAttrMap)
 Renders the attributes to the given render region.
void CopyNodeContents (NodeBrushMaker *pCopyOfNode)
 Copies the data in this node to pCopyOfNode by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.
void ResetMembers ()
 Initialises the member variables.
void RandomizeShape (Trans2DMatrix *TransformMatrix)
 To add randomization to the blendpath to be rendered. Transformations are calculated for the three different types of randomization possible and combined with the transformation matrix used to translate to the point along the nodebrushpath.
void RandomizeAttributes ()
 To add randomization to the attributes of the brush object.
DocCoord SetPosition (CPathPointInfo OriginalPoint, UINT32 AltValue, CListOfPointsToRender::iterator *ListPosition)
 To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.
BOOL GetGRenderBitmap (DocRect *pRenderRect, GRenderBrush **ppGRender, Spread *pSpread)
 To return a GRenderDIB, if we don't already have one then create one, if we do then simply resize it to save time.
BOOL DrawViewToRenderRegion (Spread *pSpread, RenderRegion *pRender)
 To render whats currently in the tree onto the render region.
void AddPointsInRectToList (DocRect Rect)
 To determine which of the brush objects intersect with Rect, these are then added to the list of points to render.
void AddAllPointsToList ()
 Adds all the points in the brush to the list of things to be rendered.
void RenderBrushObjectAtPoint (CPathPointInfo Point, RenderRegion *pRender)
 Renders a brush object at the point specified.
void GetDebugDetails (StringBase *Str)
 Displays debugging info of the tree For obtaining debug information about the Node.
void GetDebugDetails (StringBase *Str, BlendRef *pBlendRef)
 For obtaining debug information about the blend reference.

Protected Attributes

String_32 m_BrushMakerName
NodeRenderableInkm_pInkNode
BlendRefm_pBlendRef
NodeBrushPathm_pNodeBrushPath
GRenderBrushm_pGRender
GRenderBrushm_pGRenderDIB
CListOfPointsToRender m_ListOfPointsToRender
std::vector< BrushRef * > m_BrushRefPtrArray
MILLIPOINT m_BrushSpacing
double m_PositionRandomness
double m_AttrRandomness
double m_SizeRandomness
double m_AlignmentRandomness
UINT32 m_AltValue
PathOffset m_PathOffsetType
MILLIPOINT m_PathOffsetValue
CCAttrMapm_pAttrMap
INT32 m_BrushStep
INT32 m_MaxStep
MILLIPOINT m_CurrentDistance
DocCoord m_StartCoord
DocRect m_BrushBoundingRect
BOOL m_bRandomizeShape
BOOL m_JustTransformed
BOOL m_bFirstRender
BOOL m_bRotate
BOOL m_bTile
BOOL m_bUsePathCache
std::vector< BlendPathOffsetm_OffsetList

Private Member Functions

 CC_DECLARE_DYNCREATE (NodeBrushMaker)

Detailed Description

The NodeBrushMaker class.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/10/99

Definition at line 154 of file ndbrshmk.h.


Member Typedef Documentation

typedef std::vector< CPathPointInfo > NodeBrushMaker::CListOfPointsToRender
 

Definition at line 159 of file ndbrshmk.h.


Constructor & Destructor Documentation

NodeBrushMaker::NodeBrushMaker  ) 
 

This constructor creates a NodeBrushMaker linked to no other with all status flags false and an uninitialized bounding rectangle. Note: Initialise() must be called before the NodeBrushMaker is in a state in which it can be used.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
See also:
Initialise()

Definition at line 199 of file ndbrshmk.cpp.

00199                               : NodeRenderableInk()
00200 {
00201     ResetMembers();
00202 
00203 }

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

This constructor initialises the nodes flags and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
ContextNode,: Pointer to a node which this node is to be attached to. [INPUTS] MonoOn Direction: MonoOff Specifies the direction in which the node is to be attached to the ContextNode. The values this variable can take are as follows:
PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node

BoundingRect: Bounding rectangle

The remaining inputs specify the status of the node:

Locked: Is node locked ? Mangled: Is node mangled ? Marked: Is node marked ? Selected: Is node selected ?

Note: Initialise() must be called before the NodeBrushMaker is in a state in which it can be used.

See also:
Initialise()
Returns:
Errors: An assertion error will occur if ContextNode is NULL

Definition at line 171 of file ndbrshmk.cpp.

00177                :NodeRenderableInk(ContextNode, Direction, Locked, Mangled, Marked, Selected )  
00178 {                         
00179     ResetMembers(); 
00180 }

NodeBrushMaker::~NodeBrushMaker  ) 
 

Default deconstructor.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99

Definition at line 215 of file ndbrshmk.cpp.

00216 {
00217     //delete m_pAttrMap;
00218     PORTNOTETRACE("other","NodeBrushMaker::~NodeBrushMaker - not deleting m_pGRender");
00219 #ifndef EXCLUDE_FROM_XARALX
00220     DELPTR(m_pGRender);
00221 #endif
00222     if (m_pBlendRef != NULL)
00223         DELPTR(m_pBlendRef);
00224 
00225 
00226 }


Member Function Documentation

void NodeBrushMaker::AddAllPointsToList  )  [protected]
 

Adds all the points in the brush to the list of things to be rendered.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 1592 of file ndbrshmk.cpp.

01593 {
01594 //  TRACEUSER( "Diccon", _T("\nAdding ALL points\n"));
01595     MILLIPOINT DistanceToPoint = 0;
01596     CPathPointInfo PathPoint;
01597 
01598     while (DistanceToPoint < (m_MaxStep * m_BrushSpacing))
01599     {
01600         double Angle;
01601         DocCoord Point; 
01602         BOOL ok = m_pNodeBrushPath->GetPointAtDistance(DistanceToPoint, &Point, &Angle, m_bUsePathCache);
01603         if (ok)
01604         {
01605             PathPoint.m_Point = Point;
01606             PathPoint.m_Tangent = Angle;
01607             m_ListOfPointsToRender.push_back( PathPoint );
01608         //  //TRACEUSER( "Diccon", _T("Adding point %d, %d\n"), Point.x, Point.y);
01609         }
01610         // get the next distance
01611         DistanceToPoint += m_BrushSpacing;
01612     }
01613 
01614 
01615 }

void NodeBrushMaker::AddPointsInRectToList DocRect  Rect  )  [protected]
 

To determine which of the brush objects intersect with Rect, these are then added to the list of points to render.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Rect - the rect in which we look for brush objects [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 1529 of file ndbrshmk.cpp.

01530 {
01531     
01532     //TRACEUSER( "Diccon", _T("\nAdding points in RECT\n"));
01533     
01534     MILLIPOINT DistanceToPoint = 0; 
01535     
01536     DocCoord TopRight;
01537     DocCoord PointToCheck;
01538     DocCoord BottomLeft;
01539     CPathPointInfo PathPoint;
01540     double Angle;
01541     BOOL ok;
01542     MILLIPOINT Width = m_BrushBoundingRect.Width() / 2;
01543     MILLIPOINT Height = m_BrushBoundingRect.Height() / 2;
01544     while (DistanceToPoint < (m_MaxStep * m_BrushSpacing))
01545     {
01546     
01547         ok = m_pNodeBrushPath->GetPointAtDistance(DistanceToPoint, &PointToCheck, &Angle, m_bUsePathCache );
01548         if (ok)
01549         {
01550             // we need to compare the bounding rect of a brush object centred at
01551             // PointToCheck.  m_BrushBoundingRect holds the correct dimensions of the brush
01552             
01553             
01554             TopRight.x = PointToCheck.x + Width;
01555             TopRight.y = PointToCheck.y + Height ;
01556             
01557             
01558             BottomLeft.x = PointToCheck.x - Width;
01559             BottomLeft.y = PointToCheck.y - Height;
01560 
01561             DocRect BrushRect(BottomLeft, TopRight);
01563             // is there an intersection? If so add this point to the list
01564             if (BrushRect.IsIntersectedWith(Rect))
01565             {
01566                 PathPoint.m_Point = PointToCheck;
01567                 PathPoint.m_Tangent = Angle;
01568                 //TRACEUSER( "Diccon", _T("Adding point %d, %d\n"), PointToCheck.x, PointToCheck.y);
01569                 m_ListOfPointsToRender.push_back( PathPoint );
01570             }
01571         }
01572         // get the next distance
01573         DistanceToPoint += m_BrushSpacing;
01574     }
01575 }

NodeBrushMaker::CC_DECLARE_DYNCREATE NodeBrushMaker   )  [private]
 

void NodeBrushMaker::ClearListOfPointsToRender  ) 
 

Clears out the cached list of points to render, ensures that all points will be rendered on the next Render.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 1940 of file ndbrshmk.cpp.

01941 {
01942     m_ListOfPointsToRender.clear();
01943 }

void NodeBrushMaker::CopyNodeContents NodeBrushMaker pCopyOfNode  )  [protected]
 

Copies the data in this node to pCopyOfNode by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pCopyOfNode - The node to copy data to [INPUTS]
See also:
NodeRenderableInk::CopyNodeContents

Definition at line 341 of file ndbrshmk.cpp.

00342 {
00343     NodeRenderableInk::CopyNodeContents(pCopyOfNode);
00344     
00345     // Copy contents specific to derived class here
00346 
00347 
00348 }

BOOL NodeBrushMaker::DrawViewToRenderRegion Spread pSpread,
RenderRegion pRender
[protected]
 

To render whats currently in the tree onto the render region.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pSpread - pointer to the current spread [INPUTS] pRender - the region to render to
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 1461 of file ndbrshmk.cpp.

01462 {
01463     
01465     if(pRender != NULL)
01466     {
01467         // get the view
01468         DocView* pDocView = DocView::GetCurrent();
01469         if (pDocView != FALSE)
01470         {
01471             
01472             // draw the view,   
01473             pDocView->ContinueRenderView(pRender,  pSpread, TRUE, FALSE);
01474             
01475             // render the brush so far
01476         
01477             Render(pRender);
01478         
01479         //  //TRACEUSER( "Diccon", _T("\nFinished Drawing View\n"));
01480             return TRUE;
01481         }
01482         else
01483             return FALSE;
01484     }
01485     else
01486         return FALSE;
01487 
01488 }

void NodeBrushMaker::FinishRender  ) 
 

Informs the NBM that the 'creation' phase of rendering has finished. Deletes the bitmap.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 1356 of file ndbrshmk.cpp.

01357 {
01358     if (m_pGRenderDIB != NULL)
01359     {
01360     //  m_pGRender->StopRender();
01361     PORTNOTETRACE("other","NodeBrushMaker::FinishRender - not deleting m_pGRenderDIB");
01362 #ifndef EXCLUDE_FROM_XARALX
01363         delete m_pGRenderDIB;
01364 #endif
01365         m_pGRenderDIB = NULL;
01366     }
01367     m_bFirstRender = FALSE;
01368     
01369     if (m_pNodeBrushPath != NULL)
01370         m_pNodeBrushPath->StoppedBrush();
01371 
01372 }

double NodeBrushMaker::GetAlignmentRandomness  ) 
 

double NodeBrushMaker::GetAttrRandomness  ) 
 

DocRect NodeBrushMaker::GetBlobBoundingRect  )  [virtual]
 

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
DocRect - Returns the bounding rect of the brushmaker node and its blobs

Reimplemented from NodeRenderable.

Definition at line 868 of file ndbrshmk.cpp.

00869 {
00870     return (GetBoundingRect());
00871 }

DocRect NodeBrushMaker::GetBoundingRect BOOL  DontUseAttrs = FALSE,
BOOL  HitTest = FALSE
[virtual]
 

if the bounding rect is valid it is returned, if not, it is recalculated and then returned.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
DontUseAttrs - TRUE if we should ignore the nodes attributes. [INPUTS] Defaults to FALSE HitTest - TRUE if being called during HitTest
Returns:
The nodes bounding rect
See also:
NodeBrushMaker::GetBlobBoundingRect

Reimplemented from NodeRenderableBounded.

Definition at line 842 of file ndbrshmk.cpp.

00843 {
00844     DocRect Rect;
00845 //  double Distance  = m_pNodeBrushPath->GetPathLength();
00846 //  //TRACEUSER( "Diccon", _T("Path length %d\n"), Distance);
00847 //  m_pNodeBrushPath->InvalidateBoundingRect();
00848     Rect = m_pNodeBrushPath->GetBoundingRect();
00849     Rect.Inflate(m_BrushBoundingRect.Width()/2, m_BrushBoundingRect.Height()/2);
00850     if (m_PathOffsetType != OFFSET_NONE)
00851         Rect.Inflate(m_PathOffsetValue, m_PathOffsetValue);
00852     return Rect;
00853 
00854 }

MILLIPOINT NodeBrushMaker::GetBrushSpacing  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the spacing between the brush objects

Definition at line 933 of file ndbrshmk.cpp.

00934 {
00935     return m_BrushSpacing;
00936 }

void NodeBrushMaker::GetDebugDetails StringBase Str,
BlendRef pBlendRef
[protected]
 

For obtaining debug information about the blend reference.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/2/95
Parameters:
Str,: String giving debug info about the node [OUTPUTS]

Definition at line 441 of file ndbrshmk.cpp.

00442 {
00443 #ifdef _DEBUG
00444     String_256 TempStr;
00445 
00446     TempStr._MakeMsg( _T("Num blend paths = #1%d\r\n"), pBlendRef->GetNumBlendPaths() );
00447     *Str += TempStr;
00448     BlendPath* pBlendPath = pBlendRef->GetFirstBlendPath();
00449     while (pBlendPath != NULL)
00450     {
00451         Path*      pPath   = pBlendPath->GetPath();
00452         PathVerb*  pVerbs  = pPath->GetVerbArray();
00453         PathFlags* pFlags  = pPath->GetFlagArray();
00454         DocCoord*  pCoords = pPath->GetCoordArray();
00455 
00456         TempStr._MakeMsg( _T("Original Mapping = #1%d\r\n"), pBlendPath->GetOrigMapping() );
00457         *Str += TempStr;
00458 
00459         for (INT32 i=0; i<pPath->GetNumCoords(); i++)
00460         {
00461             // Add the info to the string
00462             TempStr._MakeMsg( TEXT("#1%d.\t#2%d\t#3%ld,\t#4%ld\t"),
00463                               i, pVerbs[i], pCoords[i].x, pCoords[i].y );
00464             (*Str) += TempStr;
00465 
00466             if (pFlags[i].IsEndPoint)
00467             {
00468                 TempStr._MakeMsg( _T(": E\t") );
00469                 (*Str) += TempStr;
00470             }
00471 
00472             *Str += _T("\r\n");
00473         }
00474         pBlendPath = pBlendRef->GetNextBlendPath(pBlendPath);
00475     }
00476 #endif
00477 }

void NodeBrushMaker::GetDebugDetails StringBase Str  )  [protected, virtual]
 

Displays debugging info of the tree For obtaining debug information about the Node.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Str,: String giving debug info about the node [OUTPUTS]

Reimplemented from NodeRenderableBounded.

Definition at line 407 of file ndbrshmk.cpp.

00408 {
00409 #ifdef _DEBUG
00410     // Call base class
00411     NodeRenderableInk::GetDebugDetails( Str );
00412     
00413     /*
00414     (*Str) += TEXT( "\r\nBrushMaker Data Dump\r\n" );
00415 
00416     char buf[500];
00417     sprintf(buf,        
00418                         );
00419 
00420     *Str += buf;
00421 
00422     *Str += "--------- Start\r\n\r\n";
00423     GetDebugDetails(Str,m_pBlendRef);
00424 
00425     */
00426 #endif
00427 }

BOOL NodeBrushMaker::GetGRenderBitmap DocRect pRenderRect,
GRenderBrush **  ppGRender,
Spread pSpread
[protected]
 

To return a GRenderDIB, if we don't already have one then create one, if we do then simply resize it to save time.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pRect - the bounding rectangle of the render region we want to create [INPUTS]
pGRender - a new GRenderBitmap [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 1388 of file ndbrshmk.cpp.

01389 {
01390     PORTNOTETRACE("other","NodeBrushMaker::GetGRenderBitmap - do nothing");
01391 #ifndef EXCLUDE_FROM_XARALX
01392 // if it already points at something then delete it
01393     if (*ppGRender != NULL)
01394         delete *ppGRender;
01395 
01396     // now we need to make a new one
01397 
01398     // Lets setup a few variables need to create the new BMP
01399     View*   pView = View::GetCurrent();
01400     Matrix  Mat(1,0,0,1,0,0);
01401     FIXED16 Scale = 1;
01402 
01403 
01404 
01405     // Check to see if we`ve got an empty rect if so then return NULL!
01406     ERROR2IF(pRenderRect->IsEmpty(),FALSE,"We`ve got an empty DocRect");
01407 
01408     DocRect CopyRect = *pRenderRect;
01409     // Create a new GRenderBitmap region at 32BPP and 96 DPI
01410     GRenderBrush* pNewGRender = new GRenderBrush(CopyRect, Mat, Scale, 32, 96); // FALSE, 0, NULL, TRUE);
01411 
01412     // Check to see if the Render Region is valid!
01413     ERROR2IF(pNewGRender == NULL,FALSE,"Failed to create a GRenderBitmap in ");
01414     
01415     // Start to render into region!
01416     if(!pNewGRender->AttachDevice(pView, NULL, NULL))
01417     {
01418         ERROR3("Cannot attatch devices");
01419         
01420         delete pNewGRender;
01421           pNewGRender = NULL;
01422         
01423         return FALSE;
01424     }
01425     
01426 
01427 //  pNewGRender->m_DoCompression = TRUE;
01428     
01429     pNewGRender->InitAttributes();
01430     pNewGRender->RRQuality.SetQuality(QUALITY_MAX);
01431     pNewGRender->SetQualityLevel();
01432     pNewGRender->SetLineAttributes();
01433     pNewGRender->SetFillAttributes();
01434     pNewGRender->SetImmediateRender(TRUE);
01435     
01436     BOOL ok = pNewGRender->AttachDevice(pView, pView->GetRenderDC(), pSpread);
01437     if (ok)
01438     {
01439         pNewGRender->InitDevice();
01440         *ppGRender = pNewGRender;
01441         
01442     }
01443     return ok;
01444 #endif
01445     return false;
01446 }

NodeRenderableInk * NodeBrushMaker::GetInkNode  ) 
 

To get the inknode used to make the brush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE if the start coordinate has not been set
See also:
-

Definition at line 1242 of file ndbrshmk.cpp.

01243 {
01244     return m_pInkNode;
01245 }

UINT32 NodeBrushMaker::GetNodeSize  )  const [virtual]
 

For finding the size of the node.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
The size of the node in bytes
See also:
Node::GetSubtreeSize

Reimplemented from Node.

Definition at line 888 of file ndbrshmk.cpp.

00889 {     
00890     return (sizeof(NodeBrushMaker)); 
00891 }  

PathOffset NodeBrushMaker::GetPathOffsetType  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
The type of pathoffset this brush is using
See also:
-

Definition at line 954 of file ndbrshmk.cpp.

00955 {
00956     return m_PathOffsetType;
00957 }

MILLIPOINT NodeBrushMaker::GetPathOffsetValue  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
The value of the path offset used by this brush
See also:
-

Definition at line 990 of file ndbrshmk.cpp.

00991 {
00992     return m_PathOffsetValue;
00993 }

double NodeBrushMaker::GetPositionRandomness  ) 
 

BOOL NodeBrushMaker::GetRotated  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
Current value of m_bRotate
See also:
-

Definition at line 1066 of file ndbrshmk.cpp.

01067 {
01068     return m_bRotate;
01069 }

double NodeBrushMaker::GetSizeRandomness  ) 
 

BOOL NodeBrushMaker::GetStartCoord DocCoord pCoord  ) 
 

To get the starting coordinate of the brush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
the starting coordinate of the brush [OUTPUTS]
Returns:
TRUE if successful, FALSE if the start coordinate has not been set
See also:
-

Definition at line 1506 of file ndbrshmk.cpp.

01507 {
01508     *pCoord = m_StartCoord;
01509 
01510     return TRUE;
01511 }

void NodeBrushMaker::InitialiseBrushArray UINT32  NumObjects  ) 
 

Clears out the m_BrushRefPtrArray if it is not empty, and sets the size.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Number of objects to size the array at [INPUTS]
Returns:
-

Definition at line 284 of file ndbrshmk.cpp.

00285 {
00286     UINT32 i = 0;
00287     while (i < m_BrushRefPtrArray.size())
00288     {
00289         delete m_BrushRefPtrArray[i++];
00290     }
00291     m_BrushRefPtrArray.clear();
00292 
00293     m_BrushRefPtrArray.resize( NumObjects );
00294 
00295     // fill the array with NULL objects so that we can check later
00296     // to see if our allocations have worked
00297     i = 0;
00298     while (i < m_BrushRefPtrArray.size())
00299     {
00300         m_BrushRefPtrArray[i++] = NULL;
00301     }
00302 
00303 }

BOOL NodeBrushMaker::InitialiseInk NodeRenderableInk **  ppInkNode,
const UINT32  NumInkNodes = 1,
Progress pProgress = NULL
 

To initialise the blendref, which creates the blendpaths that are placed along the NodeBrushPath to render the brush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pInk - array of Ink nodes to make the brush objects from [INPUTS] pBlendRef - blendref to make the brush from, default is NULL pProgress - defaults to NULL
- [OUTPUTS]
Returns:
TRUE if successful, otherwise FALSE

Definition at line 1113 of file ndbrshmk.cpp.

01114 {
01115     ERROR2IF(*ppInkNode == NULL,FALSE,"pThisNode == NULL");
01116     ERROR2IF(NumInkNodes == 0, FALSE, "No ink nodes");  
01117     
01118     InitialiseBrushArray(NumInkNodes);
01119     
01120     UINT32 i = 0;
01121     while (i < NumInkNodes)
01122     {
01123         m_BrushRefPtrArray[i] = new BrushRef;
01124         ERROR2IF(m_BrushRefPtrArray[i] == NULL, FALSE, "Unable to allocate brushref object");
01125         if (!m_BrushRefPtrArray[i]->Initialise(ppInkNode[i]))
01126         {
01127             ERROR3("Failed to initialise brushref");
01128             InitialiseBrushArray(MAX_BRUSH_OBJECTS);
01129             return FALSE;
01130         }
01131         i++;
01132     }
01133 
01134     return TRUE;
01135 }

BOOL NodeBrushMaker::InitialisePath NodeBrushPath pNodeBrushPath  ) 
 

To set the NodeBrushPath that the Brushmaker will use to render the brush objects to.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
NodeBrushPath [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, otherwise FALSE

Definition at line 1219 of file ndbrshmk.cpp.

01220 {
01221     if (pNodeBrushPath == NULL)
01222         return FALSE;
01223     m_pNodeBrushPath = pNodeBrushPath;
01224     return TRUE;
01225 }

void NodeBrushMaker::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 NodeRenderableBounded.

Definition at line 364 of file ndbrshmk.cpp.

00365 {
00366     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00367     ENSURE(IS_A(pNodeCopy, NodeBrushMaker), "PolyCopyNodeContents given wrong dest node type");
00368 
00369     if (IS_A(pNodeCopy, NodeBrushMaker))
00370         CopyNodeContents((NodeBrushMaker*)pNodeCopy);
00371 }

BOOL NodeBrushMaker::PrepareToRender Spread pSpread  ) 
 

Sets up the render region and renders the existing view into it. Call this before rendering any brush steps/.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/99
Parameters:
pSpread - the current spread [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 1306 of file ndbrshmk.cpp.

01307 {
01308     PORTNOTETRACE("other","NodeBrushMaker::PrepareToRender - do nothing");
01309 #ifndef EXCLUDE_FROM_XARALX
01310     DocView* pView = DocView::GetSelected();
01311 
01312     if (pView == NULL)
01313     {
01314         ERROR3("No View!");
01315         return FALSE;
01316     }
01317     
01318     DocRect ViewRect = pView->GetDocViewRect(pSpread);
01319 
01320     if (!GetGRenderBitmap(&ViewRect, &m_pGRender, pSpread))
01321     {   
01322         ERROR3("Failed to get render region");
01323         return FALSE;
01324     }
01325     
01326     if (!DrawViewToRenderRegion(pSpread, m_pGRender))
01327     {
01328     //  //TRACEUSER( "Diccon", _T("Failed to draw view\n"));
01329         return FALSE;
01330     }
01331 
01332 
01333     m_pGRender->StartRender();
01334     return TRUE;
01335 #else
01336     return FALSE;
01337 #endif
01338 }

void NodeBrushMaker::RandomizeAttributes  )  [protected]
 

To add randomization to the attributes of the brush object.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 1285 of file ndbrshmk.cpp.

01286 {
01287 
01288 }

void NodeBrushMaker::RandomizeShape Trans2DMatrix pTransMatrix  )  [protected]
 

To add randomization to the blendpath to be rendered. Transformations are calculated for the three different types of randomization possible and combined with the transformation matrix used to translate to the point along the nodebrushpath.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Matrix containing current transformation [INPUTS]
matrix with added transformatio caused by randomization [OUTPUTS]
Returns:
-

Definition at line 1264 of file ndbrshmk.cpp.

01265 {
01266     // err, not sure yet
01267 
01268 }

void NodeBrushMaker::RecalculateMaxStep  ) 
 

Recalculates the max step of the brush, call this when the path gets changed.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 1910 of file ndbrshmk.cpp.

01911 {   
01912     if (m_pNodeBrushPath != NULL)
01913     {
01914         INT32 NewMaxStep = (INT32)(m_pNodeBrushPath->GetPathLength() / m_BrushSpacing);