ScanningRenderRegion Class Reference

The Scanning Render Region is a special sort of render region that simply scans the document and works out where abouts there are complex shapes that can not be rendered by a normal OSRenderRegion. Complex shapes are shapes that are transparant or any other attribute that we are unable to render to normally. The Scanning Render Region is used to help with things like printing, Renderable EPS export etc where transparancy is not available. More...

#include <scanrr.h>

Inheritance diagram for ScanningRenderRegion:

RenderRegion ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

void ComplexShapeFoundWrapper ()
 This function is a public wrapper for ComplexShapeFound(). You should only call this function if you know what you are doing!

Protected Member Functions

void ComplexShapeFound ()
void ComplexShapeFoundHelper ()
 This function is called every time the rendering functions find that the node they are dealing with is complex. It updates all the info the scanning render region tracks about complex shapes, such as the first and last complex nodes and the bounding rectangle of all the complex shapes.
void SimpleShapeFound ()
void SimpleShapeFoundHelper ()
 This function should be called whenever a simple node is encountered. This allows the list of runs of simple / complex nodes to be maintained.

Protected Attributes

NodepFirstComplex
NodepLastComplex
INT32 NumComplexShapes
DocRect ComplexBounds
DocRect SpanBounds
List NodeRuns
NodeListItemWithComplexitypCurrentListItem
BOOL IsFirstComplex
BOOL IsThisTheFirstNode
BOOL InComplexRun
INT32 RunLength
BOOL bIsComplex
BOOL bIsSimple
ClipRegionAttributepLastClipAttr

Private Member Functions

 CC_DECLARE_DYNAMIC (ScanningRenderRegion)
 ScanningRenderRegion (BOOL Printing)
 The Scanning Render Regions constructor. This sets all the member vars of the class to default values (usually 0 or NULL).
 ~ScanningRenderRegion ()
 Destructor - It will do something if it needs to but at present this function is empty.
virtual BOOL StartRender ()
 Called to start the rendering process. Allows the render region to get ready to start rendering.
virtual BOOL StopRender ()
 Called to stop rendering. Since Scanning render regions are not used to background render, this marks the end of all rendering. This function marks the render region as completed, so all the get functions that return info about the objects found in the region start to function.
virtual void DrawPathToOutputDevice (Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH)
 This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.
virtual void DrawRect (DocRect *RectToRender)
 This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.
virtual void DrawLine (const DocCoord &StartPoint, const DocCoord &EndPoint)
 This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.
virtual void DrawPixel (const DocCoord &Point)
 This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.
virtual void DrawBitmap (const DocCoord &Point, KernelBitmap *pBitmap)
 This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.
virtual void DrawBitmap (const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID=NULL)
 This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.
virtual BOOL DrawTransformedBitmap (NodeBitmap *pNodeBitmap)
 Works out if it can draw a Transformed bitmap.
virtual void DrawDragRect (DocRect *RectToRender)
 None - I just had to overide this function as it is pure virtual. Does nothing.
virtual void DrawBlob (DocCoord p, BlobType type)
 None - I just had to overide this function as it is pure virtual. Does nothing.
virtual void DrawCross (const DocCoord &Point, const UINT32 Size)
 None - I just had to overide this function as it is pure virtual. Does nothing.
virtual void DrawBitmapBlob (const DocCoord &Point, KernelBitmap *BlobShape)
 None - I just had to overide this function as it is pure virtual. Does nothing.
virtual void DrawBitmapBlob (const DocCoord &Point, ResourceID resID)
 None - I just had to overide this function as it is pure virtual. Does nothing.
virtual void InitClipping ()
 Sets up the clipping - does nothing in this class.
virtual void InitAttributes ()
 Sets up the attributes. Does nothing in this class.
virtual void SetLineAttributes ()
 Does nothing in this class.
virtual void SetOSDrawingMode ()
 Does nothing in this class.
virtual void SetQualityLevel ()
 Does nothing in this class.
virtual MILLIPOINT CalcPixelWidth ()
 Does nothing in this class.
virtual MILLIPOINT CalcScaledPixelWidth ()
 Does nothing in this class.
virtual double GetPixelsPerInch ()
virtual BOOL CheckOffscreenBounds ()
virtual void GetRenderRegionCaps (RRCaps *pCaps)
 This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.
void SetHostRRCaps (const RRCaps &pCaps)
 This function makes a note of what things the render region we are scanning on behalf of can render and what it can not. We use the info take a copy if pCaps and use it to make the decisions as to what is a complex object and what is not.
