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);
01915         if (NewMaxStep > 0)
01916         {
01917             m_MaxStep = NewMaxStep;
01918         }
01919         else
01920             ERROR3("Negative number of steps calculated");
01921     }
01922 }

void NodeBrushMaker::Render RenderRegion pRender  )  [virtual]
 

Will render the blendpath objects on to the path of the brush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Pointer to a render region [INPUTS]

Reimplemented from Node.

Definition at line 519 of file ndbrshmk.cpp.

00520 {
00521     PORTNOTETRACE("other","NodeBrushMaker::Render - do nothing");
00522 #ifndef EXCLUDE_FROM_XARALX
00523     // first check to see what we need to render
00524     DocRect RenderRect = pRender->GetClipRect();
00525     
00526     DocRect BrushRect = this->GetBoundingRect();
00527 
00528     DocRect TestRect = RenderRect.Intersection(BrushRect);
00529 
00530     // if there is no intersection we can just quit now
00531     
00532     if (!TestRect.IsIntersectedWith(RenderRect))
00533     {
00534         //TRACEUSER( "Diccon", _T("Brush not in render rect"));
00535         return;
00536     }
00537 //  TRACEUSER( "Diccon", _T("\nBrushRect Top = %d, %d, Bot = %d, %d\n"), BrushRect.hix, BrushRect.hiy, BrushRect.lox, BrushRect.loy);
00538 
00539 //  TRACEUSER( "Diccon", _T("\nRenderRect Top = %d, %d, Bot = %d, %d\n"), RenderRect.hix, RenderRect.hiy, RenderRect.lox, RenderRect.loy);
00540 
00541     // if we still have some points to render from last time then
00542     // go ahead and do those. if not then test to see if the
00543     // render region contains the brush, in which case we need all the
00544     // points, or if we just need to find out which points belong in the list
00545     
00546     if (m_ListOfPointsToRender.IsEmpty())
00547     {   
00548         //TRACEUSER( "Diccon", _T("Empty\n"));
00549         m_BrushStep = 0;
00550         if (RenderRect.ContainsRect(BrushRect))
00551             AddAllPointsToList();
00552         else
00553             AddPointsInRectToList(RenderRect);
00554     }
00555 
00556     // we only want to use the caching system once, so if we have just used it then
00557     // turn it off and tell the NBP we have stopped
00558     if (m_bUsePathCache == TRUE)
00559     {
00560         m_bUsePathCache = FALSE;
00561         m_pNodeBrushPath->StoppedBrush();
00562     }
00563     // we now have a list of points to render
00564     //TRACEUSER( "Diccon", _T("\nNum points = %d\n"), m_ListOfPointsToRender.GetCount());
00565     
00566 
00567     // set the quality level
00568     if (pRender->RRQuality.GetAntialiasQuality() != Quality::FullAntialias)
00569     {
00570         // Create a non-antialias quality attr to render
00571         Quality Qual;
00572         Qual.SetQuality(QUALITY_MAX);
00573         QualityAttribute *pQualAttrVal = new QualityAttribute(Qual);
00574         if (pQualAttrVal != NULL)
00575         {
00576             // Render the attribute, and mark it Temporary so it will be auto-deleted
00577             // when it is finished with.
00578             pRender->SetQuality(pQualAttrVal, TRUE);
00579         }
00580     }
00581 
00582     BOOL ContinueRender = TRUE;
00583     View* pView = pRender->GetRenderView();
00584     CPathPointInfo Point;
00585     m_AltValue = 0;
00586     m_bFirstRender = TRUE;
00587     while (ContinueRender && (m_ListOfPointsToRender.IsEmpty() == FALSE))
00588     {
00589         Point = m_ListOfPointsToRender.GetHead();
00590         m_ListOfPointsToRender.RemoveHead();
00591         RenderBrushObjectAtPoint(Point, pRender);
00592         
00593         // okay, so there was a problem in that when the node was transformed
00594         // it would not completely re-render itself because it kept timing out.
00595         // this is a hacky fix so that for the first render after the transformation
00596         // we force it to do the whole thing.
00597     //  if (!m_JustTransformed)
00598     //      ContinueRender = pView->CanContinue(pRender); 
00599 
00600     //  if (!ContinueRender)
00601     //      TRACEUSER( "Diccon", _T("TIMED OUT\n"); //"Continue = %d\n"), ContinueRender);
00602         if (m_AltValue == 0)
00603             m_AltValue = 1;
00604         else
00605             m_AltValue = 0;
00606         //m_bFirstRender = FALSE;
00607     }
00608 
00609     if (m_JustTransformed == TRUE)
00610         m_JustTransformed = FALSE;
00611 
00612     //TRACEUSER( "Diccon", _T("Finished render with %d objects in list\n"), m_ListOfPointsToRender.GetCount());
00613     
00614     if (m_ListOfPointsToRender.GetCount() == 0)
00615     {
00616         
00617         
00618     }
00619     else
00620     {
00621         
00622     }
00623     
00624     pRender->LockSubRenderState(FALSE);
00625 #endif
00626 }  

