ContourNodePathProcessor Class Reference

The path processor which is used to sum all paths to be contoured. More...

#include <ncntrcnt.h>

Inheritance diagram for ContourNodePathProcessor:

PathProcessor CCObject SimpleCCObject List of all members.

Public Member Functions

 ContourNodePathProcessor ()
 Constructor.
 ~ContourNodePathProcessor ()
 Destructor.
virtual void ProcessPath (Path *pPath, RenderRegion *pRegion, PathShape ShapePath=PATHSHAPE_PATH)
 Sums all paths which are passed to it.
void SetActive (BOOL bActive)
void SetIsPrinting (BOOL bPrinting)
void TestLineWidth (BOOL bLineWidth)

Static Public Member Functions

static MILLIPOINT GetMaxInnerContourWidth (NodeCompound *pNode)
 Calculates the maximum inner bevel allowed, given the node.

Private Member Functions

 CC_DECLARE_DYNCREATE (ContourNodePathProcessor)

Private Attributes

BOOL m_bActive
BOOL m_bLineWidthTest
BOOL m_bPrinting
BOOL m_bRespectJoinType

Detailed Description

The path processor which is used to sum all paths to be contoured.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/8/99

Definition at line 346 of file ncntrcnt.h.


Constructor & Destructor Documentation

ContourNodePathProcessor::ContourNodePathProcessor  ) 
 

Constructor.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/8/99
Parameters:
[INPUTS] 

Definition at line 3040 of file ncntrcnt.cpp.

03041 {
03042     TRACEUSER( "DavidM", _T("Created a contour node path processor\n"));    
03043     m_bActive = TRUE;
03044     m_bLineWidthTest = TRUE;
03045     m_bPrinting = FALSE;
03046     m_bRespectJoinType = FALSE;
03047 
03048 }

ContourNodePathProcessor::~ContourNodePathProcessor  ) 
 

Destructor.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/8/99
Parameters:
[INPUTS] 

Definition at line 3060 of file ncntrcnt.cpp.

03061 {
03062     TRACEUSER( "DavidM", _T("Killed a contour node path processor\n")); 
03063 }


Member Function Documentation

ContourNodePathProcessor::CC_DECLARE_DYNCREATE ContourNodePathProcessor   )  [private]
 

MILLIPOINT ContourNodePathProcessor::GetMaxInnerContourWidth NodeCompound pCompound  )  [static]
 

Calculates the maximum inner bevel allowed, given the node.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/99
Parameters:
See base class [INPUTS]

Definition at line 3308 of file ncntrcnt.cpp.

03309 {
03310     Node * pNode = pCompound->FindFirstDepthFirst();
03311 
03312     DocRect dr;
03313 
03314     MILLIPOINT MaxInnerBevel = -1;
03315     MILLIPOINT Len = 0;
03316 
03317     while (pNode && pNode != pCompound)
03318     {
03319         // ignore all compound nodes, non-object nodes and needs parent nodes
03320         if (pNode->IsAnObject() && !pNode->NeedsParent(NULL) && !pNode->IsCompound())
03321         {
03322             dr = ((NodeRenderableInk *)pNode)->GetBoundingRect(FALSE, FALSE);
03323 
03324             // get the maximum out of these two
03325             if (dr.Width() > dr.Height())
03326             {
03327                 Len = dr.Width();
03328             }
03329             else
03330             {
03331                 Len = dr.Height();
03332             }
03333 
03334             Len /= 2;
03335 
03336             if (MaxInnerBevel < 0)
03337             {
03338                 MaxInnerBevel = Len;
03339             }
03340             else if (MaxInnerBevel < Len)
03341             {
03342                 MaxInnerBevel = Len;
03343             }
03344         }
03345 
03346         pNode = pNode->FindNextDepthFirst(pCompound);
03347     }
03348 
03349     return MaxInnerBevel;
03350 }

void ContourNodePathProcessor::ProcessPath Path pPath,
RenderRegion pRegion,
PathShape  ShapePath = PATHSHAPE_PATH
[virtual]
 