NodeGetFirstComplexObject ()
 This function will return a pointer to the first complex (ie one that can not be rendered without GDraw - such as a transparant shape) node that the render region would need to render. This function will return NULL if there were no complex shapes found. If the Scanning render region has not yet finished rendering, then this function will always return NULL.
NodeGetLastComplexObject ()
 This function will return a pointer to the last complex (ie one that can not be rendered without GDraw - such as a transparant shape) node that the render region would need to render. This function will return NULL if there were no complex shapes found. If the Scanning render region has not yet finished rendering, then this function will always return NULL.
INT32 GetNumComplex ()
 This function returns the number of complex shapes that have been found in the scanning render region. It only counts the complex shapes in the region. It will return 0 if there were no complex shapes in the region. If the Scanning render region has not yet finished rendering, then this function will always return 0.
DocRect GetComplexBounds ()
 Used to find out the bounding rect of all the complex shapes in the completed render region. If it is called before the region has finished rendering, then it will return the empty rectangle. If there are no complex shapes in the region then it will also return the empty rectangle.
BOOL IsFinished ()
 Lets you find out if the render region has finished rendering yet. If it has not finished then all the information that this class has to offer about the number of complex shapes etc is not valid. All the info functions will return 0 or NULL until the rendering is finished to stop you looking at incomplete data.
BOOL IsFirstNodeComplex ()
NodeFindFirstFromList ()
 The nodes in the list represent the first node in a run of simple / complex nodes. You can determine if the first node to be rendered is simple or complex by calling IsFirstNodeComplex(). eg. If IsFirstNodeComplex() returned FALSE, then all the nodes up to the node returned by FindFirstFromList() will be simple. All the nodes from this one to the node returned by FindNextFromList will be complex. This toggle carries on all the way through the tree until there are no more nodes. If this function returns NULL, you can assume that there are no runs of nodes in the tree and all the nodes are of the same start as the first one (ie the same as what IsFirstNodeComplex() says).
NodeFindNextFromList ()
 Finds the first node in the next run of nodes.
BOOL IsThisNodeComplex ()
DocRect GetSpanBounds ()
 Used to find out the bounding rect of all the shapes in the span. This rectanlge is only calculated for complex spans. If it is called before the region has finished rendering, then it will return the empty rectangle. If there are no complex shapes in the region then it will also return the empty rectangle.
void SetRenderState (Node *RenderState)
 Sets the next Node to be rendered.

Private Attributes

BOOL IsFinishedRendering
RRCaps HostCaps

Detailed Description

The Scanning Render Region is a special sort of render region that simply scans the document and works out where abouts there are complex shapes that can not be rendered by a normal OSRenderRegion. Complex shapes are shapes that are transparant or any other attribute that we are unable to render to normally. The Scanning Render Region is used to help with things like printing, Renderable EPS export etc where transparancy is not available.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Definition at line 148 of file scanrr.h.


Constructor & Destructor Documentation

ScanningRenderRegion::ScanningRenderRegion BOOL  Printing  )  [private]
 

The Scanning Render Regions constructor. This sets all the member vars of the class to default values (usually 0 or NULL).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Definition at line 134 of file scanrr.cpp.

00135 {
00136     // The complex nodes if there are any. Default to none
00137     pFirstComplex = NULL;
00138     pLastComplex = NULL;
00139 
00140     // Counts of objects, default to none
00141     NumComplexShapes = 0;
00142 
00143     // The bounds of the complex objects
00144     ComplexBounds.MakeEmpty();
00145 
00146     // Flag to say if we have finished rendering or not
00147     IsFinishedRendering = FALSE;
00148     
00149     // Assume the host render region can do nothing till we get told otherwise
00150     HostCaps.CanDoNothing();
00151 
00152     // Start by assuming that the first node is simple for now
00153     IsFirstComplex = FALSE;
00154     InComplexRun = FALSE;
00155     RunLength = 0;
00156     
00157     // The list info
00158     NodeRuns.DeleteAll();
00159     pCurrentListItem = NULL;
00160     IsThisTheFirstNode = FALSE;
00161 
00162     bIsComplex = FALSE;
00163     bIsSimple = FALSE;
00164     pLastClipAttr = NULL;
00165 
00166     // Render flags
00167     RenderFlags.Printing = Printing;
00168 }

ScanningRenderRegion::~ScanningRenderRegion  )  [private]
 

Destructor - It will do something if it needs to but at present this function is empty.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Definition at line 183 of file scanrr.cpp.

00184 {
00185     // Make sure the list is cleared out.
00186     NodeRuns.DeleteAll();
00187 }


Member Function Documentation

MILLIPOINT ScanningRenderRegion::CalcPixelWidth void   )  [private, virtual]
 