void NodeBrushMaker::RenderAttributes RenderRegion pRender,
CCAttrMap pAttrMap
[protected]
 

Renders the attributes to the given render region.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pRender = ptr to render region [INPUTS] pAttrMap - the attribute map to render
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 647 of file ndbrshmk.cpp.

00648 {
00649     PORTNOTETRACE("other","NodeBrushMaker::RenderAttributes - do nothing");
00650 #ifndef EXCLUDE_FROM_XARALX
00651     // Check entry params
00652     BOOL ok = (pRender != NULL && pAttrMap != NULL);
00653     ERROR3IF(!ok,"One or more NULL entry params");
00654     if (!ok) return;
00655     
00656     void* pType;
00657     void* pVal;
00658     NodeAttribute* pNodeAttr;
00659     // iterating all (key, value) pairs
00660     for (POSITION Pos = pAttrMap->GetStartPosition(); Pos != NULL;)
00661     {
00662         // Get attr at position Pos
00663         pAttrMap->GetNextAssoc(Pos,pType,pVal);
00664 
00665         // pVal is actually an attribute, so get a ptr to it and render it
00666         pNodeAttr = (NodeAttribute *)pVal;
00667         
00668         // we only need to render most of the attributes once
00669         if (m_bFirstRender == FALSE)
00670         {
00671             if (pNodeAttr->NeedsToRenderAtEachBrushStroke())
00672                 pNodeAttr->Render(pRender);
00673         }
00674         else 
00675             pNodeAttr->Render(pRender); 
00676         
00677     }
00678 #endif
00679 }

void NodeBrushMaker::RenderBrushObjectAtPoint CPathPointInfo  Point,
RenderRegion pRender
[protected]
 

Renders a brush object at the point specified.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Point - co-ordinate where we wish to render the brush object [INPUTS] pRender - the render region to render on to
- [OUTPUTS]
Returns:
-

Definition at line 1633 of file ndbrshmk.cpp.

