NodeFeatherEffect Class Reference

Feather effects are specialised types of LiveEffect. More...

#include <nodeliveeffect.h>

Inheritance diagram for NodeFeatherEffect:

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

Public Member Functions

 NodeFeatherEffect ()
 Note:.
 ~NodeFeatherEffect ()
 Destructor Note:.
 NodeFeatherEffect (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 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 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 ProcessBitmap (RenderRegion *pRender, CBitmapCache *pBitmapCache, LPBITMAPINFO pBMPInfo, LPBYTE pBMPBits, DocRect BMPRect, LPBITMAPINFO &pOutputInfo, LPBYTE &pOutputBits, double *pXOffset, double *pYOffset)
 Processes the bitmap produced by the children of this node. Can be overridden by derived classes to perform special processing.
virtual BOOL FindCachedEffect (CBitmapCache *pBitmapCache)
 Find all cached items this node needs to call RenderCachedEffect succesfully Feathers need two bitmaps - captured objects and feather mask.
virtual BOOL RenderCachedEffect (CBitmapCache *pBitmapCache, RenderRegion *pRenderRegion, BOOL bIgnoreCapture=FALSE)
 Render the cached version of this node Feathers need two bitmaps - captured objects and feather mask.
virtual BOOL CompareState (NodeEffect *pPPNode)
 Return details of direct bitmap to caller (caller is usually a NodeBitmapEffect)-.
virtual BOOL IsFeatherEffect ()
virtual BOOL CanSupplyDirectBitmap ()
virtual BOOL EnableDirectCapture ()
 Determine whether this effect can do a direct capture of its child node(s) or whether it needs to do a normal, rendering capture. At the moment, this depends solely on whether the DirectBitmap supplier can supply a bitmap at the same resolution as this effect requires.
virtual void SetFeatherSize (MILLIPOINT newFeatherSize)
virtual MILLIPOINT GetFeatherSize () const
virtual void SetProfile (CProfileBiasGain newProfile)
virtual CProfileBiasGain GetProfile () const

Protected Member Functions

virtual BOOL WriteFeatherEffect (BaseCamelotFilter *pFilter)
 Writes the path record to the filter.
BOOL CreateBitmapTranspFill (KernelBitmap *pFeather, DocCoord *pCoords, BitmapTranspFillAttribute *BmpTranspFill)
 Render the cached version of this node Feathers need two bitmaps - captured objects and feather mask.
void CopyNodeContents (NodeFeatherEffect *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.
virtual BOOL GetQuickRender ()
 


Private Member Functions

 CC_DECLARE_DYNCREATE (NodeFeatherEffect)

Static Private Member Functions

static BOOL ProcessBitmap (LPBITMAPINFO pBMPInfo, LPBYTE pBMPBits, double dPixBlurDiameter, CProfileBiasGain profileFeather)
 Processes the bitmap produced by the children of this node. Can be overridden by derived classes to perform special processing.

Private Attributes

CProfileBiasGain m_Profile
MILLIPOINT m_FeatherSize

Friends

class LiveEffectRecordHandler
class OpLiveEffect

Detailed Description

Feather effects are specialised types of LiveEffect.

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

Definition at line 463 of file nodeliveeffect.h.


Constructor & Destructor Documentation

NodeFeatherEffect::NodeFeatherEffect  ) 
 

Note:.

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

Definition at line 3872 of file nodeliveeffect.cpp.

03872                                      : NodeLiveEffect()
03873 {
03874 //  m_Profile = CProfileBiasGain()              // Defaults to this
03875     m_FeatherSize = 0;                          // Document base Feather has 0 feather size.
03876                                                 // The doc base feather is created when camelot
03877                                                 // initialises a new document.
03878                                                 // The default feather applied to each new object
03879                                                 // is also setup by this constructor.
03880 }

NodeFeatherEffect::~NodeFeatherEffect  ) 
 

Destructor Note:.

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

Definition at line 3896 of file nodeliveeffect.cpp.

03897 {
03898     CBitmapCache* pBitmapCache = Camelot.GetBitmapCache();
03899     if (pBitmapCache!=NULL)
03900     {
03901         CBitmapCacheKey inky(this, 42);
03902         pBitmapCache->RemoveAllOwnedBitmaps(inky, FALSE, CACHEPRIORITY_PERMANENT);
03903     }
03904 }