Does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Implements RenderRegion.

Definition at line 1160 of file scanrr.cpp.

01161 {
01162     return 0;
01163 }

MILLIPOINT ScanningRenderRegion::CalcScaledPixelWidth void   )  [private, virtual]
 

Does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Implements RenderRegion.

Definition at line 1176 of file scanrr.cpp.

01177 {
01178 
01179     return 0;
01180 }

ScanningRenderRegion::CC_DECLARE_DYNAMIC ScanningRenderRegion   )  [private]
 

virtual BOOL ScanningRenderRegion::CheckOffscreenBounds  )  [inline, private, virtual]
 

Reimplemented from RenderRegion.

Definition at line 194 of file scanrr.h.

00194 { return(FALSE); }

void ScanningRenderRegion::ComplexShapeFound  )  [inline, protected]
 

Definition at line 227 of file scanrr.h.

00227 { bIsComplex = TRUE; };

void ScanningRenderRegion::ComplexShapeFoundHelper  )  [protected]
 

This function is called every time the rendering functions find that the node they are dealing with is complex. It updates all the info the scanning render region tracks about complex shapes, such as the first and last complex nodes and the bounding rectangle of all the complex shapes.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/2000

Definition at line 756 of file scanrr.cpp.

00757 {
00758 //  TRACE( _T("ComplexShapeFound\n"));
00759 
00760     Node* pThisNode = GetRenderState();
00761     if (pThisNode == NULL)
00762     {
00763         TRACE( _T("NULL RenderState in ComplexShapeFoundHelper\n"));
00764     }
00765 
00766     // Update the count of complex shapes
00767     NumComplexShapes++;
00768 
00769     // update the first complex shape pointers as needed
00770     if (pFirstComplex==NULL)
00771         pFirstComplex = pThisNode;
00772 
00773     // This is the last complex shape we know about so far...
00774     pLastComplex = pThisNode;
00775 
00776     // Now deal with the runs of Nodes system, in case they want to use that.
00777     if (IsThisTheFirstNode)
00778     {
00779         // This node represents the first renderable node in the region
00780         // so make sure that we note the fact that the first node is complex
00781         IsFirstComplex = TRUE;
00782         IsThisTheFirstNode = FALSE;
00783         InComplexRun = TRUE;
00784 
00785         NodeListItemWithComplexity* pItem = new NodeListItemWithComplexity(pThisNode, FALSE);
00786         if (pItem!=NULL)
00787             NodeRuns.AddTail(pItem);
00788     }
00789 
00790     // Karim 12/12/2000
00791     // Clipping changes - basically, all objects in a run of complex shapes
00792     // must share the same clip-attr.
00793     if (pThisNode)
00794     {
00795         // if we were in the middle of a Simple Nodes Run, then record this node
00796         // as the first node in the Complex run and mark that we are now in a complex run
00797         if (!InComplexRun)
00798         {
00799 //          TRACEUSER( "Gerry", _T("Just finished a run of %ld simple shapes - Add Next Complex shape\n"), RunLength);
00800             NodeListItemWithComplexity* pLast = (NodeListItemWithComplexity*)NodeRuns.GetTail();
00801             if (pLast)
00802                 pLast->RunLength = RunLength;
00803 
00804             SpanBounds.MakeEmpty();
00805 
00806             // Add this node to the list
00807             RunLength = 0;
00808             NodeListItemWithComplexity* pItem = new NodeListItemWithComplexity(pThisNode, FALSE);
00809             if (pItem!=NULL)
00810                 NodeRuns.AddTail(pItem);
00811         }
00812 
00813         // Update the bounds to date of complex shapes
00814         if (pThisNode->IsBounded())
00815         {
00816             DocRect NodeBounds = ((NodeRenderableBounded*)pThisNode)->GetBoundingRect();
00817             ComplexBounds = NodeBounds.Union(ComplexBounds);
00818             SpanBounds = NodeBounds.Union(SpanBounds);
00819 //          TRACE( _T("BoundsRect = (%d, %d) - (%d, %d)\n"), SpanBounds.lox, SpanBounds.loy, SpanBounds.hix, SpanBounds.hiy);
00820         }
00821     }
00822 
00823     // Make sure we know we are rendering complex shapes now
00824     InComplexRun = TRUE;
00825     RunLength++;
00826 }

void ScanningRenderRegion::ComplexShapeFoundWrapper  ) 
 

This function is a public wrapper for ComplexShapeFound(). You should only call this function if you know what you are doing!

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/12/2000
e.g. if you have geometry that does not regenerate certain parts of itself when inside blends (hence missing the complex classification), you should detect this situation and call this function directly. NodeBevel::Render() uses this method at present.

