NodeLockedEffect Class Reference

Bitmap effects nodes are type of Post-Processors. They process the bitmap output of their child nodes. They are "Locked" in that they capture the output once then ignore changes to their children (because they cannot reproduce the processing). More...

#include <nodeliveeffect.h>

Inheritance diagram for NodeLockedEffect:

NodeBitmapEffect NodeEffect NodeCompound NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeLockedEffect ()
 Note:.
 ~NodeLockedEffect ()
 Destructor Note:.
 NodeLockedEffect (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 SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 Do clever stuff on the way into a subtree, possibly modifying rendering behaviour.
virtual String Describe (BOOL Plural, BOOL Verbose)
 To return a description of the Group object in either the singular or the plural. This method is called by the DescribeRange method.
virtual NodeSimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
 Get the bounding rect of the cached processed bitmap or the original bitmap if the processed isn't set yet... or the children if neither is set yet...
virtual void Transform (TransformBase &Trans)
 Transforms the LiveEffect node.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes the path record to the filter.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes the path record to the filter.
virtual BOOL CanSelectAsCompoundParent ()
 Ask a node whether or not it's prepared to become selected when one of it's children is clicked on. This function is called in the FindSimple/Compound routines when they are following parent links up the tree from a node which has been "hit". This virtual function should be overridden in derived classes to alter its behaviour.
virtual BOOL PromoteHitTestOnChildrenToMe () const
virtual BOOL AllowSelectInside () const
virtual void RenderObjectBlobs (RenderRegion *pRender)
 Renders the Object blobs for a Node Shape.
virtual void RenderTinyBlobs (RenderRegion *pRender)
 Renders the Tiny blobs for a Node Shape.
virtual void Render (RenderRegion *pRender)
 Will render the liveeffect iff we have it cached - for hit detection reasons.
virtual KernelBitmapEnumerateBitmaps (UINT32 Count)
 Find out what bitmaps, if any, are used by this node.
virtual NodeRenderableInkGetInkNodeFromController () const
 Find next node down in the effects stack.
virtual void UnlinkNodeFromTree (BaseDocument *pOwnerDoc=NULL)
 Pre-Destructor Do smart tidy up of bitmap usage if we are being deleted from the tree rather than simply unlinked temporarilly (signalled by pOwnerDoc being non-null) Note:.
virtual BOOL CanSupplyDirectBitmap ()
virtual BOOL GetProcessedBitmap (BOOL bDirect, LPBITMAPINFO *plpInfo, LPBYTE *plpBits, DocRect *pRect)
 

virtual DocRect SetProcessedBitmap (LPBITMAPINFO lpInfo, LPBYTE lpBits, DocRect rect, INT32 width, INT32 height, double xOffset, double yOffset, double dPixelWidth=0, Matrix *pmatTransform=NULL)
 

virtual BOOL IsLockedEffect ()
virtual BOOL CanBeUnlocked () const
virtual void SetLockPermanence (BOOL bDestructive)
virtual KernelBitmapGetKernelBitmap (DocCoord *pCoords, BOOL bRetainCached=FALSE)
 Allows a bitmap effect to create a permanent kernel bitmap version of itself.

Protected Member Functions

virtual BOOL RenderCachedEffect (CBitmapCache *pBitmapCache, RenderRegion *pRender, BOOL bIgnoreCapture=FALSE)
 

virtual BOOL WriteLockedEffect (BaseCamelotFilter *pFilter)
 Writes the path record to the filter.
void CopyNodeContents (NodeLockedEffect *pCopyOfNode)
 Copies the data from 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.

Private Member Functions

 CC_DECLARE_DYNCREATE (NodeLockedEffect)

Private Attributes

KernelBitmapRef m_BitmapRef
DocCoord m_PGram [3]
BOOL m_bIsDestructive

Friends

class LiveEffectRecordHandler

Detailed Description

Bitmap effects nodes are type of Post-Processors. They process the bitmap output of their child nodes. They are "Locked" in that they capture the output once then ignore changes to their children (because they cannot reproduce the processing).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004

Definition at line 376 of file nodeliveeffect.h.


Constructor & Destructor Documentation

NodeLockedEffect::NodeLockedEffect  ) 
 

Note:.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004
See also:

Definition at line 2880 of file nodeliveeffect.cpp.

02880                                    : NodeBitmapEffect()
02881 {
02882     m_PGram[0] = DocCoord(0,0);
02883     m_PGram[1] = DocCoord(0,0);
02884     m_PGram[2] = DocCoord(0,0);
02885 
02886     m_dPixelsPerInch = (double)NodeBitmapEffect::DefaultLockedPixelsPerInch;
02887     m_bIsDestructive    = TRUE;
02888 }

NodeLockedEffect::~NodeLockedEffect  ) 
 

Destructor Note:.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/11/2004
See also:

Definition at line 2904 of file nodeliveeffect.cpp.