NodeFeatherEffect::NodeFeatherEffect 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:
24/11/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 3842 of file nodeliveeffect.cpp.

03848                 : NodeLiveEffect(ContextNode, Direction, Locked, Mangled, Marked, Selected )
03849 {                         
03850 //  m_Profile = CProfileBiasGain()              // Defaults to this
03851     m_FeatherSize = 0;                          // Document base Feather has 0 feather size.
03852                                                 // The doc base feather is created when camelot
03853                                                 // initialises a new document.
03854                                                 // The default feather applied to each new object
03855                                                 // is also setup by this constructor.
03856 }                        


Member Function Documentation

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

Reimplemented from NodeBitmapEffect.

Definition at line 509 of file nodeliveeffect.h.

00509 {return FALSE;}

NodeFeatherEffect::CC_DECLARE_DYNCREATE NodeFeatherEffect   )  [private]
 

BOOL NodeFeatherEffect::CompareState NodeEffect pPPNode  )  [virtual]
 

Return details of direct bitmap to caller (caller is usually a NodeBitmapEffect)-.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/03/2005
Returns:
TRUE if this state matches the state (and type) of the supplied node

Reimplemented from NodeBitmapEffect.

Definition at line 4670 of file nodeliveeffect.cpp.

04671 {
04672     if (!pPPNode->IsFeatherEffect())
04673         return FALSE;
04674 
04675     NodeFeatherEffect* pTest = (NodeFeatherEffect*)pPPNode;
04676 
04677     BOOL bSame = m_FeatherSize == pTest->m_FeatherSize;
04678     bSame = bSame && m_Profile == pTest->m_Profile;
04679 
04680     return bSame;
04681 }

void NodeFeatherEffect::CopyNodeContents NodeFeatherEffect 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:
24/11/2004
Parameters:
pCopyOfNode - The node to copy data to [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
NodeGroup::CopyNodeContents

Definition at line 3985 of file nodeliveeffect.cpp.

03986 {
03987     NodeLiveEffect::CopyNodeContents(pCopyOfNode);
03988 
03989     // Copy member vars here
03990     pCopyOfNode->m_FeatherSize = m_FeatherSize;
03991     pCopyOfNode->m_Profile = m_Profile;
03992 }

BOOL NodeFeatherEffect::CreateBitmapTranspFill KernelBitmap pFeather,
DocCoord pCoords,
BitmapTranspFillAttribute BmpTranspFill
[protected]
 

Render the cached version of this node Feathers need two bitmaps - captured objects and feather mask.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/01/2005
Parameters:
- [INPUTS]
- [OUTPUTS]

Definition at line 4403 of file nodeliveeffect.cpp.

04404 {
04405     // Transp fill is same size as viewable part of the bitmap 
04406     BmpTranspFill->StartPoint = pCoords[0];
04407     BmpTranspFill->EndPoint   = pCoords[1];
04408     BmpTranspFill->EndPoint2    = pCoords[2];
04409     BmpTranspFill->EndPoint3    = DocCoord(pCoords[1].x, pCoords[2].y);
04410     BmpTranspFill->GetBitmapRef()->SetBitmap(pFeather);
04411     BmpTranspFill->Transp = 0;
04412     BmpTranspFill->EndTransp = 255;
04413     m_Profile.SetIsAFeatherProfile(TRUE);       // enable extra processing on the profile
04414     BmpTranspFill->SetProfile(m_Profile);
04415 
04416     return TRUE;
04417 }

String NodeFeatherEffect::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:
24/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 NodeLiveEffect.

Definition at line 3929 of file nodeliveeffect.cpp.

03930 {
03931     if (Plural)
03932         return(String(_R(IDS_FEATHEREFFECT_DESCRP)));
03933     else
03934         return(String(_R(IDS_FEATHEREFFECT_DESCRS)));
03935 };

virtual BOOL NodeFeatherEffect::EnableDirectCapture  )  [inline, virtual]
 