Sums all paths which are passed to it.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/8/99
Parameters:
[INPUTS] 

Implements PathProcessor.

Definition at line 3080 of file ncntrcnt.cpp.

03083 {
03084     UINT32 StrokeWidth = 0;
03085     
03086     if (m_bActive && pPath->IsClosed())
03087     {
03088         // get the pixel width
03089         // stroke the original path
03090         MILLIPOINT PixelWidth = pRegion->GetScaledPixelWidth();
03091 
03092         if (m_bPrinting)
03093         {
03094             PixelWidth = pRegion->GetPixelWidth();
03095         }
03096 
03097         StrokeWidth = PixelWidth * 2;
03098 
03099         BOOL bStrokePath = FALSE;
03100         
03101         // if we have a transparent line width then we need to stroke the path slightly
03102         // to kill off holes
03103         if (m_bLineWidthTest)
03104         {
03105             LineWidthAttribute * pLineWidth = (LineWidthAttribute *)pRegion->GetCurrentAttribute(ATTR_LINEWIDTH);
03106 
03107             if (pLineWidth)
03108             {
03109                 if (pLineWidth->LineWidth < PixelWidth)
03110                 {
03111                     StrokeWidth = PixelWidth;
03112                     bStrokePath = TRUE;
03113                 }
03114             }
03115             
03116             StrokeColourAttribute * pLineColour = 
03117                 (StrokeColourAttribute *)pRegion->GetCurrentAttribute(ATTR_STROKECOLOUR);
03118             
03119             if (pLineColour)
03120             {
03121                 DocColour * pDocColourLine = pLineColour->GetStartColour();
03122                 
03123                 if (pDocColourLine)
03124                 {
03125                     if (pDocColourLine->IsTransparent())
03126                     {
03127                         bStrokePath = TRUE;
03128                     }
03129                 }
03130             }
03131         }
03132         else
03133         {
03134             bStrokePath = TRUE;
03135         }
03136 
03137         // stroke the original path
03138         if (bStrokePath)
03139         {       
03140             pRegion->SaveContext();
03141             
03142             Path StrokedPath;
03143             StrokedPath.Initialise();
03144             
03145             pPath->StrokePathToPath(StrokeWidth,
03146                 LineCapRound,
03147                 RoundJoin,
03148                 NULL,
03149                 &StrokedPath,
03150                 200,
03151                 FALSE);
03152             
03153             StrokedPath.TryToClose();
03154             StrokedPath.IsFilled = TRUE;
03155             StrokedPath.IsStroked = TRUE;
03156 
03157             pRegion->SetLineColour(COLOUR_NONE);
03158 
03159             pRegion->DrawPath(&StrokedPath, this, ShapePath);
03160             pRegion->RestoreContext();
03161         }
03162     }
03163     
03164     pRegion->DrawPath(pPath, this, ShapePath);
03165 }

void ContourNodePathProcessor::SetActive BOOL  bActive  )  [inline]
 

Definition at line 357 of file ncntrcnt.h.

00357 { m_bActive = bActive; }

void ContourNodePathProcessor::SetIsPrinting BOOL  bPrinting  )  [inline]
 

Definition at line 359 of file ncntrcnt.h.

00359 { m_bPrinting = bPrinting; }

void ContourNodePathProcessor::TestLineWidth BOOL  bLineWidth  )  [inline]
 

Definition at line 363 of file ncntrcnt.h.

00363 { m_bLineWidthTest = bLineWidth; }


Member Data Documentation

BOOL ContourNodePathProcessor::m_bActive [private]
 

Definition at line 369 of file ncntrcnt.h.

BOOL ContourNodePathProcessor::m_bLineWidthTest [private]
 

Definition at line 370 of file ncntrcnt.h.

BOOL ContourNodePathProcessor::m_bPrinting [private]
 

Definition at line 371 of file ncntrcnt.h.

BOOL ContourNodePathProcessor::m_bRespectJoinType [private]
 

Definition at line 372 of file ncntrcnt.h.


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