02905 {
02906     m_BitmapRef.Detach();           // Detach bitmap ref
02907     m_pEditsDoc = NULL;             // m_pEditsDoc is a smart pointer so NULLing it Releases the COM interface
02908                                     // and releases any memory
02909 
02910     // Get rid of our original bitmap(s)
02911     CBitmapCache* pBitmapCache = Camelot.GetBitmapCache();
02912     if (pBitmapCache!=NULL)
02913     {
02914         CBitmapCacheKey inky(this, 42);
02915         pBitmapCache->RemoveAllOwnedBitmaps(inky, FALSE, CACHEPRIORITY_PERMANENT);
02916     }
02917 }

NodeLockedEffect::NodeLockedEffect 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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004
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 2850 of file nodeliveeffect.cpp.

02856                 : NodeBitmapEffect(ContextNode, Direction, Locked, Mangled, Marked, Selected )
02857 {
02858     m_PGram[0] = DocCoord(0,0);
02859     m_PGram[1] = DocCoord(0,0);
02860     m_PGram[2] = DocCoord(0,0);
02861 
02862     m_dPixelsPerInch = (double)NodeBitmapEffect::DefaultLockedPixelsPerInch;
02863     m_bIsDestructive    = TRUE;
02864 }                        


Member Function Documentation

virtual BOOL NodeLockedEffect::AllowSelectInside  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 408 of file nodeliveeffect.h.

00408 {return FALSE;}             // TRUE if normal effect

virtual BOOL NodeLockedEffect::CanBeUnlocked  )  const [inline, virtual]
 

Reimplemented from NodeEffect.

Definition at line 433 of file nodeliveeffect.h.

00433 {return !m_bIsDestructive;}

virtual BOOL NodeLockedEffect::CanSelectAsCompoundParent  )  [inline, virtual]
 

Ask a node whether or not it's prepared to become selected when one of it's children is clicked on. This function is called in the FindSimple/Compound routines when they are following parent links up the tree from a node which has been "hit". This virtual function should be overridden in derived classes to alter its behaviour.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/01/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node will allow itself to be selected when one of it's children has been "hit" FALSE otherwise

Errors: -

See also:
NodeRenderableInk::FindSimpleAtPoint; NodeRenderableInk::FindCompoundAtPoint

Reimplemented from NodeRenderableInk.

Definition at line 406 of file nodeliveeffect.h.

00406 {return TRUE;}              // FALSE if normal effect

virtual BOOL NodeLockedEffect::CanSupplyDirectBitmap  )  [inline, virtual]
 

Reimplemented from NodeBitmapEffect.

Definition at line 415 of file nodeliveeffect.h.

00415 {return HasCachedDirectBitmap();}   // Only supply DirectBitmap if applied to DirectBitmap

NodeLockedEffect::CC_DECLARE_DYNCREATE NodeLockedEffect   )  [private]
 

void NodeLockedEffect::CopyNodeContents NodeLockedEffect pCopyOfNode  )  [protected]
 

Copies the data from 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:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/09/2004
Parameters:
pCopyOfNode - The node to copy data to [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
NodeGroup::CopyNodeContents

Definition at line 3441 of file nodeliveeffect.cpp.

03442 {
03443     NodeBitmapEffect::CopyNodeContents(pCopyOfNode);
03444 
03445     // Copy member vars here
03446 PORTNOTE("other","NodeLockedEffect::CopyNodeContents - Removed CXMLUtils usage")
03447 #ifndef EXCLUDE_FROM_XARALX
03448     pCopyOfNode->m_pEditsDoc = CXMLUtils::NewDocument(m_pEditsDoc);
03449 #endif
03450     pCopyOfNode->m_dPixelsPerInch = m_dPixelsPerInch;
03451     pCopyOfNode->m_strDisplayName = m_strDisplayName;
03452     pCopyOfNode->m_rectDirectBitmap = m_rectDirectBitmap;
03453 
03454     pCopyOfNode->m_BitmapRef = m_BitmapRef;
03455     pCopyOfNode->m_PGram[0] = m_PGram[0];
03456     pCopyOfNode->m_PGram[1] = m_PGram[1];
03457     pCopyOfNode->m_PGram[2] = m_PGram[2];
03458     pCopyOfNode->m_bIsDestructive = m_bIsDestructive;
03459 }

String NodeLockedEffect::Describe BOOL  Plural,
BOOL  Verbose
[virtual]
 

To return a description of the Group object in either the singular or the plural. This method is called by the DescribeRange method.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/11/2004
Parameters:
Plural,: Flag indicating if the string description should be plural or [INPUTS] singular.
- [OUTPUTS] Retuns: Description of the group node
The description will always begin with a lower case letter.

Returns:
Errors: (Need to do this)
See also:
-

Reimplemented from Node.

Definition at line 3385 of file nodeliveeffect.cpp.

03386 {
03387     if (Plural)
03388         return(String(_R(IDS_DLIVEEFFECT_DESCRP)));
03389     else
03390         return(String(_R(IDS_DLIVEEFFECT_DESCRS)));
03391 };

KernelBitmap * NodeLockedEffect::EnumerateBitmaps UINT32  Count  )  [virtual]
 

