NodeBevel Class Reference

Does the bevelling. More...

#include <nodebev.h>

Inheritance diagram for NodeBevel:

NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeBevel ()
 Default constructor Note:.
 ~NodeBevel ()
 Default destructor Note:.
 NodeBevel (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. Note: SetUpShape() must be called before the NodeRegularShape is in a state in which it can be used.
virtual NodeSimpleCopy ()
 Returns a copy of me.
void CopyNodeContents (NodeBevel *pNewNode)
 Sort of backwards copy constructor.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
BOOL GenerateBevel ()
 Creates the beveller class, and the beveller bitmap Note:.
BOOL GenerateBevelForBlendStep (SumAllPathsElem *pElem, CCAttrMap *pMap)
 Creates the bevel data from the given list of SumAllPathsElem.
BOOL SetupVariables (CCAttrMap *pMap=NULL)
 Sets up all the attributes on myself and my parent by finding the appropriate attributes.
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
virtual DocRect GetBlobBoundingRect ()
 Calculates the bounding rectangle of the nodes blobs.This should always be calculated on the fly as the view scale can change without the node knowing, giving an incorrect result.
virtual void SetBoundingRect (DocRect rect)
virtual void RenderBitmap (RenderRegion *pRender)
 Renders the bevel using the bitmap bevelling system.
virtual void Render (RenderRegion *pRender)
 Will build a path for the shape and draw it to the given render region.
virtual void Transform (TransformBase &Trans)
 Transforms the shape.
virtual BOOL RequiresAttrib (CCRuntimeClass *pAttribClass, BOOL Search=FALSE)
 NodeBevel does not require brush attrs.
virtual BOOL RequiresAttrib (NodeAttribute *pAttr, BOOL Search=FALSE)
 NodeBevel does not require brush attrs.
virtual BOOL CanAttrBeAppliedToMe (CCRuntimeClass *pAttribClass)
 Determine whether the given attr type can be applied directly to me. We don't like brushed bevels, so we don't accept brush attrs.
virtual NodeCompoundGetParentController () const
 Returns a type correct pointer to the parent Bevel controller.
virtual BOOL IsNodePath () const
virtual BOOL IsABevel () const
void DeleteCache ()
 Deletes all data held in this class.
void DeleteCachedBitmap ()
 Deletes the current Bevel Bitmap. Mainly used when printing to reduce memory usage.
BOOL CreateBevelPaths ()
 Sets up all the attributes on myself and my parent by finding the appropriate attributes Note:.
virtual void RenderEorDrag (RenderRegion *rr)
void InvalidateMe ()
virtual BOOL NeedsTransparency () const
 We sure do need transparency !
void DisableRendering ()
void EnableRendering ()
BOOL IsRenderingStopped ()
virtual BOOL DoBecomeA (BecomeA *pBecomeA)
 Converts me to a path.
virtual BOOL CanBecomeA (BecomeA *pBecomeA)
 Can become a path !
virtual String Describe (BOOL Plural, BOOL Verbose=TRUE)
 Default constructor Note:.
virtual BOOL NeedsParent (Node *pNode) const
 Do we need a parent of the same class as the given node ??? See also: NodeCompound::OnChildChange.
BOOL PostDuplicate (UndoableOperation *pOp)
 Regens the node after a duplication.
BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState, BOOL DoPreTriggerEdit=TRUE)
DocRect GetPathBoundingRect ()
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out a dummy record, for my attribute to be attached to.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
virtual BOOL ExportRender (RenderRegion *pRegion)
 If pRenderRegion points to a FlashRenderRegion, the bevel will be processed as a bitmap filled shape, and stored as a pair of records (shape and bitmap) within the resulting Flash file.
virtual void PreExportRender (RenderRegion *pRegion)
 Perform any rendering required when exporting to a file, and this node is being 'passed by' during the tree searching. For example, a group node being exported to EPS would output a "start group" token, and then its ExportRender function would output a "end group" token. By default, it does nothing. Nodes wishing to do special export processing should override this function (and ExportRender).
virtual void RenderTinyBlobs (RenderRegion *pRender)
BitmapFillAttributeGetBitmapFillAttribute (void)
 Returns a pointer to the bitmap fill contained within NoveBevel.
virtual BOOL OnNodePopUp (Spread *pSpread, DocCoord PointerPos, ContextMenu *pMenu)
 Allows the shadow to respond to the click.
BOOL AmICached ()
virtual BOOL IsTypeExtendible () const
virtual DocRect ValidateExtend (const ExtendParams &ExtParams)
 Tests the reversibility of an Extend operation applied to this node.
virtual void Extend (const ExtendParams &ExtParams)
 Perform an Extend operation on this Node, and its children if appropriate.
void SetRenderBitmaps (BOOL b)
BOOL GetRenderBitmaps ()
void SetZeroLineWidths (BOOL b)
DocRect GetInsideBoundingRect ()
 Gets the bounding rect of the original (non-bevelled) objects See also: NodeCompound::OnChildChange.