01634 {
01635     PORTNOTETRACE("other","NodeBrushMaker::RenderBrushObjectAtPoint - do nothing");
01636 #ifndef EXCLUDE_FROM_XARALX
01637     pRender->SaveContext();
01638     POSITION ListPosition = m_OffsetList.GetHeadPosition();
01639     
01640     Trans2DMatrix Trans;
01641     Trans2DMatrix Rotate;
01642     
01643     BlendPath* pBlendPath = m_pBlendRef->GetFirstBlendPath();
01644     CCAttrMap* pAttrMap = NULL;
01645     DocCoord CopyPoint;
01646     double RadToDeg = 1/ (2* PI);
01647     while (pBlendPath != NULL)
01648     {
01649         CopyPoint = SetPosition(Point, m_AltValue, &ListPosition);
01650         
01651         //TRACEUSER( "Diccon", _T("Rendering at  %d, %d\n"), Point.m_Point.x, Point.m_Point.y);
01652         
01653     
01654 
01655         // find out where the blendpath is at the moment, and transate it
01656         // to where we are now
01657         DocRect BRect = pBlendPath->m_pPath->GetBoundingRect();
01658         DocCoord CurrentPoint = BRect.Centre();
01659         Trans.SetTransform(CopyPoint.x  - CurrentPoint.x, CopyPoint.y - CurrentPoint.y );
01660         if (m_bRotate)
01661         {
01662             double RotAngle = 360 *(Point.m_Tangent * RadToDeg);
01663             Rotate.SetTransform(CopyPoint, RotAngle);
01664 
01665             //Trans.operator *=(Rotate);
01666         }
01667         // do randomisation if we need to
01668         if (m_bRandomizeShape)
01669             RandomizeShape(&Trans);
01670         
01671         if (m_AttrRandomness > 0)
01672             RandomizeAttributes();
01673         
01674         
01675         Trans.Transform( (DocCoord*)pBlendPath->m_pPath->GetCoordArray(), pBlendPath->m_pPath->GetNumCoords());
01676         Rotate.Transform( (DocCoord*)pBlendPath->m_pPath->GetCoordArray(), pBlendPath->m_pPath->GetNumCoords());
01677         pAttrMap = pBlendPath->FindAppliedAttributes();
01678         if (pAttrMap == NULL)
01679             ERROR3("No applied attributes");
01680 
01681         if (!m_bTile)
01682             pAttrMap->Transform(Trans);
01683         else
01684             pAttrMap->TransformForBrush(Trans);
01685 
01686         pAttrMap->Transform(Rotate);
01687         
01688         RenderAttributes(pRender, pAttrMap);
01689         pRender->DrawPath(pBlendPath->m_pPath);
01690         m_BrushStep++;
01691         //TRACEUSER( "Diccon", _T("Rendering Object %d at %d, %d\n"), m_BrushStep, Point.x, Point.y);
01692             
01693         pBlendPath = m_pBlendRef->GetNextBlendPath(pBlendPath);
01694     }
01695     pRender->RestoreContext();
01696 #endif
01697 }

void NodeBrushMaker::RenderEorDrag RenderRegion pRender  )  [virtual]
 

Renders a version of the blender node for EORed dragging of blends.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pRender - A Pointer to the current RenderRegion [INPUTS]
See also:
NodePath::Render; NodeRenderableInk::RenderEorDrag

Reimplemented from NodeRenderableInk.

Definition at line 819 of file ndbrshmk.cpp.

00820 {
00821     
00822 }

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

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
StepNum - the step number to render [INPUTS] pSpread - the current spread Point - the coordinate to render the step

Definition at line 699 of file ndbrshmk.cpp.