Find out what bitmaps, if any, are used by this node.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/06/2005
Parameters:
Count - the bitmap to get (see Purpose). [INPUTS]
Returns:
The KernelBitmap in use by the node, or NULL if no more are used.
The base class returns NULL always, so you over-ride this in any node classes that use bitmaps.

This function supports nodes that use more than one bitmap - you call this function repeatedly and keep incrementing the Count parameter that you pass in each time by 1. You should stop calling it when it returns NULL, as this indicates that no more bitmaps are used by this node. Count should start off as 0 for the first call. Note that this function can (and often will) return NULL for the first call, as many nodes don't use bitmaps, obviously.

See also:
KernelBitmap, NodeBitmap

Reimplemented from Node.

Definition at line 2995 of file nodeliveeffect.cpp.

02996 {
02997     if (Count == 0) return m_BitmapRef.GetBitmap();
02998 
02999     return NULL;
03000 }

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

Get the bounding rect of the cached processed bitmap or the original bitmap if the processed isn't set yet... or the children if neither is set yet...

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/09/2004
Returns:
The bounding box of the live effect

Reimplemented from NodeRenderableBounded.

Definition at line 3017 of file nodeliveeffect.cpp.

03018 {
03019     // Let sanity prevail!
03020     BOOL bIncludeAttrs = !DontUseAttrs;
03021 
03022     // Optimise this function by returning fast cached info if we know it's valid.
03023     if (IsBoundingRectValid && bIncludeAttrs)
03024         return BoundingRectangle;
03025 
03026     // Else work it out by looking up the cached bitmaps
03027     // and failing that by scanning our children
03028     if (bIncludeAttrs)
03029     {
03030         // We can check the bounds of our whacky effects bitmap
03031         if (m_BitmapRef.GetBitmap()!=NULL)
03032         {
03033             DocRect r(m_PGram[0], m_PGram[0]);
03034             r.IncludePoint(m_PGram[1]);
03035             r.IncludePoint(m_PGram[2]);
03036             r.IncludePoint(DocCoord(m_PGram[2].x+m_PGram[1].x-m_PGram[0].x, m_PGram[2].y+m_PGram[1].y-m_PGram[0].y));
03037             IsBoundingRectValid = TRUE;
03038             BoundingRectangle = r;
03039             return r;
03040         }
03041     }
03042 
03043     DocRect brect = GetChildBoundingRect(bIncludeAttrs);                // Note - don't set IsBoundingRectValid yet
03044 
03045     // Expand bounds to account for as yet unknown size increases that effects might apply
03046     if (bIncludeAttrs)
03047         brect.Inflate((INT32)(GetPixelWidth()*50+0.5));
03048 
03049     return brect;
03050 }

NodeRenderableInk * NodeLockedEffect::GetInkNodeFromController  )  const [virtual]
 

Find next node down in the effects stack.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/08/2005
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
NodeRenderableInk* - Pointer to the single child ink node that this effect derives all its input from (if there is just one child ink node) Otherise NULL

Reimplemented from NodeBitmapEffect.

Definition at line 3779 of file nodeliveeffect.cpp.

03780 {
03781     NodeRenderableInk* pNode = FindFirstChildInk();
03782     if (pNode == FindLastChildInk())
03783         return pNode;
03784 
03785     return NULL;
03786 }

KernelBitmap * NodeLockedEffect::GetKernelBitmap DocCoord pCoords,
BOOL  bRetainCached = FALSE
[virtual]
 

Allows a bitmap effect to create a permanent kernel bitmap version of itself.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/02/2005
Parameters:
bRetainCached - TRUE to retain the cached version when making the permanent bitmap [INPUTS]
pCoords - Array of coords filled in with 3 points defining parallelogram [OUTPUTS]
Returns:
Pointer to new KernelBitmap
See also:
-

Reimplemented from NodeBitmapEffect.

Definition at line 3689 of file nodeliveeffect.cpp.

03690 {
03691     KernelBitmap* kBitmap = m_BitmapRef.GetBitmap();
03692 
03693     if (pCoords)
03694     {
03695         pCoords[0] = m_PGram[0];
03696         pCoords[1] = m_PGram[1];
03697         pCoords[2] = m_PGram[2];
03698     }
03699 
03700     return kBitmap;
03701 }

UINT32 NodeLockedEffect::GetNodeSize  )  const [virtual]
 

For finding the size of the node.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/09/2004
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The size of the node in bytes
See also:
Node::GetSubtreeSize

Reimplemented from Node.

Definition at line 3503 of file nodeliveeffect.cpp.