Determine whether this effect can do a direct capture of its child node(s) or whether it needs to do a normal, rendering capture. At the moment, this depends solely on whether the DirectBitmap supplier can supply a bitmap at the same resolution as this effect requires.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/08/2005
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from NodeBitmapEffect.

Definition at line 510 of file nodeliveeffect.h.

00510 {return FALSE;}

BOOL NodeFeatherEffect::FindCachedEffect CBitmapCache pBitmapCache  )  [virtual]
 

Find all cached items this node needs to call RenderCachedEffect succesfully Feathers need two bitmaps - captured objects and feather mask.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/11/2004
Parameters:
- [INPUTS]
- [OUTPUTS]

Reimplemented from NodeBitmapEffect.

Definition at line 4259 of file nodeliveeffect.cpp.

04260 {
04261     BOOL bFoundCached = FALSE;
04262     CCachedBitmap cbmp;
04263 
04264     // TODO: Call GetChildDirectBitmap here?
04265     CBitmapCacheKey inky(this, GetPixelWidth(), 0);                     // Get cached BMP for this ORIGINAL node at our dpi
04266     bFoundCached = pBitmapCache->Lookup(inky, cbmp);
04267 //  bFoundCached = GetOriginalBitmap();
04268 
04269     CBitmapCacheKey inky2(this, GetPixelWidth(), 1);                    // Get cached BMP for this PROCESSED FEATHER node at our dpi
04270     bFoundCached = bFoundCached & pBitmapCache->Lookup(inky2, cbmp);
04271 
04272     return bFoundCached;
04273 }

virtual MILLIPOINT NodeFeatherEffect::GetFeatherSize  )  const [inline, virtual]
 

Definition at line 516 of file nodeliveeffect.h.

00516 {return m_FeatherSize;}

UINT32 NodeFeatherEffect::GetNodeSize  )  const [virtual]
 

For finding the size of the node.

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

Reimplemented from NodeLiveEffect.

Definition at line 4036 of file nodeliveeffect.cpp.

04037 {     
04038     return sizeof(NodeFeatherEffect);
04039 }  

virtual CProfileBiasGain NodeFeatherEffect::GetProfile  )  const [inline, virtual]
 

Definition at line 518 of file nodeliveeffect.h.

00518 {return m_Profile;}

BOOL NodeFeatherEffect::GetQuickRender  )  [protected, virtual]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/03/2005
Returns:
TRUE if this feather effect should not start new captures at the minute

Reimplemented from NodeBitmapEffect.

Definition at line 4696 of file nodeliveeffect.cpp.

04697 {
04698     if (Operation::GetQuickRender(this)==FALSE)
04699         return FALSE;
04700 
04701     // Operation wants us to be quick but if it's a feather editing op
04702     // then we've got to re-render anyway!
04703     // Urgh! This is getting tortuous...
04704 PORTNOTE("effects", "NodeFeatherEffect::GetQuickRender - removed OpChangeFeatherSize usage.");
04705 #if defined(EXCLUDE_FROM_XARALX)
04706     return FALSE;
04707 #else
04708     Operation* pOp = Operation::GetCurrentDragOp();
04709     return (pOp!=NULL && !pOp->IsKindOf(CC_RUNTIME_CLASS(OpChangeFeatherSize)));
04710 #endif
04711 }

virtual BOOL NodeFeatherEffect::IsFeatherEffect  )  [inline, virtual]
 

Reimplemented from NodeEffect.

Definition at line 508 of file nodeliveeffect.h.

00508 {return TRUE;}

void NodeFeatherEffect::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 NodeLiveEffect.

Definition at line 4009 of file nodeliveeffect.cpp.

04010 {
04011     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
04012     ENSURE(IS_A(pNodeCopy, NodeFeatherEffect), "PolyCopyNodeContents given wrong dest node type");
04013 
04014     if (IS_A(pNodeCopy, NodeFeatherEffect))
04015         CopyNodeContents((NodeFeatherEffect*)pNodeCopy);
04016 }