00700 {
00701     PORTNOTETRACE("other","NodeBrushMaker::RenderStep - do nothing");
00702 #ifndef EXCLUDE_FROM_XARALX
00703     //TRACEUSER( "Diccon", _T("Rendering Step %d\n"), StepNum);
00704     if (StepNum == 0)
00705         m_bFirstRender = TRUE;
00706     
00707     if (StepNum == 1)
00708         m_bFirstRender = FALSE;
00709     
00710 
00711     DocView* pView = DocView::GetSelected();
00712     DocRect ViewRect  =m_pGRenderDIB->GetClipRect();
00713 
00714     if (Point.m_Point.x > ViewRect.hix || Point.m_Point.x < ViewRect.lox)
00715         INT32 i = 1;
00716     if (Point.m_Point.y > ViewRect.hiy || Point.m_Point.y < ViewRect.loy)
00717         INT32 j = 1;
00718 
00719     if (pView == NULL)
00720     {
00721         ERROR3("No View!");
00722         return;
00723     }
00724     
00725     
00726     // declare variables to be used in loop
00727     DocRect BRect;
00728     DocRect ChangedRect;
00729     DocCoord CurrentPoint;
00730     Trans2DMatrix Trans;
00731     Trans2DMatrix Rotate;
00732     
00733     // get the head position of the offset list
00734     POSITION ListPosition; // = m_OffsetList.GetHeadPosition();
00735     BlendPathOffset ListOffset;  //m_OffsetList.GetNext(ListPosition);
00736     BlendPath* pBlendPath = m_pBlendRef->GetFirstBlendPath();
00737 
00738     CCAttrMap* pAttrMap = NULL;
00739     
00740     
00741     // pass alternating values into SetPosition so that it can do
00742     // alternating offsets
00743     UINT32 AltValue;
00744     if (StepNum % 2 == 0)
00745         AltValue = 0;
00746     else
00747         AltValue = 1;
00748     
00749     
00750     DocCoord CopyPoint;
00751     // the rendering loop
00752     //m_pGRenderDIB->StartRender();
00753     while (pBlendPath != NULL)
00754     {
00755         // get the correct transformation
00756         CopyPoint = SetPosition(Point,AltValue, &ListPosition);
00757 
00758         if (ListPosition != NULL)   
00759             ListOffset = m_OffsetList.GetNext(ListPosition);
00760         
00761         BRect = pBlendPath->m_pPath->GetBoundingRect();
00762         CurrentPoint = BRect.Centre();
00763         BRect.Translate((CopyPoint.x - CurrentPoint.x), (CopyPoint.y - CurrentPoint.y));
00764         Trans.SetTransform((CopyPoint.x - CurrentPoint.x), (CopyPoint.y - CurrentPoint.y));
00765         if (m_bRotate)
00766         {
00767             Rotate.SetTransform(CopyPoint, Point.m_Tangent);
00768             Trans.operator *=(Rotate);
00769         }
00770                 
00771         // transform the points in the path
00772         Trans.Transform( (DocCoord*)pBlendPath->m_pPath->GetCoordArray(), pBlendPath->m_pPath->GetNumCoords());
00773         
00774         // get the attribute map
00775         pAttrMap = pBlendPath->FindAppliedAttributes();
00776         if (pAttrMap == NULL)
00777             ERROR3("No applied attributes");
00778 
00779         // transform the attribute map either to tile or not
00780         if (!m_bTile)
00781             pAttrMap->Transform(Trans);
00782         else
00783             pAttrMap->TransformForBrush(Trans);
00784         
00785         RenderAttributes(m_pGRenderDIB, pAttrMap);
00786         m_pGRenderDIB->DrawPath(pBlendPath->m_pPath);       
00787         
00788 
00790         pBlendPath = m_pBlendRef->GetNextBlendPath(pBlendPath);
00791         
00792         ChangedRect = ChangedRect.Union(BRect);
00793         
00794     }
00795     //m_pGRenderDIB->StopRender();
00796     // set the changed bounding box for the render region so that when we come
00797     // to blit we only blit the pixels that have changed    
00798     m_pGRenderDIB->SetChangedBBox(ChangedRect);
00799 //  m_pGRenderDIB->PlotBrushIntoBigBitmap(ChangedRect);
00800     m_pGRenderDIB->DrawToScreenNow();
00801 
00802     
00803 //  //TRACEUSER( "Diccon", _T("Left render loop"));
00804 #endif
00805 } 

void NodeBrushMaker::ResetMembers  )  [protected]
 

Initialises the member variables.

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

Definition at line 241 of file ndbrshmk.cpp.

00242 {
00243     m_BrushSpacing        = 0;
00244     m_BrushStep           = 0;
00245     m_MaxStep             = 0;
00246     m_CurrentDistance     = 0;
00247     
00248     m_PositionRandomness  = 0.0;
00249     m_AttrRandomness      = 0.0;
00250     m_SizeRandomness      = 0.0;
00251     m_AlignmentRandomness = 0.0;
00252     m_bRandomizeShape     = FALSE;
00253     m_JustTransformed     = FALSE;
00254 
00255     m_pBlendRef = NULL;
00256     m_pGRender = NULL;
00257 
00258     m_PathOffsetType       = OFFSET_NONE;
00259     m_PathOffsetValue      = 50000;
00260 
00261     m_bFirstRender         = FALSE;
00262 
00263     m_bRotate              = FALSE;
00264     m_bTile                = TRUE;
00265     m_bUsePathCache        = TRUE;
00266 
00267     
00268 
00269 }

BOOL NodeBrushMaker::SetAlignmentRandomness double  Value  ) 
 

BOOL NodeBrushMaker::SetAttributeRandomness double  Value  ) 
 

void NodeBrushMaker::SetBlendRef BlendRef pBlendRef  ) 
 

To set the used to generate the brush objects.

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

Definition at line 1844 of file ndbrshmk.cpp.