BOOL ReRenderBevelBitmap (BOOL bAntialias)
 Re-renders the bevel bitmap using the beveler as it's already set up with the currently applied attributes.
virtual INT32 EstimateNodeComplexity (OpParam *details)
 This function estimates a complexity value for the node. The complexity value is based upon the total length of all paths in the node.
PathGetOuterBevelPath ()
PathGetBevelPath ()
void DoRender (BOOL DoRender=TRUE)
KernelBitmapGetBevelBitmap () const
KernelBitmapCreateBitmapCopy (double DPI=-1.0, BOOL CheckFillFlags=TRUE)
 Creates a BitmapCopy of the Bevel Bitmap including the current fills and transparency settings generated at the given DPI!
void SetConvertingFlag (BOOL Set=FALSE)
void GetDebugDetails (StringBase *Str)
 Builds debug info for camelot tree dialog.

Public Attributes

Path InkPath
BOOL m_MustRegenOnChildChange
INT32 m_BevelType
INT32 m_Indent
double m_LightAngle
BOOL m_bOuter
INT32 m_Contrast
double m_Tilt
BOOL m_IsABlendStepBevel
DocCoord m_BMPCentre
DocCoord m_BMPPoint1
DocCoord m_BMPPoint2
DocRect m_SelectedRect
JointType m_JointType

Protected Member Functions

KernelBitmapCreateCombinedBMPAndTranspFill (RenderRegion *pRegion=NULL)
 Creates a new 32Bit Bitmap to hold the combined Transp & Bitmap Fill Attributes.
void CalculateBitmapSize (INT32 *retnWid, INT32 *retnHei, RenderRegion *pRegion=NULL)
 Calculates the width and the height for the bitmap depending on what's in m_Path.
void RenderNodesForPrinting (RenderRegion *pRender)
 Renders all original nodes again Notes: Used because in printing, problems occur with the ShrinkPath stuff, causing holes to appear in the printed image. Thus, we take a different tack of rendering the bevelled path without the original being taken away from it, and then rendering the original nodes again so no holes occur See also: NodeBevel::RenderBitmap.
void RenderNodeRecursively (Node *pNode, RenderRegion *pRender)
 Renders all children of this node first, then renders the node itself Notes: See also: NodeBevel::DrawNodesForPrinting.
void SetUpBitmapPalette (RenderRegion *pRegion=NULL, DocColour FlatColour=COLOUR_BLACK)
 Sets up the bitmap palette depending on contrast setting.
BOOL CreateBevelBitmap ()
 Creates the bitmap used in generating the highlights for bevels Note:.
BOOL RenderBitmapForDisplay (RenderRegion *pRegion)
 Creates the Brigtness bitmap for the bevel.
BOOL ReverseAndShrinkBevelPathIntoInkPath (Path *pBevelPath=NULL, double ZoomValue=1.0, BOOL IsAnOuter=TRUE)

Protected Attributes

Path m_Path
BOOL m_DoRender
KernelBitmapm_pBevelBitmap
KernelBitmapm_pCombiBitmap
BitmapFillAttributem_pBMPFill
BitmapTranspFillAttributem_pTranspFill
INT32 m_BitmapWidth
INT32 m_BitmapHeight
DocCoord m_SubPixelOffset
DocRect m_PixelAllignedRect
BOOL m_IsFlatFilledOnly
BOOL m_IsAnAlphaBMP
BOOL m_HasTransparencyApplied
BOOL m_AmConvertingToShapes
double m_LastCachedPrintBMPDPI
double m_LastExportedDPI
BOOL m_bStopRender
BOOL m_DoingRotation
Path m_OuterBevelPath
UINT32 m_ViewScale
Path m_ShrunkPath
BOOL m_bLock
BOOL m_bRenderBitmaps
BOOL m_bZeroLineWidth
CBevelerm_pBeveler
BOOL m_bPathIsClosed
BOOL m_bCached
double m_LastZoomFactor
UINT32 m_LastPixelSize

Private Member Functions

 CC_DECLARE_DYNCREATE (NodeBevel)

Detailed Description

Does the bevelling.

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

Definition at line 132 of file nodebev.h.


Constructor & Destructor Documentation

NodeBevel::NodeBevel  ) 
 

Default constructor Note:.

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

Definition at line 280 of file nodebev.cpp.