BOOL NodeFeatherEffect::ProcessBitmap RenderRegion pRender,
CBitmapCache pBitmapCache,
LPBITMAPINFO  pBMPInfo,
LPBYTE  pBMPBits,
DocRect  BMPRect,
LPBITMAPINFO pOutputInfo,
LPBYTE pOutputBits,
double *  pXOffset,
double *  pYOffset
[virtual]
 

Processes the bitmap produced by the children of this node. Can be overridden by derived classes to perform special processing.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/11/2004
Returns:

Reimplemented from NodeBitmapEffect.

Definition at line 4168 of file nodeliveeffect.cpp.

04177 {
04178     pOutputInfo = NULL;
04179     pOutputBits = NULL;
04180     *pXOffset = 0;
04181     *pYOffset = 0;
04182 
04184     //  Create the feather bitmap transparency mask.
04186 
04187     // 1. Extract a mask from the RGBT input bitmap
04188     // 2. Contour inwards by half the blur diameter
04189     // 3. Blur by blur diameter
04190 
04191     double dPixBlurDiameter = (double)m_FeatherSize/GetPixelWidth();
04192     double dRemainingContour = dPixBlurDiameter/2;
04193     double dContourStep = 20;
04194 
04195     if (dPixBlurDiameter<1)
04196         return TRUE;
04197 
04198     // Initialise the processing pipeline state
04199     ProcessBitmapState bmpstate(pBMPInfo, pBMPBits, 0, 0, FALSE);
04200 //                                          DEBUGATTACH(bmpstate, "Feather Capture");
04201 
04202     // ----------------------------------
04203     // This is the processing pipeline
04204     // Note that contouring is sped up by doing it in steps of 20 pixels or less
04205     //
04206     // At each step:
04207     //  * Transform one state to the next (inside the function),
04208     //  * Record the new state (assign result to bmpstate)
04209     //  * Delete previous temp state (inside ProcessBitmapState assignment operator)
04210     //
04211     bmpstate = bmpstate.Create8BPPMask();
04212 //                                          DEBUGATTACH(bmpstate, "Feather Mask");
04213 
04214 //  bmpstate = bmpstate.Contour8BPP(-dPixBlurDiameter/2);
04215     while (dRemainingContour>0)
04216     {
04217         if (dContourStep>dRemainingContour) dContourStep = dRemainingContour;
04218         bmpstate = bmpstate.Contour8BPP(-dContourStep);
04219 //                                          DEBUGATTACH(bmpstate, "Feather Contour");
04220         dRemainingContour -= dContourStep;
04221     }
04222 //  bmpstate = bmpstate.Expand8BPP((INT32)(dPixBlurDiameter+1), 0xFF);
04223     UINT32 uBlurDiameter = UINT32(dPixBlurDiameter+0.5)-1 ;
04224     bmpstate = bmpstate.Expand8BPP(uBlurDiameter, 0xFF);
04225 //                                          DEBUGATTACH(bmpstate, "Feather Expand");
04226     bmpstate = bmpstate.Blur8BPP(dPixBlurDiameter);
04227 //                                          DEBUGATTACH(bmpstate, "Feather Blur");
04228     // ----------------------------------
04229 
04230     // If the final state is OK Extract the results from the pipeline
04231     if (bmpstate.IsOK())
04232     {
04233         bmpstate.GetPixelOffsets(pXOffset, pYOffset);
04234         bmpstate.GetBitmap(pOutputInfo, pOutputBits);       // (Makes final bitmap "permanent")
04235     }
04236     else
04237         bmpstate.DeInit();
04238 
04239     return bmpstate.IsOK();
04240 }

BOOL NodeFeatherEffect::ProcessBitmap LPBITMAPINFO  pBMPInfo,
LPBYTE  pBMPBits,
double  dPixBlurDiameter,
CProfileBiasGain  profileFeather
[static, private]
 

Processes the bitmap produced by the children of this node. Can be overridden by derived classes to perform special processing.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/11/2004
Returns:

Definition at line 4436 of file nodeliveeffect.cpp.