01845 {
01846     if (pBlendRef == NULL)
01847     {
01848         ERROR3("Blend ref is NULL");
01849         return;
01850     }
01851     m_pBlendRef = pBlendRef;
01852 
01853     DocRect BRect = pBlendRef->GetBoundingRect();
01854     DocCoord InkCentre = BRect.Centre();
01855 
01856     m_OffsetList.clear();
01857     
01858 //  if (ok) 
01859     {
01860         // get the first blendpath as we need to pass it to the function
01861         // that retrieves the attributes
01862         BlendPath* pBlendPath = m_pBlendRef->GetFirstBlendPath();
01863         if (pBlendPath == NULL)
01864         {
01865             ERROR3("First blendpath is NULL");
01866             return;
01867         }
01868 
01869         m_BrushBoundingRect = pBlendPath->m_pPath->GetBoundingRect();
01870         while (pBlendPath != NULL)
01871         {
01872             // find out how far each blendpath is offset from the centre of
01873             // the bounding box and record it.
01874             DocRect BlendPathRect = pBlendPath->m_pPath->GetBoundingRect();
01875             m_BrushBoundingRect = m_BrushBoundingRect.Union(BlendPathRect);
01876             
01877             DocCoord BlendPathCentre = BlendPathRect.Centre();
01878             BlendPathOffset ThisOffset;
01879             ThisOffset.m_XOffset = BlendPathCentre.x - InkCentre.x ;
01880             ThisOffset.m_YOffset = BlendPathCentre.y - InkCentre.y;
01881             //TRACEUSER( "Diccon", _T("Offset = %d, %d\n"), ThisOffset.m_XOffset, ThisOffset.m_YOffset);
01882             m_OffsetList.push_back( ThisOffset );
01883             pBlendPath = m_pBlendRef->GetNextBlendPath(pBlendPath);
01884         }
01885     }
01886 
01887     std::vector< BlendPathOffset >::iterator    ListPosition = m_OffsetList.begin();
01888     while (ListPosition != m_OffsetList.end())
01889     {
01890         BlendPathOffset Offset = *(ListPosition++);
01891         TRACEUSER( "Diccon", _T("List offset %d, %d\n"), Offset.m_XOffset, Offset.m_YOffset);
01892     }
01893 
01894 }

BOOL NodeBrushMaker::SetBrushSpacing MILLIPOINT  Spacing  ) 
 

To set the spacing between brush objects.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
the spacing value to set [INPUTS]
Returns:
TRUE if successful, FALSE if the spacing is invalid
See also:
-

Definition at line 909 of file ndbrshmk.cpp.

00910 {
00911 //  if (Spacing < MIN_BRUSH_SPACING || Spacing > MAX_BRUSH_SPACING)
00912 //      return FALSE;
00913     
00914     m_BrushSpacing = Spacing;
00915 
00916     return TRUE;
00917 
00918 }

void NodeBrushMaker::SetGRenderBitmap GRenderBrush pGRenderBitmap  ) 
 

To set the pointer to the 'big' bitmap used to store the view.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
pointer to the bitmap to set [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 1823 of file ndbrshmk.cpp.

01824 {
01825     m_pGRenderDIB = (GRenderBrush*)pGRenderBitmap;
01826 }

void NodeBrushMaker::SetNumberOfSteps INT32  Steps  ) 
 

To set the number of steps.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
the number of steps to set [INPUTS]
Returns:
-
See also:
-

Definition at line 1027 of file ndbrshmk.cpp.

01028 {
01029     m_MaxStep = Steps;
01030 
01031 }

void NodeBrushMaker::SetPathOffsetType PathOffset  Offset  ) 
 

to set the offset type for this brush

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99 Inputs Offset - the offset type to set
Returns:
-

Definition at line 971 of file ndbrshmk.cpp.

00972 {
00973     m_PathOffsetType = Offset;
00974 }

void NodeBrushMaker::SetPathOffsetValue MILLIPOINT  Value  ) 
 

to set the offset distance for this brush

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99 Inputs Value - the offset value to set
Returns:
-

Definition at line 1007 of file ndbrshmk.cpp.

01008 {
01009     m_PathOffsetValue = Value;
01010 }

DocCoord NodeBrushMaker::SetPosition CPathPointInfo  OriginalPoint,
UINT32  AltValue,
CListOfPointsToRender::iterator *  ListPosition
[protected]
 