03504 {     
03505     UINT32 Size = sizeof(NodeLockedEffect);
03506 
03507     // Nasty cast here to avoid const-ness of this pointer
03508     KernelBitmap* pBitmap = ((NodeLockedEffect*)this)->m_BitmapRef.GetBitmap();
03509     if (pBitmap && pBitmap->ActualBitmap)
03510     {
03511         Size += pBitmap->ActualBitmap->GetBitmapSize();
03512     }
03513 
03514     return Size;
03515 }  

BOOL NodeLockedEffect::GetProcessedBitmap BOOL  bDirect,
LPBITMAPINFO plpInfo,
LPBYTE plpBits,
DocRect pRect
[virtual]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/09/2004
Parameters:
- [INPUTS]
plpInfo - pointer to LPBITMAPINFO pointer to be written to for bitmap info [OUTPUTS] plpBits - pointer to LPBYTE pointer to be written to for bitmap data

Reimplemented from NodeBitmapEffect.

Definition at line 3187 of file nodeliveeffect.cpp.

03188 {
03189     if (plpInfo)    *plpInfo = NULL;
03190     if (plpBits)    *plpBits = NULL;
03191 
03192     if (m_BitmapRef.GetBitmap()!=NULL)
03193     {
03194         CWxBitmap* pWBitmap = (CWxBitmap*)m_BitmapRef.GetBitmap()->GetActualBitmap();
03195         if (pWBitmap!=NULL && !pWBitmap->HasBeenDeleted())
03196         {
03197             if (plpInfo)    *plpInfo = pWBitmap->BMInfo;
03198             if (plpBits)    *plpBits = pWBitmap->BMBytes;
03199             if (pRect)
03200             {
03201                 if (bDirect)
03202                     *pRect = m_rectDirectBitmap;
03203                 else
03204                 {
03205                     DocRect uprect = DocRect(m_PGram[0], m_PGram[0]);
03206                     uprect.IncludePoint(m_PGram[1]);
03207                     uprect.IncludePoint(m_PGram[2]);
03208                     uprect.IncludePoint(DocCoord(m_PGram[2].x+m_PGram[1].x-m_PGram[0].x, m_PGram[2].y+m_PGram[1].y-m_PGram[0].y));
03209                     *pRect = uprect;
03210                 }
03211             }
03212 
03213             return TRUE;
03214         }
03215     }
03216 
03217     return FALSE;
03218 }

virtual BOOL NodeLockedEffect::IsLockedEffect  )  [inline, virtual]
 

Reimplemented from NodeBitmapEffect.

Definition at line 432 of file nodeliveeffect.h.

00432 {return TRUE;}

void NodeLockedEffect::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/09/2004
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from NodeEffect.

Definition at line 3476 of file nodeliveeffect.cpp.

03477 {
03478     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
03479     ENSURE(IS_A(pNodeCopy, NodeLockedEffect), "PolyCopyNodeContents given wrong dest node type");
03480 
03481     if (IS_A(pNodeCopy, NodeLockedEffect))
03482         CopyNodeContents((NodeLockedEffect*)pNodeCopy);
03483 }

virtual BOOL NodeLockedEffect::PromoteHitTestOnChildrenToMe  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 407 of file nodeliveeffect.h.

00407 {return TRUE;}      // FALSE if normal effect

void NodeLockedEffect::Render RenderRegion pRender  )  [virtual]
 

Will render the liveeffect iff we have it cached - for hit detection reasons.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/2004
Parameters:
Pointer to a render region [INPUTS]

Reimplemented from NodeBitmapEffect.

Definition at line 3153 of file nodeliveeffect.cpp.

03154 {
03155     if (m_BitmapRef.GetBitmap()!=NULL && pRender->IsHitDetect())
03156     {
03157         CWxBitmap* pWBitmap = (CWxBitmap*)m_BitmapRef.GetBitmap()->GetActualBitmap();
03158         if (pWBitmap==NULL || pWBitmap->HasBeenDeleted())
03159             return;
03160 
03161         LPBITMAPINFO lpInfo = pWBitmap->BMInfo;
03162         LPBYTE lpBits = pWBitmap->BMBytes;
03163 #ifdef _DEBUG
03164         BOOL bRendered = pRender->RenderBits(lpInfo, lpBits, m_PGram, 3, TRUE, this);
03165         ERROR3IF(!bRendered, "How can something so simple fail to render?");
03166 #else
03167         pRender->RenderBits(lpInfo, lpBits, m_PGram, 3, TRUE, this);
03168 #endif
03169     }
03170 }

BOOL NodeLockedEffect::RenderCachedEffect CBitmapCache pBitmapCache,
RenderRegion pRender,
BOOL  bIgnoreCapture = FALSE
[protected, virtual]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/08/2005
Parameters:
- [INPUTS]
DocRect - rectangle of Processed bitmap in DirectBitmap space [OUTPUTS]
Returns:
TRUE if a rectangle was obtained successfully FALSE otherwise

Reimplemented from NodeBitmapEffect.

Definition at line 3336 of file nodeliveeffect.cpp.