04440 {
04441     LPBITMAPINFO pOutputInfo = NULL;
04442     LPBYTE pOutputBits = NULL;
04443 //  double XOffset = 0;
04444 //  double YOffset = 0;
04445 
04447     //  Create the feather bitmap transparency mask.
04449 
04450     // 1. Extract a mask from the RGBT input bitmap
04451     // 2. Contour inwards by half the blur diameter
04452     // 3. Blur by blur diameter
04453 
04454     dPixBlurDiameter = floor(dPixBlurDiameter+0.5);
04455     double dRemainingContour = dPixBlurDiameter/2;
04456     double dContourStep = 20;
04457 
04458     if (dPixBlurDiameter<1)
04459         return TRUE;
04460 
04461     // Initialise the processing pipeline state
04462     ProcessBitmapState bmpstate(pBMPInfo, pBMPBits, 0, 0, FALSE);
04463 //                                          DEBUGATTACH(bmpstate, "Feather Capture");
04464 
04465     // ----------------------------------
04466     // This is the processing pipeline
04467     // Note that contouring is sped up by doing it in steps of 20 pixels or less
04468     //
04469     // At each step:
04470     //  * Transform one state to the next (inside the function),
04471     //  * Record the new state (assign result to bmpstate)
04472     //  * Delete previous temp state (inside ProcessBitmapState assignment operator)
04473     //
04474     bmpstate = bmpstate.Create8BPPMask();
04475 //                                          DEBUGATTACH(bmpstate, "Feather Mask");
04476 
04477 //  bmpstate = bmpstate.Contour8BPP(-dPixBlurDiameter/2);
04478     while (dRemainingContour>0)
04479     {
04480         if (dContourStep>dRemainingContour) dContourStep = dRemainingContour;
04481         bmpstate = bmpstate.Contour8BPP(-dContourStep);
04482 //                                          DEBUGATTACH(bmpstate, "Feather Contour");
04483         dRemainingContour -= dContourStep;
04484     }
04485 //  bmpstate = bmpstate.Expand8BPP((INT32)(dPixBlurDiameter+1), 0xFF);
04486     UINT32 uBlurDiameter = UINT32(dPixBlurDiameter+0.5)-1 ;
04487     bmpstate = bmpstate.Expand8BPP(uBlurDiameter, 0xFF);
04488 //                                          DEBUGATTACH(bmpstate, "Feather Expand");
04489     bmpstate = bmpstate.Blur8BPP(dPixBlurDiameter);
04490 //                                          DEBUGATTACH(bmpstate, "Feather Blur");
04491     bmpstate = bmpstate.AddMaskTo(pBMPInfo, pBMPBits);
04492 //                                          DEBUGATTACH(bmpstate, "Feathered Bitmap");
04493     // ----------------------------------
04494 
04495     // If the final state is OK Extract the results from the pipeline
04496     if (bmpstate.IsOK())
04497     {
04498 //      bmpstate.GetPixelOffsets(pXOffset, pYOffset);
04499         bmpstate.GetBitmap(pOutputInfo, pOutputBits);       // (Makes final bitmap "permanent")
04500     }
04501     else
04502         bmpstate.DeInit();
04503 
04504     return bmpstate.IsOK();
04505 }

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

Render the cached version of this node Feathers need two bitmaps - captured objects and feather mask.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/11/2004
Parameters:
- [INPUTS]
- [OUTPUTS]

Reimplemented from NodeBitmapEffect.

Definition at line 4291 of file nodeliveeffect.cpp.