To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
OriginalPoint - the point on the line at the correct distance for us to draw an object [INPUTS] AltValue - if the offset it alternating then: 0 = go right 1 = go left ListPosition - the current position in the offset CList
POSITION is incremented. [OUTPUTS]
Returns:
the new position where we wish the object to be drawn
  • m_OffsetList: Mostly used for brushes made from compound nodes. The list contains a translation for each BlendPath in m_Blendref showing how far it was from the centre of the bounding box of the original object.

  • m_PathOffsetType and m_PathOffsetValue: These translations map the point on one side of the path or the other, the value determines exactly how far from the path they will be.

  • m_PositionRandomness: introduces a random element to the position of the object
    See also:
    -

Definition at line 1728 of file ndbrshmk.cpp.

01730 {
01731     BlendPathOffset PointOffset;
01732 
01733     if (*ListPosition != m_ListOfPointsToRender.end() )
01734     {
01735         //PointOffset = m_OffsetList.GetNext(*ListPosition);    
01736         OriginalPoint.m_Point.translate(PointOffset.m_XOffset, PointOffset.m_YOffset);
01737     }
01738 
01739     double theta;
01740     double NewX;
01741     double NewY;
01742 
01743     switch (m_PathOffsetType)
01744     {
01745         case OFFSET_NONE:
01746             break;
01747         case OFFSET_ALTERNATE:
01748             if (AltValue == 0)
01749                 theta = OriginalPoint.m_Tangent - 90;
01750             else
01751                 theta = OriginalPoint.m_Tangent + 90;
01752             
01753             NewX = m_PathOffsetValue * cos (theta);
01754             NewY = m_PathOffsetValue * sin (theta);
01755             OriginalPoint.m_Point.translate((INT32)NewX, (INT32)NewY);
01756             break;
01757         case OFFSET_RIGHT:
01758             theta = OriginalPoint.m_Tangent - 90;
01759             NewX = m_PathOffsetValue * cos (theta);
01760             NewY = m_PathOffsetValue * sin (theta);
01761             OriginalPoint.m_Point.translate((INT32)NewX, (INT32)NewY);
01762             break;
01763         case OFFSET_LEFT:
01764             theta = OriginalPoint.m_Tangent + 90;
01765             NewX = m_PathOffsetValue * cos (theta);
01766             NewY = m_PathOffsetValue * sin (theta);
01767             OriginalPoint.m_Point.translate((INT32)NewX, (INT32)NewY);
01768             break;
01769         case OFFSET_RANDOM:
01770             break;
01771         default:
01772             ERROR3("Unknown offset type");
01773             break;
01774     }
01775 
01776     return OriginalPoint.m_Point;
01777 }

BOOL NodeBrushMaker::SetPositionRandomness double  Value  ) 
 

void NodeBrushMaker::SetRotated BOOL  Rotate  ) 
 

To set the rotate member.

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

Definition at line 1047 of file ndbrshmk.cpp.

01048 {
01049     m_bRotate = Rotate;
01050 }

BOOL NodeBrushMaker::SetSizeRandomness double  Value  ) 
 

void NodeBrushMaker::SetStartCoord DocCoord  Coord  ) 
 

To set the starting coordinate of the brush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
the starting coordinate of the brush [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 1801 of file ndbrshmk.cpp.

01802 {
01803     m_StartCoord = Coord;
01804 }

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

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

Definition at line 1090 of file ndbrshmk.cpp.

01091 {
01092     m_bUsePathCache = Value;
01093 
01094 }

Node * NodeBrushMaker::SimpleCopy void   )  [protected, virtual]
 

Makes a copy of all the data in the node.

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

Reimplemented from NodeRenderableInk.

Definition at line 316 of file ndbrshmk.cpp.

00317 {
00318     // Make a new NodeBrushMaker and then copy things into it
00319     NodeBrushMaker* pCopyOfNode = new NodeBrushMaker();
00320     if (pCopyOfNode)
00321         CopyNodeContents(pCopyOfNode);
00322     
00323     return pCopyOfNode;
00324 } 

void NodeBrushMaker::Transform TransformBase Trans  )  [virtual]
 

Transforms all the paths attached to this blender node.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Trans - The transform Object [INPUTS]
See also:
NodeRenderableInk::Transform()

Reimplemented from NodeRenderableBounded.