Definition at line 738 of file scanrr.cpp.

00739 {
00740     ComplexShapeFound();
00741 }

void ScanningRenderRegion::DrawBitmap const DocCoord Point,
UINT32  BitmapID,
UINT32  ToolID = NULL
[private, virtual]
 

This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
Point - the position to draw the bitmap at [INPUTS] BitmapID - The ID of the bitmap to render ToolID - the ID of the tool that the bitmap belongs to

Implements RenderRegion.

Definition at line 386 of file scanrr.cpp.

00387 {
00388     // see if this is a complex shape
00389     if (TestForComplexShape(&HostCaps))
00390         ComplexShapeFound();
00391     else
00392         SimpleShapeFound();
00393 }

void ScanningRenderRegion::DrawBitmap const DocCoord Point,
KernelBitmap pBitmap
[private, virtual]
 

This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
Point - The position to draw the bitmap at [INPUTS] pBitmap - the bitmap that needs drawing

Implements RenderRegion.

Definition at line 359 of file scanrr.cpp.

00360 {
00361     // see if this is a complex shape
00362     if (TestForComplexShape(&HostCaps))
00363         ComplexShapeFound();
00364     else
00365         SimpleShapeFound();
00366 }

void ScanningRenderRegion::DrawBitmapBlob const DocCoord Point,
ResourceID  resID
[private, virtual]
 

None - I just had to overide this function as it is pure virtual. Does nothing.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
Point - A coord [INPUTS] BitmapID - the ID of a bitmap ToolID - the Id of the tool the bitmap resource is in

Implements RenderRegion.

Definition at line 528 of file scanrr.cpp.

00529 {
00530 }

void ScanningRenderRegion::DrawBitmapBlob const DocCoord Point,
KernelBitmap BlobShape
[private, virtual]
 

None - I just had to overide this function as it is pure virtual. Does nothing.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
Point - A Coord [INPUTS] BlobShape - the bitmap to use

Implements RenderRegion.

Definition at line 510 of file scanrr.cpp.

00511 {
00512 }

void ScanningRenderRegion::DrawBlob DocCoord  p,
BlobType  type
[private, virtual]
 

None - I just had to overide this function as it is pure virtual. Does nothing.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
p - A coord [INPUTS] type - The type of blob

Implements RenderRegion.

Definition at line 475 of file scanrr.cpp.

00476 {
00477 }

void ScanningRenderRegion::DrawCross const DocCoord Point,
const UINT32  Size
[private, virtual]
 

None - I just had to overide this function as it is pure virtual. Does nothing.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
Point - a Coord [INPUTS] Size - the size of the cross

Implements RenderRegion.

Definition at line 492 of file scanrr.cpp.

00493 {
00494 }

void ScanningRenderRegion::DrawDragRect DocRect RectToRender  )  [private, virtual]
 

None - I just had to overide this function as it is pure virtual. Does nothing.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
RectToRender - The Rectangle [INPUTS]

Implements RenderRegion.

Definition at line 458 of file scanrr.cpp.

00459 {
00460 }

void ScanningRenderRegion::DrawLine const DocCoord StartPoint,
const DocCoord EndPoint
[private, virtual]
 

This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
StartPoint,EndPoint - the coords to draw a line between [INPUTS]

Implements RenderRegion.

Definition at line 310 of file scanrr.cpp.

00311 {
00312     // see if this is a complex shape
00313     if (TestForComplexShape(&HostCaps))
00314         ComplexShapeFound();
00315     else
00316         SimpleShapeFound();
00317 }

void ScanningRenderRegion::DrawPathToOutputDevice Path pPathToRender,
PathShape  shapePath = PATHSHAPE_PATH
[private, virtual]
 

This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
pPathToRender - The path that we want to try and render [INPUTS]

Implements RenderRegion.

Definition at line 261 of file scanrr.cpp.

00262 {
00263     // see if this is a complex shape
00264     if (TestForComplexShape(&HostCaps))
00265         ComplexShapeFound();
00266     else
00267         SimpleShapeFound();
00268 }

void ScanningRenderRegion::DrawPixel const DocCoord Point  )  [private, virtual]
 

This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
Point - the coord to draw the pixel in [INPUTS]

Implements RenderRegion.

Definition at line 334 of file scanrr.cpp.

00335 {
00336     // see if this is a complex shape
00337     if (TestForComplexShape(&HostCaps))
00338         ComplexShapeFound();
00339     else
00340         SimpleShapeFound();
00341 }

void ScanningRenderRegion::DrawRect DocRect pRectToRender  )  [private, virtual]
 