04292 {
04293     BOOL bRendered = FALSE;
04294     BOOL bFoundCached = FALSE;
04295 
04296     // TODO: Call GetChildDirectBitmap here?
04297     CBitmapCacheKey inky(this, GetPixelWidth(), 0);                     // Get cached BMP for this ORIGINAL node at our dpi
04298     CCachedBitmap cbmp;
04299     bFoundCached = pBitmapCache->Lookup(inky, cbmp);
04300 //  LPBITMAPINFO lpOriginalInfo = NULL;
04301 //  LPBYTE lpOriginalBits = NULL;
04302 //  bFoundCached = GetOriginalBitmap();
04303 
04304     CBitmapCacheKey inky2(this, GetPixelWidth(), 1);                    // Get cached BMP for this PROCESSED FEATHER node at our dpi
04305     CCachedBitmap cbmpFeather;
04306     bFoundCached = bFoundCached & pBitmapCache->Lookup(inky2, cbmpFeather);
04307 
04308     if (bFoundCached)
04309     {
04310         // No need to render if we are going to supply to a capture
04311         Capture* pCapture = pRender->GetTopCapture();
04312         if (!bIgnoreCapture && pCapture && pCapture->ConsumeDirectBitmap(this))
04313         {
04314             // Tell the caller that the effect has been "rendered"
04315             bRendered = TRUE;
04316         }
04317         else
04318         {
04319             pRender->SaveContext();
04320 
04321 //#ifdef DEBUG
04322 //      bRendered = pRender->RenderBits(cbmpFeather.pbmpInfo, cbmpFeather.pbmpBits, &cbmpFeather.coord0, 3);
04323 //#endif
04324 
04325             CWxBitmap* wFeatherBitmap       = new CWxBitmap(cbmpFeather.pbmpInfo, cbmpFeather.pbmpBits);
04326             KernelBitmap* kFeatherBitmap    = new KernelBitmap(wFeatherBitmap,TRUE);
04327             if (kFeatherBitmap->GetBPP()==8)
04328             {
04329                 LPRGBQUAD pPalette = kFeatherBitmap->GetPaletteForBitmap();
04330                 for ( INT32 i=0 ; i<0x100 ; i++ )
04331                     (UINT32&)pPalette[i] = i*0x010101 ;
04332                     
04333                 kFeatherBitmap->SetAsGreyscale();
04334             }
04335 
04336             BitmapTranspFillAttribute* pBmpTranspFill = new BitmapTranspFillAttribute;
04337             TranspFillMappingLinearAttribute* pNoRepeatAttr = new TranspFillMappingLinearAttribute;
04338             if (kFeatherBitmap != NULL)
04339             {
04340                 pNoRepeatAttr->Repeat = 0;
04341                 pRender->SetTranspFillMapping(pNoRepeatAttr, TRUE);     // Temp, attribute will be deleted when unused
04342 
04343                 CreateBitmapTranspFill(kFeatherBitmap, &cbmpFeather.coord0, pBmpTranspFill);
04344                 pRender->SetTranspFillGeometry(pBmpTranspFill, TRUE);   // Temp, attribute will be deleted when unused
04345             }
04346 
04347             // URGH!    We're using transparency attr to implement feather
04348             // BUT      The user might want to apply an effect transparency attribute as well...
04349             // SO       We must capture the results of our feather transp, then apply the effect attrs
04350             if (!this->HasEffectAttrs())
04351                 // Simple, just render it as we always intended...
04352                 bRendered = pRender->RenderBits(cbmp.pbmpInfo, cbmp.pbmpBits, &cbmp.coord0, 3, FALSE, NULL);
04353             else
04354             {
04355                 // Tricky, capture feather transp, then apply effect attrs...
04356                 pRender->SaveContext();
04357 
04358                 LPBITMAPINFO lpCapturedInfo = NULL;
04359                 LPBYTE lpCapturedBits = NULL;
04360                 CaptureFlags caFlags = CaptureFlags(cfLOCKEDTRANSPARENT | cfUNCLIP | cfPIXWIDTHSCALE);
04361                 DocRect CaptureRect = GetBoundingRect();
04362                 pRender->StartCapture(this, CaptureRect, CAPTUREINFO(ctNESTABLE, caFlags), TRUE, FALSE, 0);
04363                 bRendered = pRender->RenderBits(cbmp.pbmpInfo, cbmp.pbmpBits, &cbmp.coord0, 3, FALSE, NULL);
04364                 pRender->StopCapture(this, FALSE, FALSE, &lpCapturedInfo, &lpCapturedBits, &CaptureRect);
04365 
04366                 pRender->RestoreContext();
04367 
04368                 if (bRendered && lpCapturedInfo && lpCapturedBits)
04369                 {
04370                     // Now render the bitmap we just captured using the effect attrs that are applied   vvvv
04371                     bRendered = pRender->RenderBits(lpCapturedInfo, lpCapturedBits, CaptureRect, FALSE, this);
04372                     FreeDIB(lpCapturedInfo, lpCapturedBits);
04373                 }
04374             }
04375 
04376             if (wFeatherBitmap)
04377                 wFeatherBitmap->BMBytes = ((CWxBitmap*)OILBitmap::Default)->BMBytes;
04378             if (kFeatherBitmap)
04379                 delete kFeatherBitmap;
04380 
04381             pRender->RestoreContext();
04382         }
04383     }
04384 
04385     return bRendered;
04386 }