03337 {
03338     BOOL bRendered = FALSE;
03339 
03340     // No need to render if we are going to supply to a capture
03341     Capture* pCapture = pRender->GetTopCapture();
03342     if (!bIgnoreCapture && pCapture && pCapture->ConsumeDirectBitmap(this))
03343     {
03344         // Tell the caller that the effect has been "rendered"
03345         bRendered = TRUE;
03346     }
03347     else
03348     {
03349         CWxBitmap* pWBitmap = (CWxBitmap*)m_BitmapRef.GetBitmap()->GetActualBitmap();
03350         if (pWBitmap==NULL || pWBitmap->HasBeenDeleted())
03351             return FALSE;
03352 
03353         LPBITMAPINFO lpInfo = pWBitmap->BMInfo;
03354         LPBYTE lpBits = pWBitmap->BMBytes;
03355         bRendered = pRender->RenderBits(lpInfo, lpBits, m_PGram, 3, TRUE, this);
03356         ENSURE(bRendered, "How can something so simple fail to render?");
03357     }
03358 
03359     return bRendered;
03360 }

void NodeLockedEffect::RenderObjectBlobs RenderRegion pRender  )  [virtual]
 

Renders the Object blobs for a Node Shape.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
??/1/2005
Parameters:
pRender - the region to render the blobs to [INPUTS]
See also:
BlobManager

Reimplemented from NodeRenderable.

Definition at line 3718 of file nodeliveeffect.cpp.

03719 {
03720 #if !defined(EXCLUDE_FROM_RALPH)
03721     ERROR3IF(!IsSelected(), "Who's asking us to render blobs when we're not selected?");
03722     // Set the line colours etc as we need them
03723     DocRect r = GetBoundingRect();
03724     pRender->SetLineColour(COLOUR_NONE);
03725     pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
03726 
03727     pRender->DrawBlob(r.lo, BT_UNSELECTED);
03728     pRender->DrawBlob(DocCoord(r.hi.x, r.lo.y), BT_UNSELECTED);
03729     pRender->DrawBlob(r.hi, BT_UNSELECTED);
03730     pRender->DrawBlob(DocCoord(r.lo.x, r.hi.y), BT_UNSELECTED);
03731 #endif
03732 }

SubtreeRenderState NodeLockedEffect::RenderSubtree RenderRegion pRender,
Node **  ppNextNode = NULL,
BOOL  bClip = TRUE
[virtual]
 

Do clever stuff on the way into a subtree, possibly modifying rendering behaviour.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004
Parameters:
pRender - The region render into (or use as context for decisions about subtree) [INPUTS] ppNextNode - Address of node pointer for next node to render or run to after this bClip - flag indicating whether to clip or not

Reimplemented from NodeEffect.

Definition at line 3069 of file nodeliveeffect.cpp.

03070 {
03071 //  BOOL bRendered = FALSE;
03072 
03073     if (pRender == NULL)                            // If no render region supplied, assume we need to be rendered
03074         return SUBTREE_ROOTANDCHILDREN;
03075 
03076     DocRect BoundingRect = GetBoundingRect();
03077     if (!BoundingRect.IsValid())
03078         return SUBTREE_ROOTANDCHILDREN;
03079 
03080     DocRect ClipRect = pRender->GetClipRect();
03081     if (m_BitmapRef.GetBitmap()!=NULL)
03082     {
03083         // Go find out about my bounding rectangle
03084         // If we don't have a cached bitmap then expand the bounding rect to ensure it will cover an expansion caused by the effect
03085         // If we do have a cached bitmap then use the bounding rect stored with the processed bitmap
03086 
03087         if (bClip && !ClipRect.IsIntersectedWith(BoundingRect)) // If not within the clipping rect then
03088             return SUBTREE_NORENDER;                    // Don't render us or our children
03089 
03090         KernelBitmap* pkBitmap = m_BitmapRef.GetBitmap();
03091         if (pkBitmap==NULL || pkBitmap->HasBeenDeleted())
03092             return SUBTREE_ROOTANDCHILDREN;
03093 
03094 #ifdef _DEBUG
03095         BOOL bRendered = RenderCachedEffect(NULL, pRender);
03096         ERROR3IF(!bRendered, "How can something so simple fail to render?");
03097 #else
03098         RenderCachedEffect(NULL, pRender);
03099 #endif
03100 
03101         return SUBTREE_NORENDER;
03102     }
03103 
03104     BoundingRect.Inflate((INT32)(GetPixelWidth()*150));                     // Bodge to ensure LE is rendered before it grows
03105     if (bClip && !ClipRect.IsIntersectedWith(BoundingRect)) // If not within the clipping rect then
03106         return SUBTREE_NORENDER;                    // Don't render us or our children
03107 
03108     // If we couldn't find or render a cached bitmap then try to cache a new one
03109 //  double PixelWidth = GetPixelWidth();
03110 
03111     // Work out how much of the object we propose to capture
03112     // (This may change during the Capture if we have to fall back to 24BPP opaque capture)
03113     DocRect viewrect = ClipRect;
03114     DocRect CaptureRect = GetChildBoundingRect();           // Make sure we get our child bound not result of processing!
03115 
03116     // Only cache if it's worth it!
03117     if (CanGenerateBitmap())
03118     {
03119         // It's quicker to scan ahead looking for non-mix transparency than to find it
03120         // half way through rendering a bitmap...
03121         //
03122         // Note that RenderAfterSubtree will only do anything if it finds this capture
03123         // (This is crucial because RenderCallback filtering might prevent RenderSubtree being
03124         //  called but it does not then also prevent RenderAfterSubtree being called for the
03125         //  same node)
03126         DocRect CaptureRect = GetChildBoundingRect();   // Make sure we get our child bound not result of processing!
03127         CaptureRect.Inflate(CAPTURE_BORDER*(INT32)GetPixelWidth());
03128         CaptureFlags caFlags = CaptureFlags(cfLOCKEDTRANSPARENT | cfFULLCOVERAGE | cfUNCLIP | (EnableDirectCapture() ? cfALLOWDIRECT : cfNONE));
03129         double dResolution = GetPixelsPerInch();
03130         //Capture* pCapture =
03131         pRender->StartCapture(this, CaptureRect, CAPTUREINFO(ctNESTABLE, caFlags), TRUE, FALSE, dResolution, GetInkNodeFromController());
03132 //      if (pCapture && pCapture->IsDirect())
03133 //          return SUBTREE_ROOTONLY;                // Capture gets bitmap directly from child so child does not need to be rendered
03134     } 
03135 
03136     return SUBTREE_ROOTANDCHILDREN;                 // We must render ourselves and our children
03137 }