This function will examine the attributes etc to see if this represents a simple or compex shape and update the counters that this class keeps. There is no actual rendering, as this class does not actually render anything to a device.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Parameters:
pRectToRender - The Rectangle that we need to render [INPUTS]

Implements RenderRegion.

Definition at line 285 of file scanrr.cpp.

00286 {
00287     // see if this is a complex shape
00288     if (TestForComplexShape(&HostCaps))
00289         ComplexShapeFound();
00290     else
00291         SimpleShapeFound();
00292 }

BOOL ScanningRenderRegion::DrawTransformedBitmap NodeBitmap pNodeBitmap  )  [private, virtual]
 

Works out if it can draw a Transformed bitmap.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
pNodeBitmap - The bitmap to render [INPUTS]
Returns:
TRUE if it worked, FLASE if not

Reimplemented from RenderRegion.

Definition at line 408 of file scanrr.cpp.

00409 {
00410     BOOL IsShapeComplex = FALSE;
00411 
00412     // see if this is a complex shape (e.g. transparency)
00413     if (TestForComplexShape(&HostCaps) || pNodeBitmap->NeedsTransparency())
00414     {
00415         ComplexShapeFound();
00416         return TRUE;
00417     }
00418 
00419     // See what kind of bitmaps this render region can do
00420     if (HostCaps.ArbitraryBitmaps)
00421     {
00422         // We can do anything...
00423         if (!IsShapeComplex)
00424             SimpleShapeFound();
00425 
00426         return TRUE;
00427     }
00428 
00429     if (HostCaps.SimpleBitmaps)
00430     {
00431         // Check that the bitmap area is rectangular, and is perpendicular to
00432         // the x and y axes.
00433         if (pNodeBitmap->HasSimpleOrientation(this))
00434         {
00435             SimpleShapeFound();
00436             return TRUE;
00437         }
00438     }
00439 
00440     // If we get here, then we can't do the bitmap directly
00441     ComplexShapeFound();
00442 
00443     return TRUE;
00444 }

Node * ScanningRenderRegion::FindFirstFromList  )  [private]
 

The nodes in the list represent the first node in a run of simple / complex nodes. You can determine if the first node to be rendered is simple or complex by calling IsFirstNodeComplex(). eg. If IsFirstNodeComplex() returned FALSE, then all the nodes up to the node returned by FindFirstFromList() will be simple. All the nodes from this one to the node returned by FindNextFromList will be complex. This toggle carries on all the way through the tree until there are no more nodes. If this function returns NULL, you can assume that there are no runs of nodes in the tree and all the nodes are of the same start as the first one (ie the same as what IsFirstNodeComplex() says).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Returns:
The first node in the list or NULL.

Definition at line 970 of file scanrr.cpp.

00971 {
00972     // Reset our list pointer
00973     pCurrentListItem = NULL;
00974 
00975     // If we have not finished yet, then return NULL
00976     if (!IsFinishedRendering)
00977     {
00978         return NULL;
00979     }
00980 
00981     // return the first item in the list
00982     pCurrentListItem = (NodeListItemWithComplexity*) NodeRuns.GetHead();
00983     if (pCurrentListItem!=NULL)
00984         return pCurrentListItem->pNode;
00985 
00986     // the list was empty
00987     return NULL;
00988 }

Node * ScanningRenderRegion::FindNextFromList  )  [private]
 

Finds the first node in the next run of nodes.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Returns:
The Next Node in the list of runs of nodes
See also:
ScanningRenderRegion::FirstFirstFromList

Definition at line 1005 of file scanrr.cpp.

01006 {
01007     // If we have not finished rendering, or we are not looking at a list already, return null
01008     if ((!IsFinishedRendering) || (pCurrentListItem==NULL))
01009     {
01010         return NULL;
01011     }
01012 
01013     // return the next item in the list
01014     pCurrentListItem = (NodeListItemWithComplexity*) NodeRuns.GetNext(pCurrentListItem);
01015     if (pCurrentListItem!=NULL)
01016         return pCurrentListItem->pNode;
01017 
01018     // the list was empty
01019     return NULL;
01020 }

DocRect ScanningRenderRegion::GetComplexBounds  )  [private]
 

Used to find out the bounding rect of all the complex shapes in the completed render region. If it is called before the region has finished rendering, then it will return the empty rectangle. If there are no complex shapes in the region then it will also return the empty rectangle.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/4/95
Returns:
DocRect - the smallest rect that covers all the complex shapes in this render region

Definition at line 680 of file scanrr.cpp.