Definition at line 493 of file ndbrshmk.cpp.

00494 {
00495     InvalidateBoundingRect();
00496     // transform the blendref object
00497     m_pBlendRef->Transform(Trans);
00498 
00499     // clear out the list of points to render
00500     m_ListOfPointsToRender.clear();
00501     
00502     // set the awful hacky flag
00503     m_JustTransformed = TRUE;
00504 } 


Member Data Documentation

double NodeBrushMaker::m_AlignmentRandomness [protected]
 

Definition at line 291 of file ndbrshmk.h.

UINT32 NodeBrushMaker::m_AltValue [protected]
 

Definition at line 292 of file ndbrshmk.h.

double NodeBrushMaker::m_AttrRandomness [protected]
 

Definition at line 289 of file ndbrshmk.h.

BOOL NodeBrushMaker::m_bFirstRender [protected]
 

Definition at line 309 of file ndbrshmk.h.

BOOL NodeBrushMaker::m_bRandomizeShape [protected]
 

Definition at line 306 of file ndbrshmk.h.

BOOL NodeBrushMaker::m_bRotate [protected]
 

Definition at line 310 of file ndbrshmk.h.

DocRect NodeBrushMaker::m_BrushBoundingRect [protected]
 

Definition at line 303 of file ndbrshmk.h.

String_32 NodeBrushMaker::m_BrushMakerName [protected]
 

Definition at line 270 of file ndbrshmk.h.

std::vector< BrushRef * > NodeBrushMaker::m_BrushRefPtrArray [protected]
 

Definition at line 280 of file ndbrshmk.h.

MILLIPOINT NodeBrushMaker::m_BrushSpacing [protected]
 

Definition at line 284 of file ndbrshmk.h.

INT32 NodeBrushMaker::m_BrushStep [protected]
 

Definition at line 297 of file ndbrshmk.h.

BOOL NodeBrushMaker::m_bTile [protected]
 

Definition at line 312 of file ndbrshmk.h.

BOOL NodeBrushMaker::m_bUsePathCache [protected]
 

Definition at line 313 of file ndbrshmk.h.

MILLIPOINT NodeBrushMaker::m_CurrentDistance [protected]
 

Definition at line 300 of file ndbrshmk.h.

BOOL NodeBrushMaker::m_JustTransformed [protected]
 

Definition at line 307 of file ndbrshmk.h.

CListOfPointsToRender NodeBrushMaker::m_ListOfPointsToRender [protected]
 

Definition at line 279 of file ndbrshmk.h.

INT32 NodeBrushMaker::m_MaxStep [protected]
 

Definition at line 298 of file ndbrshmk.h.

std::vector< BlendPathOffset > NodeBrushMaker::m_OffsetList [protected]
 

Definition at line 317 of file ndbrshmk.h.

PathOffset NodeBrushMaker::m_PathOffsetType [protected]
 

Definition at line 293 of file ndbrshmk.h.

MILLIPOINT NodeBrushMaker::m_PathOffsetValue [protected]
 

Definition at line 294 of file ndbrshmk.h.

CCAttrMap* NodeBrushMaker::m_pAttrMap [protected]
 

Definition at line 295 of file ndbrshmk.h.

BlendRef* NodeBrushMaker::m_pBlendRef [protected]
 

Definition at line 273 of file ndbrshmk.h.

GRenderBrush* NodeBrushMaker::m_pGRender [protected]
 

Definition at line 275 of file ndbrshmk.h.

GRenderBrush* NodeBrushMaker::m_pGRenderDIB [protected]
 

Definition at line 278 of file ndbrshmk.h.

NodeRenderableInk* NodeBrushMaker::m_pInkNode [protected]
 

Definition at line 272 of file ndbrshmk.h.

NodeBrushPath* NodeBrushMaker::m_pNodeBrushPath [protected]
 

Definition at line 274 of file ndbrshmk.h.

double NodeBrushMaker::m_PositionRandomness [protected]
 

Definition at line 288 of file ndbrshmk.h.

double NodeBrushMaker::m_SizeRandomness [protected]
 

Definition at line 290 of file ndbrshmk.h.

DocCoord NodeBrushMaker::m_StartCoord [protected]
 

Definition at line 301 of file ndbrshmk.h.


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