void NodeLockedEffect::RenderTinyBlobs RenderRegion pRender  )  [virtual]
 

Renders the Tiny blobs for a Node Shape.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
??/1/2005
Parameters:
pRender - the region to render the blobs to [INPUTS]
See also:
BlobManager

Reimplemented from NodeRenderable.

Definition at line 3748 of file nodeliveeffect.cpp.

03749 {
03750 #if !defined(EXCLUDE_FROM_RALPH)
03751 //  ERROR3IF(!IsSelected(), "Who's asking us to render blobs when we're not selected?");
03752     // Set the line colours etc as we need them
03753     DocRect r = GetBoundingRect();
03754     pRender->SetLineColour(COLOUR_NONE);
03755     pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
03756 
03757     pRender->DrawBlob(r.hi, BT_UNSELECTED);
03758 #endif
03759 }

virtual void NodeLockedEffect::SetLockPermanence BOOL  bDestructive  )  [inline, virtual]
 

Definition at line 434 of file nodeliveeffect.h.

00434 {m_bIsDestructive = bDestructive;}

DocRect NodeLockedEffect::SetProcessedBitmap LPBITMAPINFO  lpInfo,
LPBYTE  lpBits,
DocRect  rect,
INT32  width,
INT32  height,
double  xOffset,
double  yOffset,
double  dPixelWidth = 0,
Matrix pmatTransform = NULL
[virtual]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/09/2004
Parameters:
- [INPUTS]
lpInfo - reference to LPBITMAPINFO pointer for bitmap info [OUTPUTS] lpBits - reference to LPBYTE pointer for bitmap data

Reimplemented from NodeBitmapEffect.

Definition at line 3233 of file nodeliveeffect.cpp.