virtual void NodeFeatherEffect::SetFeatherSize MILLIPOINT  newFeatherSize  )  [inline, virtual]
 

Definition at line 515 of file nodeliveeffect.h.

00515 {m_FeatherSize = newFeatherSize;}

virtual void NodeFeatherEffect::SetProfile CProfileBiasGain  newProfile  )  [inline, virtual]
 

Definition at line 517 of file nodeliveeffect.h.

00517 {m_Profile = newProfile;}

Node * NodeFeatherEffect::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:
24/11/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 NodeLiveEffect.

Definition at line 3957 of file nodeliveeffect.cpp.

03958 {
03959     NodeFeatherEffect* NodeCopy; 
03960     NodeCopy = new NodeFeatherEffect();
03961     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
03962     CopyNodeContents(NodeCopy);         
03963     return (NodeCopy);
03964 }   

BOOL NodeFeatherEffect::WriteFeatherEffect BaseCamelotFilter pFilter  )  [protected, virtual]
 

Writes the path record to the filter.

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

Definition at line 4116 of file nodeliveeffect.cpp.

04117 {
04118 #ifdef DO_EXPORT
04119     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
04120 
04121     BOOL ok = TRUE;
04122     BYTE Flags = 0;
04123 
04124     UINT32 Tag = TAG_FEATHER_EFFECT;
04125 
04126     CXaraFileRecord Rec(Tag);
04127 
04128     if (ok) ok = Rec.Init();
04129     if (ok) ok = Rec.WriteBYTE(Flags);                  // flags
04130     if (ok) ok = Rec.WriteDOUBLE(m_dPixelsPerInch);     // Resolution
04131     if (ok) ok = Rec.WriteUnicode(m_strPostProID);      // Effect ID
04132     if (ok) ok = Rec.WriteUnicode(m_strDisplayName);    // Display Name
04133     if (ok) ok = Rec.WriteINT32(m_FeatherSize);         // MILLIPOINT Feather size
04134     if (ok) ok = Rec.WriteDOUBLE((double)m_Profile.GetBias());  // Profile Bias
04135     if (ok) ok = Rec.WriteDOUBLE((double)m_Profile.GetGain());  // Profile Gain
04136 
04137     // Write the record
04138     if (ok) ok = pFilter->Write(&Rec);
04139 
04140     return ok;
04141 #else
04142     return FALSE;
04143 #endif
04144 }

BOOL NodeFeatherEffect::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 NodeLiveEffect.

Definition at line 4085 of file nodeliveeffect.cpp.

04086 {
04087 #ifdef DO_EXPORT
04088 
04089     BOOL ok = TRUE;
04090 
04091     ok = WriteFeatherEffect(pFilter);
04092 
04093     return ok;
04094 
04095 #else
04096     return FALSE;
04097 #endif
04098 }

BOOL NodeFeatherEffect::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 NodeLiveEffect.

Definition at line 4057 of file nodeliveeffect.cpp.

04058 {
04059 #ifdef DO_EXPORT
04060 
04061     BOOL ok = TRUE;
04062 
04063     ok = WriteFeatherEffect(pFilter);
04064 
04065     return ok;
04066 
04067 #else
04068     return FALSE;
04069 #endif
04070 }


Friends And Related Function Documentation

friend class LiveEffectRecordHandler [friend]
 

Reimplemented from NodeLiveEffect.

Definition at line 468 of file nodeliveeffect.h.

friend class OpLiveEffect [friend]
 

Definition at line 469 of file nodeliveeffect.h.


Member Data Documentation

MILLIPOINT NodeFeatherEffect::m_FeatherSize [private]
 

Definition at line 530 of file nodeliveeffect.h.

CProfileBiasGain NodeFeatherEffect::m_Profile [private]
 

Definition at line 529 of file nodeliveeffect.h.


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