00681 {
00682     // If we have not yet finished rendering then this function returns an empty rectangle
00683     if (!IsFinishedRendering)
00684     {
00685         DocRect EmptyOne(0,0,0,0);
00686         return EmptyOne;
00687     }
00688 
00689     return ComplexBounds;
00690 }

Node * ScanningRenderRegion::GetFirstComplexObject  )  [private]
 

This function will return a pointer to the first complex (ie one that can not be rendered without GDraw - such as a transparant shape) node that the render region would need to render. This function will return NULL if there were no complex shapes found. If the Scanning render region has not yet finished rendering, then this function will always return NULL.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Returns:
A pointer to a Node
See also:
ScanningRenderRegion::GetLastComplexObject; ScanningRenderRegion::IsFinished

Definition at line 596 of file scanrr.cpp.

00597 {
00598     // If we have not yet finished rendering then this function returns NULL
00599     if (!IsFinishedRendering)
00600         return NULL;
00601 
00602     // Its finished so we these values are accurate
00603     return pFirstComplex;
00604 }

Node * ScanningRenderRegion::GetLastComplexObject  )  [private]
 

This function will return a pointer to the last complex (ie one that can not be rendered without GDraw - such as a transparant shape) node that the render region would need to render. This function will return NULL if there were no complex shapes found. If the Scanning render region has not yet finished rendering, then this function will always return NULL.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Returns:
A pointer to a Node
See also:
ScanningRenderRegion::GetLastComplexObject; ScanningRenderRegion::IsFinished

Definition at line 625 of file scanrr.cpp.

00626 {
00627     // If we have not yet finished rendering then this function returns NULL
00628     if (!IsFinishedRendering)
00629         return NULL;
00630 
00631     // We have finished, so return the true value
00632     return pLastComplex;
00633 }

INT32 ScanningRenderRegion::GetNumComplex  )  [private]
 

This function returns the number of complex shapes that have been found in the scanning render region. It only counts the complex shapes in the region. It will return 0 if there were no complex shapes in the region. If the Scanning render region has not yet finished rendering, then this function will always return 0.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Returns:
The number of complex nodes that need to be rendered

Definition at line 653 of file scanrr.cpp.

00654 {
00655     // If we have not yet finished rendering then this function returns 0
00656     if (!IsFinishedRendering)
00657         return 0;
00658 
00659     return NumComplexShapes;
00660 }

virtual double ScanningRenderRegion::GetPixelsPerInch  )  [inline, private, virtual]
 

Reimplemented from RenderRegion.

Definition at line 191 of file scanrr.h.

00191 { return 96.0; }

void ScanningRenderRegion::GetRenderRegionCaps RRCaps pCaps  )  [private, virtual]
 

This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
pCaps - The details about what types of thing this render region can render [OUTPUTS]

Reimplemented from RenderRegion.

Definition at line 548 of file scanrr.cpp.

00549 {
00550     pCaps->CanDoAll();
00551 }

DocRect ScanningRenderRegion::GetSpanBounds  )  [private]
 

Used to find out the bounding rect of all the shapes in the span. This rectanlge is only calculated for complex spans. If it is called before the region has finished rendering, then it will return the empty rectangle. If there are no complex shapes in the region then it will also return the empty rectangle.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/01/05
Returns:
DocRect - the smallest rect that covers all the shapes in this span in this render region

Definition at line 1060 of file scanrr.cpp.

01061 {
01062     // If we have not yet finished rendering then this function returns an empty rectangle
01063     if (!IsFinishedRendering || !pCurrentListItem)
01064     {
01065         DocRect EmptyOne(0,0,0,0);
01066         return EmptyOne;
01067     }
01068 
01069     return pCurrentListItem->BoundsRect;
01070 }

void ScanningRenderRegion::InitAttributes void   )  [private, virtual]
 

Sets up the attributes. Does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Implements RenderRegion.

Definition at line 1100 of file scanrr.cpp.

01101 {
01102 }

void ScanningRenderRegion::InitClipping void   )  [private, virtual]
 

Sets up the clipping - does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Implements RenderRegion.

Definition at line 1085 of file scanrr.cpp.

01086 {
01087 }

BOOL ScanningRenderRegion::IsFinished  )  [private]
 

Lets you find out if the render region has finished rendering yet. If it has not finished then all the information that this class has to offer about the number of complex shapes etc is not valid. All the info functions will return 0 or NULL until the rendering is finished to stop you looking at incomplete data.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Returns:
TRUE if the scanning render region has finished scanning, FALSE if it still has more nodes to look at

Definition at line 922 of file scanrr.cpp.

00923 {
00924     return IsFinishedRendering;
00925 }