03234 {
03235     BOOL bWasInvalidBounds = !IsBoundingRectValid;
03236 
03237     if (dPixelWidth==0)
03238         dPixelWidth = GetPixelWidth();
03239 
03240     if (rect.IsEmpty())
03241     {
03242         rect = GetChildBoundingRect();
03243         rect.Inflate(CAPTURE_BORDER*(INT32)dPixelWidth);
03244     }
03245 
03246     DocRect crect = AdjustPixelOffsets(rect, width, height, xOffset, yOffset, dPixelWidth);
03247     DocRect uprect = crect;
03248 
03249     // If we have a transform, then we must transform our coords before rendering
03250     DocCoord coords[3];
03251     coords[0] = crect.lo;
03252     coords[1] = DocCoord(crect.hi.x, crect.lo.y);
03253     coords[2] = DocCoord(crect.lo.x, crect.hi.y);
03254 
03255     if (pmatTransform)
03256     {
03257         pmatTransform->transform(coords, 3);
03258 
03259         // Get new upright bounding rect for transformed coords
03260         uprect = DocRect(coords[0], coords[0]);
03261         uprect.IncludePoint(coords[1]);
03262         uprect.IncludePoint(coords[2]);
03263         uprect.IncludePoint(DocCoord(coords[2].x+coords[1].x-coords[0].x, coords[2].y+coords[1].y-coords[0].y));
03264     }
03265 
03266     // Store locked bitmaps using the old style Kernel/OilBitmap technology
03267     // so that they are permanent and can be loaded and saved more easily
03268     m_BitmapRef.Detach();
03269     m_rectDirectBitmap = DocRect(0,0,0,0);
03270 
03271     if (lpInfo && lpBits)
03272     {
03273         // Create a Kernel bitmap from the bmp data.
03274         CWxBitmap* wBitmap      = new CWxBitmap(lpInfo, lpBits);
03275         if (wBitmap==NULL)
03276             return uprect;
03277         wBitmap->SetHidden(TRUE);           // We don't want the user to see this bitmap in the gallery
03278         KernelBitmap* kBitmap   = new KernelBitmap(wBitmap);
03279         if (kBitmap==NULL)
03280         {
03281             delete wBitmap;
03282             return uprect;
03283         }
03284 
03285         m_rectDirectBitmap = crect;
03286 
03287         Document* pDoc = Document::GetCurrent();
03288         BitmapList* pBmpList = pDoc->GetBitmapList();
03289         kBitmap->Attach(pBmpList);
03290 PORTNOTE("xpe", "NodeLockedEffect::SetProcessedBitmap - removed use of XPE")
03291 #if !defined(EXCLUDE_FROM_XARALX)
03292         XPEHost::GetEffectDetails(m_strPostProID, &m_strDisplayName);
03293 #endif
03294         String_256 strName(m_strDisplayName);
03295         kBitmap->SetName(strName);
03296         m_BitmapRef.Attach(kBitmap);
03297 
03298         IsBoundingRectValid = TRUE;         // URGH! Force InvalidateBoundingRect to go up parent links!
03299         InvalidateBoundingRect();           // Tell our parents that our bounds have changed
03300         BoundingRectangle = uprect;         // But we know our bounding rectangle now
03301         m_PGram[0] = coords[0];
03302         m_PGram[1] = coords[1];
03303         m_PGram[2] = coords[2];
03304         IsBoundingRectValid = TRUE;         // And we know that it's valid
03305 
03306         // If the processed bitmap is bigger than the original we must ensure the bounds are updated
03307         if (rect!=uprect || bWasInvalidBounds)
03308         {
03309             DocView* pView = DocView::GetCurrent();
03310             if (pView)
03311                 pView->NotifyBoundsChanged();
03312         }
03313     }
03314 
03315     // Note! Leave bounds alone if not setting processed bitmap
03316     return uprect;
03317 }

Node * NodeLockedEffect::SimpleCopy void   )  [virtual]
 

This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/09/2004
Parameters:
- [INPUTS]
[OUTPUTS] 
Returns:
A copy of the node, or NULL if memory has run out

Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory error and the function returns NULL.

Reimplemented from NodeEffect.

Definition at line 3413 of file nodeliveeffect.cpp.

03414 {
03415     NodeLockedEffect* NodeCopy; 
03416     NodeCopy = new NodeLockedEffect();
03417     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
03418     CopyNodeContents(NodeCopy);         
03419     return (NodeCopy);
03420 }   

void NodeLockedEffect::Transform TransformBase Trans  )  [virtual]
 

Transforms the LiveEffect node.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/09/2004
Parameters:
Trans - The transform Object [INPUTS]
See also:
NodeRenderableInk::Transform()

Reimplemented from NodeRenderableBounded.

Definition at line 3532 of file nodeliveeffect.cpp.

03533 {
03534     // Transform the DocCoords of the parallelogram
03535     Trans.Transform(m_PGram, 3);
03536 
03537     InvalidateBoundingRect();
03538 
03539     // Transform all the children...
03540     if (Trans.bTransformYourChildren)
03541         TransformChildren(Trans);
03542     else
03543         TransformEffectAttrs(Trans);
03544 }

void NodeLockedEffect::UnlinkNodeFromTree BaseDocument pOwnerDoc = NULL  )  [virtual]
 

Pre-Destructor Do smart tidy up of bitmap usage if we are being deleted from the tree rather than simply unlinked temporarilly (signalled by pOwnerDoc being non-null) Note:.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/09/2005
See also:

Reimplemented from Node.

Definition at line 2936 of file nodeliveeffect.cpp.

02937 {
02938     KernelBitmap* pOldBitmap = m_BitmapRef.GetBitmap();
02939     if (pOldBitmap && pOwnerDoc)
02940     {
02941         m_BitmapRef.Detach();       // Detach so that Enumerate function below returns NULL and OilBitmap::IsUsedInDocument operates correctly
02942 
02943         BitmapList* pBmpList = pOldBitmap->GetParentBitmapList();
02944         if (pBmpList)
02945         {
02946             if (pOwnerDoc && pOwnerDoc->IsKindOf(CC_RUNTIME_CLASS(Document)))
02947             {
02948                 Document* pBitmapDoc = (Document*)pOwnerDoc;
02949                 if (pBitmapDoc && !pOldBitmap->IsUsedInDocument(pBitmapDoc, TRUE))
02950                 {
02951                     pOldBitmap->Detach();
02952                     BROADCAST_TO_ALL(BitmapListChangedMsg(pBmpList, pOldBitmap));
02953                     delete pOldBitmap;
02954 
02955                     // Free up any unused bitmaps in the global list
02956                     // (just deleting the KernelBitmaps doesn't seem to do it)
02957                     Camelot.GetGlobalBitmapList()->DeleteAllUnusedBitmaps();
02958                 }
02959             }
02960         }
02961     }
02962 
02963     // Call base class
02964     NodeBitmapEffect::UnlinkNodeFromTree(pOwnerDoc);
02965 }