00281 {
00282     m_bStopRender = FALSE;
00283     m_Indent = 0;
00284     m_LightAngle = 300;
00285     m_bLock = FALSE;
00286     m_BevelType = 0;
00287     m_bZeroLineWidth = TRUE;
00288     m_pBevelBitmap = NULL;
00289     m_bOuter = FALSE;
00290     m_Contrast = 100;
00291     m_ShrunkPath.Initialise();
00292     m_ViewScale = 0;
00293     m_pBMPFill = NULL;
00294     m_bRenderBitmaps = TRUE;
00295     m_OuterBevelPath.Initialise();
00296     m_Path.Initialise();
00297     m_BevelType = 0;
00298     m_LightAngle = 0;
00299     m_JointType = MitreJoin;
00300     InkPath.Initialise(0,12);
00301     m_pBeveler = NULL;
00302     m_Tilt = 32.0;
00303     m_bPathIsClosed = FALSE;
00304     m_bCached = FALSE;
00305     m_DoingRotation = FALSE;
00306     m_SubPixelOffset.x = 0;
00307     m_SubPixelOffset.y = 0;
00308     m_IsFlatFilledOnly = TRUE;
00309     m_HasTransparencyApplied = FALSE;
00310     m_pTranspFill = NULL;
00311     m_pCombiBitmap = NULL;
00312     m_LastZoomFactor = 1.0;
00313     m_LastCachedPrintBMPDPI = 0.0;
00314     m_LastPixelSize = 0;
00315     m_IsABlendStepBevel = FALSE;
00316     m_DoRender = TRUE;
00317     m_IsAnAlphaBMP = FALSE;
00318     m_AmConvertingToShapes = FALSE;
00319     m_LastExportedDPI = 96.0;
00320 }

NodeBevel::~NodeBevel  ) 
 

Default destructor Note:.

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

Definition at line 334 of file nodebev.cpp.

00335 {
00336     if (m_pBMPFill)
00337     {
00338         delete m_pBMPFill;
00339         m_pBMPFill = NULL;
00340     }
00341 
00342     if (m_pTranspFill)
00343     {
00344         delete m_pTranspFill;
00345         m_pTranspFill = NULL;
00346     }
00347 
00348     if (m_pBevelBitmap)
00349     {
00350         delete m_pBevelBitmap;
00351         m_pBevelBitmap = NULL;
00352     }
00353 
00354     if(m_pCombiBitmap)
00355     {
00356         delete m_pCombiBitmap;
00357         m_pCombiBitmap = NULL;
00358     }
00359 
00360     DeleteCache();
00361 }

NodeBevel::NodeBevel 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. Note: SetUpShape() must be called before the NodeRegularShape is in a state in which it can be used.

/

const UINT32 BevelClipPathToPath_Tolerance = 30 ; const UINT32 BevelClipPathToPath_Flatness = 200 ; const UINT32 BevelStrokePathToPath_Flatness = 200 ;

const double BevelMaxBitmapWidth = 1600.0; const double BevelMaxBitmapHeight = 1200.0;