BOOL ScanningRenderRegion::IsFirstNodeComplex  )  [private]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Returns:
TRUE if the First node to be rendered is Complex, FALSE if not

Definition at line 943 of file scanrr.cpp.

00944 {
00945     return IsFirstComplex;
00946 }

BOOL ScanningRenderRegion::IsThisNodeComplex  )  [private]
 

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/01/05
Returns:
TRUE if the currentlist node is Complex, FALSE if not

Definition at line 1033 of file scanrr.cpp.

01034 {
01035     if ((!IsFinishedRendering) || (pCurrentListItem==NULL))
01036     {
01037         return FALSE;
01038     }
01039 
01040     return(!(pCurrentListItem->wasClassifiedSimple));
01041 }

void ScanningRenderRegion::SetHostRRCaps const RRCaps Caps  )  [private]
 

This function makes a note of what things the render region we are scanning on behalf of can render and what it can not. We use the info take a copy if pCaps and use it to make the decisions as to what is a complex object and what is not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
Caps - The Device Caps for the render region we are scanning on behalf of. [INPUTS]

Definition at line 568 of file scanrr.cpp.

00569 {
00570     // make a copy of the RRCaps field
00571     // Host caps is used in TestForComplexShape();
00572     HostCaps = Caps;
00573 }

void ScanningRenderRegion::SetLineAttributes void   )  [private, virtual]
 

Does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Definition at line 1115 of file scanrr.cpp.

01116 {
01117 }

void ScanningRenderRegion::SetOSDrawingMode void   )  [private, virtual]
 

Does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Implements RenderRegion.

Definition at line 1130 of file scanrr.cpp.

01131 {
01132 }

void ScanningRenderRegion::SetQualityLevel void   )  [private, virtual]
 

Does nothing in this class.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Reimplemented from RenderRegion.

Definition at line 1145 of file scanrr.cpp.

01146 {
01147 }

void ScanningRenderRegion::SetRenderState Node pNode  )  [private]
 

Sets the next Node to be rendered.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/05/2004
Parameters:
pNode - The Node about to be rendered [INPUTS]

Reimplemented from RenderRegion.

Definition at line 704 of file scanrr.cpp.

00705 {
00706     // If we have been rendering a Node then stick it's details where needed
00707 //  Node* pLastNode = GetRenderState();
00708 //  if (pLastNode)
00709 //  {
00710         if (bIsComplex || (bIsSimple && GetCaptureDepth() > 1))
00711             ComplexShapeFoundHelper();          // go ahead and record the node
00712         else if (bIsSimple)
00713             SimpleShapeFoundHelper();           // go ahead and record the node
00714 //  }
00715 
00716     RenderRegion::SetRenderState(pNode);
00717     bIsComplex = FALSE;
00718     bIsSimple = FALSE;
00719 }

void ScanningRenderRegion::SimpleShapeFound  )  [inline, protected]
 

Definition at line 229 of file scanrr.h.

00229 { bIsSimple = TRUE; };

void ScanningRenderRegion::SimpleShapeFoundHelper  )  [protected]
 

This function should be called whenever a simple node is encountered. This allows the list of runs of simple / complex nodes to be maintained.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/2000

Definition at line 839 of file scanrr.cpp.

00840 {
00841 //  TRACE( _T("SimpleShapeFound\n"));
00842 
00843     Node* pThisNode = GetRenderState();
00844     if (pThisNode == NULL)
00845     {
00846         TRACE( _T("NULL RenderState in SimpleShapeFoundHelper\n"));
00847     }
00848 
00849     if (IsThisTheFirstNode)
00850     {
00851         // This node represents the first renderable node in the region
00852         // so make sure that we note the fact that the first node is simple
00853         IsThisTheFirstNode = FALSE;
00854 
00855         NodeListItemWithComplexity* pItem = new NodeListItemWithComplexity(pThisNode, TRUE);
00856         if (pItem!=NULL)
00857             NodeRuns.AddTail(pItem);
00858     }
00859 
00860     // If we are in the middle of a Complex run then change over to a simple run
00861     if (InComplexRun)
00862     {
00863         // Add this node to the list as the first node in a simple run
00864 //      TRACEUSER( "Gerry", _T("Just finished a run of %ld complex shapes - Add Next Simple shape\n"), RunLength);
00865 
00866         NodeListItemWithComplexity* pLast = (NodeListItemWithComplexity*)NodeRuns.GetTail();
00867         if (pLast)
00868         {
00869             pLast->RunLength = RunLength;
00870             pLast->BoundsRect = SpanBounds;
00871         }
00872         
00873         SpanBounds.MakeEmpty();
00874         RunLength = 0;
00875         NodeListItemWithComplexity* pItem = NULL;
00876         if (pThisNode)
00877         {
00878             // If this is the first non-attribute sibling then make the new simple
00879             // run start with our parent and continue up the tree
00880             while (TRUE)
00881             {
00882                 // Get the previous sibling
00883                 Node* pTestNode = pThisNode->FindPrevious();
00884                 // If we don't have one or it is an attribute then get our parent
00885                 // and try again otherwise use this node
00886                 if (!pTestNode || pTestNode->IsAnAttribute())
00887                     pThisNode = pThisNode->FindParent();
00888                 else
00889                     break;
00890             }
00891             
00892             pItem = new NodeListItemWithComplexity(pThisNode, TRUE);
00893         }
00894 
00895         if (pItem != NULL)
00896             NodeRuns.AddTail(pItem);
00897     }
00898 
00899     // We are no longer in a complex run
00900     InComplexRun = FALSE;
00901     RunLength++;
00902 }