BOOL NodeLockedEffect::WriteLockedEffect BaseCamelotFilter pFilter  )  [protected, virtual]
 

Writes the path record to the filter.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/09/2004
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Definition at line 3621 of file nodeliveeffect.cpp.

03622 {
03623 #ifdef DO_EXPORT
03624     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03625 
03626     BOOL ok = TRUE;
03627     BYTE Flags = 0;
03628     if (!m_bIsDestructive)      Flags |= 0x02;          // Flag set when NOT destructive for back-compatibility
03629 
03630     // Find the kernel bmp
03631     KernelBitmap* pBmp = m_BitmapRef.GetBitmap();
03632     ERROR2IF(pBmp == NULL, FALSE, "NULL kernel bitmap in WriteLockedEffect");
03633 
03634     // Must write out the bitmap first
03635     INT32 BitmapRecordRef = pFilter->WriteRecord(pBmp);
03636     ERROR2IF(BitmapRecordRef == 0, FALSE, "Bitmap ref is zero in WriteLockedEffect");
03637 
03638     // Is the bmp reference ok?
03639     if (ok) ok = (BitmapRecordRef != 0);
03640         
03641     UINT32 Tag = TAG_LOCKED_EFFECT;
03642 
03643     CXaraFileRecord Rec(Tag);
03644 
03645 PORTNOTETRACE("other","NodeLockedEffect::WriteLockedEffect - removed use of XML");
03646 #ifndef EXCLUDE_FROM_XARALX
03647     BSTR bstrValue;
03648     HRESULT hr;
03649     hr = m_pEditsDoc->get_xml(&bstrValue);
03650     ok = (SUCCEEDED(hr));
03651 #endif
03652     if (ok) ok = Rec.Init();
03653     if (ok) ok = Rec.WriteBYTE(Flags);                  // flags
03654     if (ok) ok = Rec.WriteDOUBLE(m_dPixelsPerInch);     // Resolution
03655     if (ok) ok = Rec.WriteReference(BitmapRecordRef);   // Bitmap Record Reference
03656     if (ok) ok = Rec.WriteCoordTrans(m_PGram[0], 0, 0); // Coords
03657     if (ok) ok = Rec.WriteCoordTrans(m_PGram[1], 0, 0);
03658     if (ok) ok = Rec.WriteCoordTrans(m_PGram[2], 0, 0);
03659     if (ok) ok = Rec.WriteUnicode(m_strPostProID);      // Effect ID
03660     if (ok) ok = Rec.WriteUnicode(m_strDisplayName);    // Display Name
03661     if (ok) ok = Rec.WriteUTF16STR(m_vstrEdits);        // UNICODE xml string edits list
03662 
03663     // Write the record
03664     if (ok) ok = pFilter->Write(&Rec);
03665 
03666     return ok;
03667 #else
03668     return FALSE;
03669 #endif
03670 }

BOOL NodeLockedEffect::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Writes the path record to the filter.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/09/2004
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Reimplemented from Node.

Definition at line 3590 of file nodeliveeffect.cpp.

03591 {
03592 #ifdef DO_EXPORT
03593 
03594     BOOL ok = TRUE;
03595 
03596     ok = WriteLockedEffect(pFilter);
03597 
03598     return ok;
03599 
03600 #else
03601     return FALSE;
03602 #endif
03603 }

BOOL NodeLockedEffect::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes the path record to the filter.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/09/2004
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Reimplemented from Node.

Definition at line 3562 of file nodeliveeffect.cpp.

03563 {
03564 #ifdef DO_EXPORT
03565 
03566     BOOL ok = TRUE;
03567 
03568     ok = WriteLockedEffect(pFilter);
03569 
03570     return ok;
03571 
03572 #else
03573     return FALSE;
03574 #endif
03575 }


Friends And Related Function Documentation

friend class LiveEffectRecordHandler [friend]
 

Reimplemented from NodeBitmapEffect.

Definition at line 381 of file nodeliveeffect.h.


Member Data Documentation

BOOL NodeLockedEffect::m_bIsDestructive [private]
 

Definition at line 447 of file nodeliveeffect.h.

KernelBitmapRef NodeLockedEffect::m_BitmapRef [private]
 

Definition at line 445 of file nodeliveeffect.h.

DocCoord NodeLockedEffect::m_PGram[3] [private]
 

Definition at line 446 of file nodeliveeffect.h.


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