/*!

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
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 ?

See also:
NodeRegularShape::SetUpShape
Returns:
Errors: An ENSURE will occur if ContextNode is NULL

Definition at line 222 of file nodebev.cpp.

00228                 : NodeRenderableInk(ContextNode, Direction, Locked, Mangled, Marked, Selected )
00229 {                         
00230     m_Indent = 0;
00231     m_pBevelBitmap = NULL;
00232     m_Contrast = 100;
00233     m_bLock = FALSE;
00234     m_bRenderBitmaps = TRUE;
00235     m_bZeroLineWidth = TRUE;
00236     m_LastPixelSize = 0;
00237     m_bOuter = FALSE;
00238     m_BitmapWidth = 0;
00239     m_BitmapHeight = 0;
00240     InkPath.Initialise(0,12);
00241     m_ShrunkPath.Initialise();
00242     m_bStopRender = FALSE;
00243     m_pBMPFill = NULL;
00244     m_BevelType = 0;
00245     m_LightAngle = 0;
00246     m_ViewScale = 0;
00247     m_OuterBevelPath.Initialise();
00248     m_Path.Initialise();
00249     m_pBeveler = NULL;
00250     m_Tilt = 32.0;
00251     m_bPathIsClosed = FALSE;
00252     m_bCached = FALSE;
00253     m_DoingRotation = FALSE;
00254     m_SubPixelOffset.x = 0;
00255     m_SubPixelOffset.y = 0;
00256     m_IsFlatFilledOnly = TRUE;
00257     m_HasTransparencyApplied = FALSE;
00258     m_pTranspFill = NULL;
00259     m_pCombiBitmap = NULL;
00260     m_LastZoomFactor = 1.0;
00261     m_LastCachedPrintBMPDPI = 0.0;
00262     m_IsABlendStepBevel = FALSE;
00263     m_DoRender = TRUE;
00264     m_IsAnAlphaBMP = FALSE;
00265     m_AmConvertingToShapes = FALSE;
00266     m_LastExportedDPI = 96.0;
00267 }


Member Function Documentation

BOOL NodeBevel::AllowOp ObjChangeParam pParam,
BOOL  SetOpPermissionState,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>; Karim 20/01/2000
Date:
20/11/96
Parameters:
pParam describes the way an op wants to change the node [INPUTS] SetOpPermissionState if TRUE the OpPermission of nodes should be set DoPreTriggerEdit if TRUE then NameGallery::PreTriggerEdit is called. Must* be TRUE if the calling Op may make any nodes change their bounds, eg move, line width, cut. Use TRUE if unsure.
See also:

Reimplemented from Node.

Definition at line 3574 of file nodebev.cpp.

03576 {
03577     ERROR2IF(pParam==NULL, FALSE, "NodeBevel::AllowOp; NULL pParam");
03578 
03579     // Set up a flag to see if any of the child objects get changed
03580     BOOL allowed = TRUE;
03581 
03582     UndoableOperation* pOp = pParam->GetOpPointer();
03583 
03584     // clean out the calling-child ptr, so it doesn't get passed around unintentionally.
03585     pParam->SetCallingChild(NULL);
03586 
03587     // before going further, see whether our parents allow the Op.
03588     if (allowed && Parent != NULL && pParam->GetDirection()!= OBJCHANGE_CALLEDBYPARENT)
03589     {
03590         ObjChangeDirection OldDirection = pParam->GetDirection();
03591         pParam->SetCallingChild(this);
03592         pParam->SetDirection(OBJCHANGE_CALLEDBYCHILD);
03593         allowed = Parent->AllowOp(pParam, SetOpPermissionState, DoPreTriggerEdit);
03594         pParam->SetDirection(OldDirection);
03595     }
03596 
03597     // if the parent allows this, then test the op for ourself.
03598     if (allowed && pOp)
03599     {
03600         // disallow mould and contour Ops.
03601         if ( pOp->IsKindOf(CC_RUNTIME_CLASS(OpCreateNewMould)) ||
03602              pOp->IsKindOf(CC_RUNTIME_CLASS(OpPasteEnvelope)) ||
03603              pOp->IsKindOf(CC_RUNTIME_CLASS(OpPastePerspective)) ||
03604              pOp->IsKindOf(CC_RUNTIME_CLASS(OpCreateContour))
03605             )
03606             allowed = FALSE;
03607 
03608         if( (pOp->IsKindOf(CC_RUNTIME_CLASS(OpEditFill)) ||
03609              pOp->IsKindOf(CC_RUNTIME_CLASS(OpApplyAttribToSelected))) &&
03610              !m_IsFlatFilledOnly && m_HasTransparencyApplied && m_pCombiBitmap )
03611         {
03612             // Make sure the attributes aren't pointing at the bitmap we are about to delete
03613             if (m_pBMPFill->GetBitmap() == m_pCombiBitmap)
03614                 m_pBMPFill->BitmapRef.SetBitmap(NULL);
03615             if (m_pTranspFill->GetBitmap() == m_pCombiBitmap)
03616                 m_pTranspFill->BitmapRef.SetBitmap(NULL);
03617             
03618             delete m_pCombiBitmap;
03619             m_pCombiBitmap = NULL;
03620         }
03621     }
03622 
03623     // if necessary, set permissions for OnChildChange.
03624     if (SetOpPermissionState)
03625         SetOpPermission(allowed ? PERMISSION_ALLOWED : PERMISSION_DENIED, TRUE);
03626 
03627     if (allowed)
03628     {
03629         UndoableOperation* pChangeOp = pParam->GetOpPointer();
03630 
03631         // check for geometry linked attributes
03632         BOOL InformGeomLinkedAttrs = SetOpPermissionState && pChangeOp && pChangeOp->MayChangeNodeBounds();
03633         if (InformGeomLinkedAttrs)
03634         {
03635             NodeAttribute* pNA = FindFirstGeometryLinkedAttr();
03636             while(pNA)
03637             {
03638                 pNA->LinkedNodeGeometryHasChanged(pChangeOp);
03639                 pNA = pNA->FindNextGeometryLinkedAttr();
03640             }
03641         }       
03642 
03643         // if we're ok so far and were asked to do a PreTriggerEdit, then
03644         // determine whether the Op may change the bounds of some nodes.
03645         // If it may, then call NameGallery::PreTriggerEdit.
03646         if (DoPreTriggerEdit && pChangeOp && pChangeOp->MayChangeNodeBounds() && NameGallery::Instance())
03647             allowed = NameGallery::Instance()->PreTriggerEdit(pChangeOp, pParam, this);
03648     }
03649 
03650     // return result (directly, or indirectly via a child AllowOp()) to op
03651     return allowed;
03652 }

BOOL NodeBevel::AmICached  )  [inline]
 

Definition at line 231 of file nodebev.h.

00231 { return m_bCached; }

void NodeBevel::CalculateBitmapSize INT32 *  retnWid,
INT32 *  retnHei,
RenderRegion pRegion = NULL
[protected]
 

Calculates the width and the height for the bitmap depending on what's in m_Path.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/98
Parameters:
Return pointers for witdth & height [INPUTS]

Definition at line 1798 of file nodebev.cpp.

01799 {
01800     // Get a pointer to the controller node!
01801     NodeBevelController * pControl = (NodeBevelController *)FindParent();
01802 
01803     // Check that all the pointers are valid!
01804     if(!retnWid || !retnHei || !pControl)
01805         return;
01806 
01807     // Get the bounding rect of the bevel!
01808     DocRect dr(0,0,0,0);
01809 
01810     // If it`s an outer then get the bounds that gavin creates when he generates his trap list!
01811     if(m_bOuter)
01812     {
01813         if(m_pBeveler)
01814             dr = m_pBeveler->GetSelectionRect();
01815         else
01816         {
01817             InkPath.GetTrueBoundingRect(&dr);
01818             dr.Inflate(m_Indent);
01819         }
01820     }
01821     else
01822     {
01823         // If it`s an inner then just get the bounds of the object and not the bevel path
01824         m_Path.GetTrueBoundingRect(&dr);
01825     }
01826 
01827     // Make sure we check to see if the returned rect is not empty!
01828     if (dr.IsEmpty())
01829     {
01830         *retnWid = 0;
01831         *retnHei = 0;
01832         return;
01833     }
01834 
01835     MILLIPOINT PixSize = 750;
01836     
01837     if(pRegion)
01838         PixSize = pRegion->GetScaledPixelWidth();
01839 
01840     if(Document::GetCurrent() && Document::GetCurrent()->GetFirstDocView()
01841              && !(pRegion && pRegion->IS_KIND_OF(PrintingMaskedRenderRegion))
01842         )
01843         PixSize = (MILLIPOINT)((double)PixSize / (Document::GetCurrent()->GetFirstDocView())->GetViewScale().MakeDouble());
01844     
01845     if(PixSize == 0)
01846         PixSize = 1;
01847 
01848     m_PixelAllignedRect = dr;
01849     double lWidth  = dr.Width() / PixSize;
01850     double lHeight = dr.Height() / PixSize;
01851     
01852     // Check to see if we`re not printing and then Scale up the values!
01853     if ((!pControl->IsPrinting() && !m_AmConvertingToShapes) ||
01854         (pRegion && pRegion->IS_KIND_OF(PrintingMaskedRenderRegion)))
01855     {
01856         // If the current render regions scale value is greater than 0 do the following
01857         if (pRegion && PixSize > 0 )
01858         {
01859             lWidth = (lWidth * 750) / PixSize;
01860             lHeight = (lHeight * 750) / PixSize;
01861         }
01862         
01863         // Make sure the values are under the maximum values!
01864         while ( lWidth  > BevelMaxBitmapWidth || lHeight > BevelMaxBitmapHeight )
01865         {
01866             // Divide them by a half!
01867             lWidth *= 0.5;
01868             lHeight *= 0.5;
01869         }
01870     }
01871     else
01872     {
01873         double DPI = pControl->GetDPI();
01874         lWidth  = dr.Width () * DPI / 72000 ;
01875         lHeight = dr.Height() * DPI / 72000 ;
01876     }
01877 
01878     // Now place the new values into the passed in variables
01879     *retnWid = (INT32)ceil(lWidth);
01880     *retnHei = (INT32)ceil(lHeight);
01881 }

BOOL NodeBevel::CanAttrBeAppliedToMe CCRuntimeClass pAttribClass  )  [virtual]
 

Determine whether the given attr type can be applied directly to me. We don't like brushed bevels, so we don't accept brush attrs.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/08/2000
Parameters:
pAttribClass the attr type to test. [INPUTS]
Returns:
FALSE if pAttribClass is a brush attr, TRUE otherwise.

Errors: returns FALSE if pAttribClass is NULL.

Reimplemented from NodeRenderableInk.

Definition at line 2906 of file nodebev.cpp.

02907 {
02908     if (pAttribClass == NULL || pAttribClass == CC_RUNTIME_CLASS(AttrBrushType))
02909         return FALSE;
02910     else
02911         return TRUE;
02912 }

BOOL NodeBevel::CanBecomeA BecomeA pBecomeA  )  [virtual]
 

Can become a path !

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/2/99
Parameters:
Ink class to test [INPUTS]
See also:

Reimplemented from Node.

Definition at line 2547 of file nodebev.cpp.

02548 {
02549     if (pBecomeA->BAPath())
02550     {
02551         pBecomeA->AddCount(2);
02552 
02553         return TRUE;
02554     }
02555 
02556     return FALSE;
02557 }

NodeBevel::CC_DECLARE_DYNCREATE NodeBevel   )  [private]
 

void NodeBevel::CopyNodeContents NodeBevel pNewNode  ) 
 

Sort of backwards copy constructor.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/01/2004
Parameters:
- [INPUTS]
Returns:

Definition at line 3113 of file nodebev.cpp.

03114 {
03115     pNewNode->m_Indent     = m_Indent;
03116     pNewNode->m_LightAngle = m_LightAngle;
03117     pNewNode->m_Contrast   = m_Contrast;
03118     pNewNode->m_BevelType  = m_BevelType;
03119     pNewNode->m_bOuter     = m_bOuter;
03120 
03121     pNewNode->InkPath.Initialise(InkPath.GetNumCoords());
03122     pNewNode->InkPath.CopyPathDataFrom(&InkPath);
03123 
03124     pNewNode->m_MustRegenOnChildChange = m_MustRegenOnChildChange;
03125 
03126     pNewNode->m_Tilt = m_Tilt;
03127 
03128     pNewNode->m_IsABlendStepBevel = m_IsABlendStepBevel;
03129 
03130     // points determining the fill control points
03131     pNewNode->m_BMPCentre = m_BMPCentre;
03132     pNewNode->m_BMPPoint1 = m_BMPPoint1;
03133     pNewNode->m_BMPPoint2 = m_BMPPoint2;
03134 
03135     // the rect of the (original) selection
03136     pNewNode->m_SelectedRect = m_SelectedRect;
03137     pNewNode->m_JointType = m_JointType;
03138 
03139     pNewNode->m_Path.Initialise(m_Path.GetNumCoords());
03140     pNewNode->m_Path.CopyPathDataFrom(&m_Path);
03141 
03142     pNewNode->m_DoRender = TRUE;
03143 
03144     pNewNode->DeleteCachedBitmap();
03145 
03146     if (m_pBevelBitmap==NULL && m_pBMPFill!=NULL)
03147         m_pBMPFill->BitmapRef.SetBitmap(m_pBevelBitmap);
03148     if (m_pBevelBitmap==NULL && m_pTranspFill!=NULL)
03149         m_pTranspFill->BitmapRef.SetBitmap(m_pBevelBitmap);
03150 
03151     if (pNewNode->m_pBMPFill)
03152         delete pNewNode->m_pBMPFill;
03153     pNewNode->m_pBMPFill = NULL;
03154     if (m_pBMPFill)
03155     {
03156         pNewNode->m_pBMPFill = new BitmapFillAttribute;
03157         pNewNode->m_pBMPFill->SimpleCopy(m_pBMPFill);
03158     }
03159 
03160     if (pNewNode->m_pTranspFill)
03161         delete pNewNode->m_pTranspFill;
03162     pNewNode->m_pTranspFill = NULL;
03163     if (m_pTranspFill)
03164     {
03165         pNewNode->m_pTranspFill = new BitmapTranspFillAttribute;
03166         pNewNode->m_pTranspFill->SimpleCopy(m_pTranspFill);
03167     }
03168 
03169     pNewNode->m_BitmapWidth = m_BitmapWidth;
03170     pNewNode->m_BitmapHeight = m_BitmapHeight;
03171 
03172     pNewNode->m_SubPixelOffset = m_SubPixelOffset;
03173     pNewNode->m_PixelAllignedRect = m_PixelAllignedRect;
03174     pNewNode->m_IsFlatFilledOnly = m_IsFlatFilledOnly;
03175     pNewNode->m_IsAnAlphaBMP = m_IsAnAlphaBMP;
03176     pNewNode->m_HasTransparencyApplied = m_HasTransparencyApplied;
03177     pNewNode->m_AmConvertingToShapes = m_AmConvertingToShapes;
03178 
03179     pNewNode->m_LastCachedPrintBMPDPI = m_LastCachedPrintBMPDPI;
03180     pNewNode->m_LastExportedDPI = m_LastExportedDPI;
03181 
03182     // lock on rendering
03183     pNewNode->m_bStopRender = m_bStopRender;
03184     pNewNode->m_DoingRotation = m_DoingRotation;
03185 
03186     // this is the bevel path generated by the path processor for outer bevels (without
03187     // the hole in it)
03188     pNewNode->m_OuterBevelPath.Initialise(m_OuterBevelPath.GetNumCoords());
03189     pNewNode->m_OuterBevelPath.CopyPathDataFrom(&m_OuterBevelPath);
03190 
03191     // the pixel sizes used to create the bevel bitmap
03192     pNewNode->m_ViewScale = m_ViewScale;
03193 
03194     // the shrunk path used in rendering
03195     pNewNode->m_ShrunkPath.Initialise(m_ShrunkPath.GetNumCoords());
03196     pNewNode->m_ShrunkPath.CopyPathDataFrom(&m_ShrunkPath);
03197 
03198     pNewNode->m_bLock = m_bLock;
03199     pNewNode->m_bRenderBitmaps = m_bRenderBitmaps;
03200 
03201     // indicates we should zero the line width of the path, or not (as the case might be)
03202     pNewNode->m_bZeroLineWidth = m_bZeroLineWidth;
03203 
03204     // Make sure the new node doesn't have an old CBeveler lying around.
03205     if (pNewNode->m_pBeveler)
03206     {
03207         delete pNewNode->m_pBeveler;
03208         pNewNode->m_pBeveler = NULL;
03209     }
03210 
03211     // whether the original path is closed or not
03212     // if not, don't do any path shrinking
03213     pNewNode->m_bPathIsClosed = m_bPathIsClosed;
03214 
03215     // flag to indicate that when this node is inside of a blend there's
03216     // no need to regenerate it - it's already been cached
03217     pNewNode->m_bCached = m_bCached;
03218 
03219     // Reverses the bevel path and adds it to the original to create the new bevel path
03220     // Also shrinks/Expands the inner/outer path edge by a pixel to get rid of antialiasing
03221     // effects when overlapping the object
03222     pNewNode->m_LastZoomFactor = m_LastZoomFactor;
03223 
03224     // the last pixel size for the bitmap
03225     pNewNode->m_LastPixelSize = m_LastPixelSize;
03226 
03227     NodeRenderableInk::CopyNodeContents(pNewNode);
03228 }

BOOL NodeBevel::CreateBevelBitmap  )  [protected]
 

Creates the bitmap used in generating the highlights for bevels Note:.

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

Definition at line 569 of file nodebev.cpp.

00570 {
00571     // Find the parent node and make sure it`s not null and it`s a bevel controller node
00572     Node* pNode = FindParent();
00573     if (!pNode && !pNode->IsKindOf(CC_RUNTIME_CLASS(NodeBevelController)))
00574     {
00575         ERROR3("Bevel node has a parent which isn't a bevel controller node !");
00576         return FALSE;
00577     }
00578 
00579     TRACEUSER( "MarkH", _T("Creating a new Bevel Bitmap!\n"));
00580 
00581     // Clear the current shrunken path
00582     m_ShrunkPath.ClearPath();
00583     
00584     // delete the existing pointers
00585     if (m_pBevelBitmap)
00586     {
00587         delete m_pBevelBitmap;
00588         m_pBevelBitmap = NULL;
00589     }
00590 
00591     if (m_pBeveler)
00592     {
00593         delete m_pBeveler;
00594         m_pBeveler = NULL;
00595     }
00596 
00597     if(m_pCombiBitmap)
00598     {
00599         delete m_pCombiBitmap;
00600         m_pCombiBitmap = NULL;
00601     }
00602 
00603     // get the path to use from the processor
00604     if (m_Path.GetNumCoords() == 0)
00605         return FALSE;
00606 
00607     // Now create a new CBeveler Pointer
00608     m_pBeveler = new CBeveler(&m_Path);
00609     ERROR2IF(!m_pBeveler,FALSE,"Failed to create a CBeveler pointer!");
00610 
00611     // the flatness needs to be linked to the height of this
00612     MILLIPOINT Flatness = BEVEL_FLATNESS;
00613 
00614     // alter the flatness for printing
00615     NodeBevelController* pBevelController = (NodeBevelController *) pNode;
00616     if (pBevelController && pBevelController->IsPrinting())
00617         Flatness = (MILLIPOINT)(((double)BEVEL_FLATNESS) * (96.0 / pBevelController->GetDPI()));
00618 
00619     // set up the bevel type
00620     m_pBeveler->SetBevelType(m_BevelType);
00621     m_pBeveler->SetBevelAngle(m_LightAngle);
00622     m_pBeveler->SetBevelTilt(m_Tilt);
00623 
00624     // Find the current Join type
00625     AttrJoinType * pJoinType = NULL;
00626     FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), (NodeAttribute **)(&pJoinType));
00627     JointType JT = RoundJoin;
00628     if (pJoinType)
00629         JT = pJoinType->Value.JoinType;
00630 
00631     // Calculate the angle using the lightangle variable
00632     double angle = 3.1415926536*m_LightAngle/180 ;
00633     NormCoord nc( cos(angle),sin(angle) );
00634 
00635     // Set up the beveler with all the new variables!
00636     BOOL ok = m_pBeveler->SetUpBeveler(m_Indent, JT, &nc, m_bOuter, pBevelController->m_Contrast, NULL, BevelClipPathToPath_Flatness);
00637 
00638     // Check to see if the setup went ok
00639     if(!ok)
00640         return FALSE;
00641 
00642     // Do another recalculation to setup the fill handles!
00643     CalculateBitmapSize(&m_BitmapWidth, &m_BitmapHeight);
00644 
00645     // Check to see if the size is valid
00646     if (m_BitmapWidth <= 0 || m_BitmapHeight <= 0)
00647         return TRUE;
00648 
00649     // Now tell the beveler how large to make the bevels.
00650     m_pBeveler->SetBevelerSize(m_BitmapWidth,m_BitmapHeight);
00651     
00652     // make the bounding box the same as the selection bounds 
00653     BoundingRectangle = m_PixelAllignedRect;
00654     IsBoundingRectValid = TRUE;
00655 
00656     m_BMPCentre.x = m_PixelAllignedRect.lo.x;
00657     m_BMPCentre.y = m_PixelAllignedRect.lo.y;
00658     m_BMPPoint1.x = m_PixelAllignedRect.hi.x;
00659     m_BMPPoint1.y = m_PixelAllignedRect.lo.y;
00660     m_BMPPoint2.x = m_PixelAllignedRect.lo.x;
00661     m_BMPPoint2.y = m_PixelAllignedRect.hi.y;
00662 
00663     NodeAttribute* pFillAttrib = NULL;
00664     DocColour FillColour = COLOUR_BLACK;
00665 
00666     // Test to see if theres a FillGeom Attribute applied to the bevel
00667     if(FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFillGeometry),&pFillAttrib))
00668     {
00669         // If the pointer is valid and It`s a flat fill then get the colour and set the IsFlatFill Flag
00670         if(pFillAttrib != NULL && pFillAttrib->IsAFlatFill())
00671         {
00672             FillColour = *((AttrFlatColourFill*)pFillAttrib)->GetStartColour();
00673             m_IsFlatFilledOnly = TRUE;
00674         }
00675         else
00676         {
00677             // it`s not a plain flat fill so set the flag to false
00678             m_IsFlatFilledOnly = FALSE;
00679 
00680             // Make sure we know if it`s an Alpha Channel Bitmap as this needs special treatment!
00681             if(pFillAttrib->IsABitmapFill())
00682             {
00683                 BitmapFillAttribute* pFill = (BitmapFillAttribute*)pFillAttrib->GetAttributeValue();
00684                 m_IsAnAlphaBMP = (pFill->GetBitmap()->GetBitmapInfoHeader()->biBitCount == 32);
00685             }
00686             else
00687                 m_IsAnAlphaBMP = FALSE;
00688         }
00689     }
00690 
00691     // make sure the palette is setup ready for the BMP
00692     SetUpBitmapPalette((RenderRegion *)NULL,FillColour);
00693 
00694     // Everythings cool, return TRUE
00695     return TRUE;
00696 }

BOOL NodeBevel::CreateBevelPaths  ) 
 

Sets up all the attributes on myself and my parent by finding the appropriate attributes Note:.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/10/99
See also:
ContourBecomeA (in kernel/nodecntr.h), NodeContour::GenerateContour

Definition at line 784 of file nodebev.cpp.

00785 {
00786     // Delete the current Cache
00787     DeleteCache();
00788 
00789     // build up the source path
00790     Node * pNode = FindParent();
00791     NodeBevelController * pControl = (NodeBevelController *)FindParent();
00792 
00793     if (!pNode)
00794         return FALSE;
00795 
00796     pNode = pNode->FindFirstChild();
00797 
00798     if (!pNode || pNode == this)
00799         return FALSE;
00800 
00801     double CurrentFlatness = 200.0;
00802 
00803     // Mark Howitt 31/10/00
00804     // This function call now replaces the passed in value when the BecomeA function is created.
00805     // This has been done to elliminate zoom dependancies which change the flatness values
00806     // depending on the current zoom value. See the function header for more details
00807     Node* pNodeToBevel = pNode->FindNextInk();
00808 
00809     while(pNodeToBevel == this && pNodeToBevel)
00810         pNodeToBevel = pNodeToBevel->FindNextInk();
00811 
00812     if(pNodeToBevel)
00813     {
00814         DocRect DR = ((NodeRenderableInk*)pNodeToBevel)->GetBoundingRect();
00815 
00816         // Get the smallest dimesion, Width or Height.
00817         double Smallest = DR.Height() < DR.Width() ? (double)DR.Height() : (double)DR.Width();
00818 
00819         // now make the flatness value equal to the smallest dimesion divided by 375
00820         CurrentFlatness = Smallest / 375.0;
00821 
00822         // Check to see if we`re within the specified limits
00823         if(1.0 > CurrentFlatness) CurrentFlatness = 1.0;
00824         if(375.0 < CurrentFlatness) CurrentFlatness = 375.0;
00825     }
00826 
00827     // Check to see what the zoom factor is so we can take it into account for the flatness values!
00828     DocView* pDocView = Document::GetCurrent()->GetFirstDocView();
00829     double CurrentZoom = 1.0;
00830 
00831     if(pDocView)
00832         CurrentZoom = pDocView->GetZoomFactor();
00833 
00834     m_LastZoomFactor = CurrentZoom;
00835 
00836     m_Path.ClearPath();
00837     InkPath.ClearPath();
00838     m_OuterBevelPath.ClearPath();
00839 
00840     INT32 Width  = pControl->m_Indent;
00841     BOOL bOuter = pControl->m_bOuter;
00842 
00843     // bog standard profile
00844     CProfileBiasGain Profile;
00845     AttrJoinType * pJoinType = NULL;
00846     FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), (NodeAttribute **)(&pJoinType));
00847 
00848     JointType JT = RoundJoin