BOOL ScanningRenderRegion::StartRender void   )  [private, virtual]
 

Called to start the rendering process. Allows the render region to get ready to start rendering.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Returns:
TRUE if everything went OK, FALSE if there was a problem
See also:
ScanningRenderRegion::StopRender

Reimplemented from RenderRegion.

Definition at line 203 of file scanrr.cpp.

00204 {
00205     // Call base class first
00206     if (!RenderRegion::StartRender())
00207         return FALSE;
00208 
00209     // Say that we have not rendered any nodes yet
00210     IsThisTheFirstNode = TRUE;
00211 
00212     // All worked
00213     return TRUE;
00214 }

BOOL ScanningRenderRegion::StopRender void   )  [private, virtual]
 

Called to stop rendering. Since Scanning render regions are not used to background render, this marks the end of all rendering. This function marks the render region as completed, so all the get functions that return info about the objects found in the region start to function.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95

Implements RenderRegion.

Definition at line 230 of file scanrr.cpp.

00231 {
00232     SetRenderState(NULL);
00233     // Update the RunLength of the last span
00234     NodeListItemWithComplexity* pLast = (NodeListItemWithComplexity*)NodeRuns.GetTail();
00235     if (pLast)
00236     {
00237 //      TRACEUSER( "Gerry", _T("Just finished a run of %ld %s shapes\n", RunLength, pLast->wasClassifiedSimple ? "simple" : "complex"));
00238         pLast->RunLength = RunLength;
00239         pLast->BoundsRect = SpanBounds;
00240     }
00241     IsFinishedRendering = TRUE;
00242     return TRUE;
00243 }


Member Data Documentation

BOOL ScanningRenderRegion::bIsComplex [protected]
 

Definition at line 263 of file scanrr.h.

BOOL ScanningRenderRegion::bIsSimple [protected]
 

Definition at line 264 of file scanrr.h.

DocRect ScanningRenderRegion::ComplexBounds [protected]
 

Definition at line 252 of file scanrr.h.

RRCaps ScanningRenderRegion::HostCaps [private]
 

Definition at line 272 of file scanrr.h.

BOOL ScanningRenderRegion::InComplexRun [protected]
 

Definition at line 260 of file scanrr.h.

BOOL ScanningRenderRegion::IsFinishedRendering [private]
 

Definition at line 269 of file scanrr.h.

BOOL ScanningRenderRegion::IsFirstComplex [protected]
 

Definition at line 258 of file scanrr.h.

BOOL ScanningRenderRegion::IsThisTheFirstNode [protected]
 

Definition at line 259 of file scanrr.h.

List ScanningRenderRegion::NodeRuns [protected]
 

Definition at line 256 of file scanrr.h.

INT32 ScanningRenderRegion::NumComplexShapes [protected]
 

Definition at line 249 of file scanrr.h.

NodeListItemWithComplexity* ScanningRenderRegion::pCurrentListItem [protected]
 

Definition at line 257 of file scanrr.h.

Node* ScanningRenderRegion::pFirstComplex [protected]
 

Definition at line 245 of file scanrr.h.

ClipRegionAttribute* ScanningRenderRegion::pLastClipAttr [protected]
 

Definition at line 265 of file scanrr.h.

Node* ScanningRenderRegion::pLastComplex [protected]
 

Definition at line 246 of file scanrr.h.

INT32 ScanningRenderRegion::RunLength [protected]
 

Definition at line 261 of file scanrr.h.

DocRect ScanningRenderRegion::SpanBounds [protected]
 

Definition at line 253 of file scanrr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:40 2007 for Camelot by  doxygen 1.4.4