FeatherAttrValue Class Reference

#include <fthrattr.h>

Inheritance diagram for FeatherAttrValue:

OffscreenAttrValue GeometryLinkedAttrValue AttributeValue CCObject SimpleCCObject List of all members.

Public Member Functions

 FeatherAttrValue ()
 ~FeatherAttrValue ()
virtual void SimpleCopy (AttributeValue *)
virtual NodeAttributeMakeNode ()
 Used when restoring attributes from the render region's context stack.Used when a render region needs to change a particular rendering attribute.This function provides a way of copying the contents of an AttributeValue derived class to another. It is assumed that the source object is the same class as the destination object. The data from the object pointed to by pAttr is copied into this object. This is primarily used when cloning render regions - the context stack must be copied, and if it points to any temporary objects, then they must be copied too, to avoid multiple deletion errors. Given an AttributeValue object, construct the appropriate NodeAttribute object which can be put into a document tree. This should be over-ridden for all derived AttributeValue classes, except those that cannot be put into the document tree (e.g. DrawingModeAttribute). The base class version (i.e. this one) will always ENSURE because it should not be called.
virtual BOOL Blend (BlendAttrParam *pBlendParam)
 Blends this attr val with the attr val associated with the other NodeAttribute ptr held in pBlendParam This base version just returns FALSE, and sets the blended attr val ptr to NULL.
virtual void Render (RenderRegion *, BOOL Temp=FALSE)
virtual void Restore (RenderRegion *, BOOL)
virtual void GetMinimumOffscreenBmpDimensions (UINT32 *RequiredWidth, UINT32 *RequiredHeight)
virtual void OffscreenRenderingCompleted (RenderRegion *pRender, LPBITMAPINFO lpBitmapInfo, LPBYTE lpBits, DocRect BitmapRect)
virtual BOOL DoesOffscreenBmpRequireTransp (GRenderRegion *pGRR)
 Override of OffscreenAttrValue virtual function. Feathers always require a transparent bitmap if their feather size is less than a certain value, otherwise they use the default implementation.
virtual BOOL DoesOffscreenBMPCaptureBackground ()
virtual BOOL CreateFeatherTransp (GRenderRegion *pGRR, Path *pPath, double dPixelWidth, BitmapTranspFillAttribute **ppFeatherTransp, KernelBitmap **ppFeatherBitmap)
 Create the feather transparency attribute using the supplied path /without/ reference to any surrounding nodes in the tree Used by NodeBitmap::GetDirectBitmap.
BOOL SetupFeather (Node *pNode, INT32 Width=((MILLIPOINT)(2 *PX_MP_VAL)), UnitType type=MILLIPOINTS)
 Setup feather member variables so that it is created properly on rendering.
BOOL ChangeFeatherProfile (CProfileBiasGain &biasgain)
BOOL ChangeFeatherSize (INT32, UnitType)
MILLIPOINT GetFeatherSize ()
 Accessor method for our feather size.
double GetFeatherPixelSize (double fPixelWidth)
 Return the size of this feather, in pixels of the specified width. Different from GetFeatherSize(PIXELS) mainly because: 1. we return a double, so eg you can get back a value of 2.5 pix. 2. we're inline.
CProfileBiasGain GetProfile ()
CProfileBiasGainGetProfilePtr ()
MILLIPOINT SetFeatherSize (MILLIPOINT sz)
 Mutator method for our feather size.
void SetFeatherProfile (CProfileBiasGain &biasgain)
virtual void SetLinkedNode (NodeRenderableBounded *pNode)
 Our outer contour gap size depends on what our linked node is, so we must recalculate our gap size whenever our linked node is set.
virtual BOOL CanBeRenderedDirectly ()
BOOL GenerateOuterContour ()
PathGetOuterContour ()
BOOL RegenerateOuterContourOnNextRedraw (UndoableOperation *pOp=NULL)
 Clear the cache of our outer-contour path.
void SetOuterContour (Path *pNewOuterContour)

Static Public Member Functions

static BOOL Init ()
 Declares a preference that allows you to clear memory in delete().

Private Member Functions

KernelBitmapCreateFeatherBitmap (GRenderRegion *pGRR, double pixBlurDiameter)
 Create the feather bitmap-transparency mask.
LPBITMAPINFO CreateSilhouetteBitmap (GRenderRegion *GRR, LPBYTE *ppBmpBits, Path *pOutline=NULL)
void SetupFeatherBitmapPalette (KernelBitmap *pFeatherBMP)
void CreateBitmapFill (KernelBitmap *pBitmap, DocRect *dr, BitmapFillAttribute *BmpFill)
void CreateBitmapFillRot90 (KernelBitmap *pBitmap, DocRect *dr, BitmapFillAttribute *BmpFill)
void CreateBitmapTranspFill (KernelBitmap *pFeather, DocRect *dr, BitmapTranspFillAttribute *BmpTranspFill)
PathGetVisibleBoundingPath ()

Private Attributes

CProfileBiasGain m_Profile
MILLIPOINT m_FeatherSize
MILLIPOINT m_GapSize
Pathm_pOuterContour
DocRect m_drFeatherBB
BOOL m_bCached

Static Private Attributes

static const MILLIPOINT MaxUserFeatherSize = 37500

Detailed Description

Definition at line 185 of file fthrattr.h.


Constructor & Destructor Documentation

FeatherAttrValue::FeatherAttrValue  ) 
 

See also:

Definition at line 272 of file fthrattr.cpp.

00273 {
00274 //  m_Profile = CProfileBiasGain()              // Defaults to this
00275     m_GapSize = DEFAULT_GAP_TOLERANCE_MP;
00276     m_FeatherSize = 0;                          // Document base Feather has 0 feather size.
00277                                                 // The doc base feather is created when camelot
00278                                                 // initialises a new document.
00279                                                 // The default feather applied to each new object
00280                                                 // is also setup by this constructor.
00281     m_pOuterContour = NULL;
00282     m_bCached = FALSE;
00283 }

FeatherAttrValue::~FeatherAttrValue  ) 
 

Definition at line 292 of file fthrattr.cpp.

00293 {
00294     // only m_pOuterContour may be left because it is cached
00295     if (m_pOuterContour != NULL)
00296     {
00297         delete m_pOuterContour;
00298         m_pOuterContour = NULL;
00299     }
00300 }


Member Function Documentation

BOOL FeatherAttrValue::Blend BlendAttrParam pBlendParam  )  [virtual]
 

Blends this attr val with the attr val associated with the other NodeAttribute ptr held in pBlendParam This base version just returns FALSE, and sets the blended attr val ptr to NULL.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/94
Parameters:
pBlendParam = ptr to param holding all data needed for the attr val to blend [INPUTS]
if TRUE returned, pBlendParam->GetBlendedAttrVal() will get ptr to the blended attr val [OUTPUTS] if FALSE returned, pBlendParam->GetBlendedAttrVal() will return NULL
Returns:
TRUE if successful, FALSE otherwaie

Errors: Errors in debug builds

See also:
-

Reimplemented from AttributeValue.

Definition at line 385 of file fthrattr.cpp.

00386 {
00387     // First get the fill that we are blending to
00388     FeatherAttrValue* OtherFthr = (FeatherAttrValue*)pBlendParam->GetOtherAttrVal();
00389 
00390     if(IsDefaultFlagSet() && OtherFthr->IsDefaultFlagSet())
00391     {
00392         // no blending required
00393 //      pBlendParam->SetBlendedAttrVal(NULL);
00394         return FALSE;
00395     }
00396 
00397 
00398     FeatherAttrValue* pNewAttr = new FeatherAttrValue;
00399 
00400     if (pNewAttr == NULL)
00401     {
00402         // Fail if we couldn't create the new fill
00403         pBlendParam->SetBlendedAttrVal(NULL);
00404         return FALSE;
00405     }
00406 
00407     // and what point along the blend we are at
00408     double Ratio = pBlendParam->GetBlendRatio();
00409 
00410     // blend m_pFeatherWidth
00411     MILLIPOINT Start = GetFeatherSize();
00412     MILLIPOINT End = OtherFthr->GetFeatherSize();
00413     pNewAttr->SetFeatherSize( (MILLIPOINT) ( Start + Ratio*(End - Start) ) );
00414 
00415     // blend m_Profile
00416     CProfileBiasGain BiasGain = m_Profile;                      // the first fills profile
00417     CProfileBiasGain OtherBiasGain = OtherFthr->m_Profile;      // the other fills profile
00418     if (!(BiasGain == OtherBiasGain))
00419     {
00420 /*      From other blend Profiles code
00421         double InvRatio = 1 - Ratio;
00422         double BlendedBias = (BiasGain.GetBias () * InvRatio) + (OtherBiasGain.GetBias () * Ratio);
00423         double BlendedGain = (BiasGain.GetGain () * InvRatio) + (OtherBiasGain.GetGain () * Ratio);
00424 */
00425         double StartBias = m_Profile.GetBias(); double EndBias = OtherBiasGain.GetBias();
00426         double StartGain = m_Profile.GetGain(); double EndGain = OtherBiasGain.GetGain();
00427         double BlendedBias = StartBias + ((EndBias - StartBias) * Ratio);
00428         double BlendedGain = StartGain + ((EndGain - StartGain) * Ratio);
00429 
00430         pNewAttr->m_Profile.SetBias (BlendedBias);
00431         pNewAttr->m_Profile.SetGain (BlendedGain);
00432     }
00433 
00434     // Set the new fill as the blended attribute
00435     pBlendParam->SetBlendedAttrVal(pNewAttr);
00436 
00437     return TRUE;
00438 }

BOOL FeatherAttrValue::CanBeRenderedDirectly  )  [virtual]
 

Reimplemented from GeometryLinkedAttrValue.

Definition at line 1450 of file fthrattr.cpp.

01451 {
01452     if(!GetLinkedNode())
01453         return FALSE;
01454     if(GetLinkedNode()->IS_KIND_OF(NodeDocument))
01455         return FALSE;
01456     if(GetFeatherSize()==0)
01457         return FALSE;
01458 
01459     return TRUE;
01460 }

BOOL FeatherAttrValue::ChangeFeatherProfile CProfileBiasGain biasgain  ) 
 

Definition at line 1245 of file fthrattr.cpp.

01246 {
01247     AFp BiasValue = biasgain.GetBias();
01248     AFp GainValue = biasgain.GetGain();
01249 
01250     m_Profile.SetBias(BiasValue);
01251     m_Profile.SetGain(GainValue);
01252 
01253     return TRUE;
01254 }

BOOL FeatherAttrValue::ChangeFeatherSize INT32  ,
UnitType 
 

Definition at line 1263 of file fthrattr.cpp.

01264 {
01265     BOOL res=SetupFeather(GetLinkedNode(), Width, type);
01266 
01267     return res;
01268 }

void FeatherAttrValue::CreateBitmapFill KernelBitmap pBitmap,
DocRect dr,
BitmapFillAttribute BmpFill
[private]
 

Definition at line 1138 of file fthrattr.cpp.

01139 {
01140     // Bitmap fill is the size of the current offscreen bitmap
01141     DocCoord StartPoint(dr->lo);
01142     DocCoord EndPoint(dr->hi.x,dr->lo.y);
01143     DocCoord EndPoint2(dr->lo.x,dr->hi.y);
01144     DocCoord EndPoint3(dr->hi);
01145 
01146     BmpFill->SetStartPoint(&StartPoint);
01147     BmpFill->SetEndPoint(&EndPoint);
01148     BmpFill->SetEndPoint2(&EndPoint2);
01149     BmpFill->SetEndPoint3(&EndPoint3);
01150     BmpFill->GetBitmapRef()->SetBitmap(pBitmap);
01151 }

void FeatherAttrValue::CreateBitmapFillRot90 KernelBitmap pBitmap,
DocRect dr,
BitmapFillAttribute BmpFill
[private]
 

Definition at line 1160 of file fthrattr.cpp.

01161 {
01162     // Bitmap fill is the size of the current offscreen bitmap
01163     DocCoord StartPoint(dr->hi.x, dr->lo.y);
01164     DocCoord EndPoint(dr->hi);
01165     DocCoord EndPoint2(dr->lo);
01166     DocCoord EndPoint3(dr->lo.x,dr->hi.y);
01167 
01168     BmpFill->SetStartPoint(&StartPoint);
01169     BmpFill->SetEndPoint(&EndPoint);
01170     BmpFill->SetEndPoint2(&EndPoint2);
01171     BmpFill->SetEndPoint3(&EndPoint3);
01172     BmpFill->GetBitmapRef()->SetBitmap(pBitmap);
01173 }

void FeatherAttrValue::CreateBitmapTranspFill KernelBitmap pFeather,
DocRect dr,
BitmapTranspFillAttribute BmpTranspFill
[private]
 

Definition at line 1175 of file fthrattr.cpp.

01176 {
01177     // Transp fill is same size as viewable part of the bitmap 
01178     DocCoord StartPoint(dr->lo);
01179     DocCoord EndPoint(dr->hi.x,dr->lo.y);
01180     DocCoord EndPoint2(dr->lo.x,dr->hi.y);
01181     DocCoord EndPoint3(dr->hi);
01182 
01183     BmpTranspFill->SetStartPoint(&StartPoint);
01184     BmpTranspFill->SetEndPoint(&EndPoint);
01185     BmpTranspFill->SetEndPoint2(&EndPoint2);
01186     BmpTranspFill->SetEndPoint3(&EndPoint3);
01187     BmpTranspFill->GetBitmapRef()->SetBitmap(pFeather);
01188     BmpTranspFill->Transp = 0;
01189     BmpTranspFill->EndTransp = 255;
01190     m_Profile.SetIsAFeatherProfile (TRUE);      // enable extra processing on the profile
01191     BmpTranspFill->SetProfile(m_Profile);
01192 }

KernelBitmap * FeatherAttrValue::CreateFeatherBitmap GRenderRegion pGRR,
double  pixBlurDiameter
[private]
 

Create the feather bitmap-transparency mask.

Returns:
A ptr to a KernelBitmap containing the transparency mask part of the feather.
See Also: CreateSilhouetteBitmap().

Definition at line 835 of file fthrattr.cpp.

00837 {
00838     // will contain the feather bitmap transparency mask.
00839     LPBYTE          pFeatherBits    = NULL;
00840     LPBITMAPINFO    pFeatherInfo    = NULL;
00841     KernelBitmap*   kbmpFeather     = NULL;
00842 
00843     // create the silhouette bitmap.
00844     LPBYTE          pSilhouetteBits;
00845     LPBITMAPINFO    pSilhouetteInfo = CreateSilhouetteBitmap(pGRR, &pSilhouetteBits);
00846 
00847     if (pSilhouetteInfo != NULL && pSilhouetteBits != NULL)
00848     {
00849 //      TRACEUSER( "Gerry", _T("Silhouette size = (%d, %d)\n"), pSilhouetteInfo->bmiHeader.biWidth, pSilhouetteInfo->bmiHeader.biHeight);
00850 
00851         // blur the silhouette bitmap to obtain the feather bitmap.
00852         pFeatherInfo = CBitmapShadow::Feather8BppBitmap(
00853                                                         pixBlurDiameter,
00854                                                         pSilhouetteInfo,
00855                                                         pSilhouetteBits,
00856                                                         &pFeatherBits
00857                                                     );
00858 
00859         // If Feather8BPP returned the same bitmap, clear silhouette pointers so we don't
00860         // deallocate the bitmap at the end of this function...
00861         if (pFeatherInfo == pSilhouetteInfo)
00862         {
00863             pSilhouetteInfo = NULL;
00864             pSilhouetteBits = NULL;
00865         }
00866 
00867         if (pFeatherInfo != NULL && pFeatherBits != NULL)
00868         {
00869 //          TRACEUSER( "Gerry", _T("Feather size = (%d, %d)\n"), pFeatherInfo->bmiHeader.biWidth, pFeatherInfo->bmiHeader.biHeight);
00870             CWxBitmap*      wbmpFeather = new CWxBitmap(pFeatherInfo, pFeatherBits);
00871                             kbmpFeather = new KernelBitmap(wbmpFeather, TRUE);
00872 
00873             SetupFeatherBitmapPalette(kbmpFeather);
00874         }
00875     }
00876 
00878 //
00879 // DEBUG: add copies of the silhouette and feather bitmaps to the bitmap gallery.
00880 //
00881 #ifdef DEBUG_ATTACH_SILHOUETTE_BMP
00882     if (pSilhouetteInfo != NULL && pSilhouetteBits != NULL)
00883     {
00884         CWxBitmap*      wbmpSilhouette = new CWxBitmap(pSilhouetteInfo, pSilhouetteBits);
00885         KernelBitmap*   kbmpSilhouette = new KernelBitmap(wbmpSilhouette, TRUE);
00886 
00887         SetupFeatherBitmapPalette(kbmpSilhouette);
00888         kbmpSilhouette->AttachDebugCopyToCurrentDocument("Silhouette Bitmap");
00889 
00890         wbmpSilhouette->BMBytes = ((CWxBitmap*)OILBitmap::Default)->BMBytes;
00891         delete kbmpSilhouette;
00892     }
00893 #endif
00894 
00895 #ifdef DEBUG_ATTACH_FEATHER_BMP
00896     if (kbmpFeather != NULL)
00897     {
00898         kbmpFeather->AttachDebugCopyToCurrentDocument("Feather Mask Bitmap");
00899     }
00900 #endif
00901 //
00903 
00904     // Silhouette bitmap does not use limited mem manager, so free its DIB ourself.
00905     if (pSilhouetteInfo != NULL && pSilhouetteBits != NULL)
00906         FreeDIB(pSilhouetteInfo, pSilhouetteBits, NULL, FALSE);
00907 
00908     return kbmpFeather;
00909 }

BOOL FeatherAttrValue::CreateFeatherTransp GRenderRegion pGRR,
Path pPath,
double  dPixelWidth,
BitmapTranspFillAttribute **  ppFeatherTransp,
KernelBitmap **  ppFeatherBitmap
[virtual]
 

Create the feather transparency attribute using the supplied path /without/ reference to any surrounding nodes in the tree Used by NodeBitmap::GetDirectBitmap.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/08/2005
Parameters:
pPath - Pointer to path to be feathered [INPUTS] dPixelWidth - Pixel width in millipoints
pFeatherTransp - Pointer to transparency attribute for feathering [OUTPUTS] pFeatherBitmap - POinter to feather bitmap used in transparency attribute
Returns:
TRUE if it worked FALSE otherwise

Definition at line 699 of file fthrattr.cpp.

00705 {
00706     double dpixBlurDiameter = GetFeatherPixelSize(dPixelWidth);
00707     LPBYTE          pFeatherBits    = NULL;
00708     LPBITMAPINFO    pFeatherInfo    = NULL;
00709     KernelBitmap*   kbmpFeather     = NULL;
00710     DocRect         rectBounds      = pPath->GetBoundingRect();
00711 //  UINT32          pixWidth        = UINT32(floor( rectBounds.Width() / dPixelWidth + 0.5 ));
00712 //  UINT32          pixHeight       = UINT32(floor( rectBounds.Height() / dPixelWidth + 0.5 ));
00713 
00714     // -------------------------------------------------------------------
00715     // First make the silhouette bitmap
00716     // create the silhouette bitmap.
00717     m_OffBB = rectBounds;
00718     m_GapSize = 0;
00719     LPBYTE          pSilhouetteBits;
00720     LPBITMAPINFO    pSilhouetteInfo = CreateSilhouetteBitmap(pGRR, &pSilhouetteBits, pPath);
00721 
00722     if (pSilhouetteInfo==NULL || pSilhouetteBits==NULL)
00723         return FALSE;
00724 
00725     // -------------------------------------------------------------------
00726     // Next blur the silhouette bitmap to obtain the feather bitmap.
00727     pFeatherInfo = CBitmapShadow::Feather8BppBitmap(
00728                                                     dpixBlurDiameter,
00729                                                     pSilhouetteInfo,
00730                                                     pSilhouetteBits,
00731                                                     &pFeatherBits
00732                                                 );
00733 
00734     // If Feather8BPP returned the same bitmap, clear silhouette pointers so we don't
00735     // deallocate the bitmap at the end of this function...
00736     if (pFeatherInfo == pSilhouetteInfo)
00737     {
00738         pSilhouetteInfo = NULL;
00739         pSilhouetteBits = NULL;
00740     }
00741 
00742     if (pFeatherInfo != NULL && pFeatherBits != NULL)
00743     {
00744         CWxBitmap*      wbmpFeather = new CWxBitmap(pFeatherInfo, pFeatherBits);
00745                         kbmpFeather = new KernelBitmap(wbmpFeather, TRUE);
00746 
00747         SetupFeatherBitmapPalette(kbmpFeather);
00748 
00749         *ppFeatherBitmap = kbmpFeather;
00750     }
00751 
00752     // We don't need the silhouette bitmap any more
00753     if (pSilhouetteInfo != NULL && pSilhouetteBits != NULL)
00754         FreeDIB(pSilhouetteInfo, pSilhouetteBits);
00755 
00756     // If we failed to create the blurred bitmap then exit now
00757     if (*ppFeatherBitmap==NULL)
00758         return FALSE;
00759 
00760     // ----------------------------------------------------------------------
00761     // Now make the transparency attribute to carry the feather bitmap
00762     *ppFeatherTransp  = new BitmapTranspFillAttribute;
00763     if (*ppFeatherTransp==NULL)
00764     {
00765         delete *ppFeatherBitmap;
00766         *ppFeatherBitmap = NULL;
00767         return FALSE;
00768     }
00769 
00770     CreateBitmapTranspFill(*ppFeatherBitmap, &rectBounds, *ppFeatherTransp);
00771 
00772     return TRUE;
00773 }

LPBITMAPINFO FeatherAttrValue::CreateSilhouetteBitmap GRenderRegion GRR,
LPBYTE ppBmpBits,
Path pOutline = NULL
[private]
 

I order to avoid DWORD aligning overhead in the convolution code we always render into bitmaps which are DWORD aligned. This means we need to be careful when creating a transparency attribute to hold the mask as we must use the aligned co-ords, not m_OffBB otherwise we will introduce scaling. NB we do this by drawing more pixels on the right hand border to account for the alignment. NB NB NB Non-technical notes: these notes are out of date so ignore! will fix later.

Definition at line 943 of file fthrattr.cpp.

00946 {
00947 //  ERROR3IF(m_pOffscreenBmpInfo == NULL,
00948 //          "FeatherAttrValue::CreateSilhouetteBitmap; No offscreen bitmap info.");
00949 
00950     // generate a contour of m_GapSize around the path of our linked node, to
00951     // eradicate any small gaps which would otherwise be feathered.
00952     if (pOutline==NULL)
00953     {
00954         if (m_pOuterContour == NULL)
00955             GenerateOuterContour();
00956 
00957         pOutline = m_pOuterContour;
00958     }
00959 
00960     // if we couldn't generate our outer contour, or it had no points in it,
00961     // don't try to produce a feather bitmap.
00962     if (pOutline == NULL || pOutline->GetNumCoords() == 0)
00963     {
00964         *ppBmpBits = NULL;
00965         return NULL;
00966     }
00967 
00969     //  -   Work out the appropriate size silhouette bitmap by inflating the invalid
00970     //      offscreen rectangle by the blur *radius* (half the feather size).
00971     //  -   If the blur radius is above the maximum we can do, then we work out *how*
00972     //      much bigger it is and render the silhouette bitmap appropriately scaled down.
00973     //  -   The final feather bitmap will then scale up to fill the offscreen rect,
00974     //      making it look like we actually used the requested blur radius.
00975     const   double  ScaledPixelWidth    = GRR->GetScaledPixelWidthDouble();
00976     const   double  FeatherMPSize       = GetFeatherSize();
00977     const   double  FeatherPixelSize    = GetFeatherPixelSize(ScaledPixelWidth);
00978             double  FeatherScaleFactor  = 1;
00979 
00980     DocRect drSilhouetteBounds = m_OffBB;
00981     m_drFeatherBB = drSilhouetteBounds;
00982     if (FeatherPixelSize >= MIN_BLUR_DIAMETER)
00983     {
00984         // requested blur diameter  = BlurPixDiam pixels.
00985         // actual blur we can do    = FeatherPixelSize pixels.
00986         double BlurPixDiam = (ScaledPixelWidth > 0) ? (FeatherMPSize / ScaledPixelWidth) : 0;
00987         if (BlurPixDiam > FeatherPixelSize)
00988         {
00989             FeatherScaleFactor = BlurPixDiam / FeatherPixelSize;
00990 
00991             // Scale the silhouette around its centre by the feather scale factor.
00992             // This is so that the rendered silhouette bitmap is has a width of
00993             // at least (2 * FeatherRadius + 1) pixels.
00994             double BoundsSF = (FeatherScaleFactor - 1.0) / 2.0;
00995             UINT32  nWidth  = (UINT32)(0.5 + (double)drSilhouetteBounds.Width() * BoundsSF);
00996             UINT32  nHeight = (UINT32)(0.5 + (double)drSilhouetteBounds.Height() * BoundsSF);
00997             drSilhouetteBounds.Inflate(nWidth, nHeight);
00998             m_drFeatherBB = drSilhouetteBounds;
00999         }
01000 
01001         // Inflate the silhouette bounds by FeatherRadius pixels around each edge.
01002         // This will shrink down to the correct bounds when blurred.
01003         const UINT32 nBlur = (UINT32)(BlurPixDiam +  0.5);
01004 
01005         UINT32 nHiInflate = (nBlur - 1) / 2;
01006         UINT32 nLoInflate = (nBlur - 1) - nHiInflate;
01007 
01008         nHiInflate = (UINT32)(ScaledPixelWidth * (double)nHiInflate);
01009         nLoInflate = (UINT32)(ScaledPixelWidth * (double)nLoInflate);
01010 
01011         drSilhouetteBounds.hi.x += nHiInflate;
01012         drSilhouetteBounds.hi.y += nHiInflate;
01013         drSilhouetteBounds.lo.x -= nLoInflate;
01014         drSilhouetteBounds.lo.y -= nLoInflate;
01015 
01016         // Don't allow further code to try to make a zero pixel silhouette bitmap
01017         if (drSilhouetteBounds.Width()<ScaledPixelWidth || drSilhouetteBounds.Height()<ScaledPixelWidth)
01018         {
01019             *ppBmpBits = NULL;
01020             return NULL;
01021         }
01022     }
01024 
01025     // create our offscreen render-region.
01026     ConcurrentRenderer* pRendWrap = NULL;
01027     pRendWrap = GRenderRegionWrapper::GetConcurrentRenderer(GRR, 1.0 / FeatherScaleFactor,
01028                                                             drSilhouetteBounds, 8, FALSE);
01029     if (pRendWrap == NULL)
01030     {
01031         *ppBmpBits = NULL;
01032         return NULL;
01033     }
01034 
01035     GRenderRegion* pLocalGRR = NULL;
01036     pLocalGRR = pRendWrap->GetRenderRegion();
01037 
01038     pLocalGRR->GetDrawContext()->SetHintingFlag(FALSE);
01039 
01040     // ask the bitmap shadower if it the final feather bitmap will be offset diagonally
01041     // by half a pixel. if this is the case then we must compensate, by rendering
01042     // the silhouette bitmap at a half-pixel offset in the other direction.
01043     if (CBitmapShadow::BlurringWillOffsetBitmap(FeatherPixelSize))
01044         pLocalGRR->OffsetByHalfPixel();
01045 
01047     // Draw into new RenderRegion which GRenderRegionWrapper has created
01049     pLocalGRR->SaveContext();
01050 
01051     // Initialise our new render-region:
01052     //  1.  Render in solid black with solid white line-widths.
01053     //  1a. Line colour now graduates from black -> off-white over 0->2*MIN_BLUR_DIAMETER.
01054     //  2.  Line width is half feather size + contour gap size, on either side.
01055     //  3.  No arrowheads/dashed lines/fancy join types.
01056     //  4.  High quality rendering, so we get anti-aliased lines.
01057 
01058     pLocalGRR->SetFillColour(COLOUR_BLACK);
01059     if (FeatherPixelSize < (2*MIN_BLUR_DIAMETER))
01060     {
01061         double RampValue = FeatherPixelSize / (2*MIN_BLUR_DIAMETER);
01062         ColourValue GreyVal(0.8 * RampValue);
01063         DocColour FeatherGrey(GreyVal, GreyVal, GreyVal);
01064         pLocalGRR->SetLineColour(FeatherGrey);
01065     }
01066     else
01067         pLocalGRR->SetLineColour(COLOUR_WHITE);
01068 
01069     pLocalGRR->SetJoinType(RoundJoin);
01070     pLocalGRR->SetStartArrow(SA_NULLARROW);
01071     pLocalGRR->SetEndArrow(SA_NULLARROW);
01072     pLocalGRR->SetDashPattern(SD_SOLID);
01073 
01074     MILLIPOINT RequiredLineWidth = (MILLIPOINT)(FeatherMPSize + 2*m_GapSize);
01075     pLocalGRR->SetLineWidth(RequiredLineWidth);
01076 
01077     FlatTranspFillAttribute NoFillTransp(TT_NoTranspType);
01078     pLocalGRR->SetTranspFillGeometry(&NoFillTransp, FALSE);
01079 
01080     StrokeTranspAttribute NoLineTransp(TT_NoTranspType);
01081     pLocalGRR->SetLineTransp(&NoLineTransp, FALSE);
01082 
01083     Quality AntiAliasQuality;
01084     AntiAliasQuality.SetQuality(Quality::QualityMax);
01085     QualityAttribute AntiAliasQualityAttr(AntiAliasQuality);
01086     pLocalGRR->SetQuality(&AntiAliasQualityAttr, FALSE);
01087 
01088     // render our contoured silhouette path into the new RR.
01089     pOutline->IsFilled  = TRUE;
01090     pOutline->IsStroked = TRUE;
01091     pLocalGRR->DrawPath(pOutline);
01092     pLocalGRR->RestoreContext();
01093 
01095     // Extract bitmap from GRenderRegionWrapper and restore GDraw state
01097     LPBITMAPINFO tmpBI;
01098     pRendWrap->GetBitmapPointers(&tmpBI, ppBmpBits);
01099     pRendWrap->RestorePreviousRendererState();
01100 
01101     return tmpBI;
01102 }

virtual BOOL FeatherAttrValue::DoesOffscreenBMPCaptureBackground  )  [inline, virtual]
 

Reimplemented from OffscreenAttrValue.

Definition at line 214 of file fthrattr.h.

00214 {return TRUE;}      // Return TRUE if you can make this work

BOOL FeatherAttrValue::DoesOffscreenBmpRequireTransp GRenderRegion pGRR  )  [virtual]
 

Override of OffscreenAttrValue virtual function. Feathers always require a transparent bitmap if their feather size is less than a certain value, otherwise they use the default implementation.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/11/2000
Parameters:
pGRR the RR which the feather will be rendered into. [INPUTS]
This prevents white artifacts on small feather sizes.

See also: CreateSilhouetteBitmap, OffscreenAttrValue::DoesOffscreenBmpRequireTransp.

Reimplemented from OffscreenAttrValue.

Definition at line 796 of file fthrattr.cpp.

00797 {
00798 // In conjunction with DoesOffscreenBMPCaptureBackground this function should
00799 // now return FALSE always so that the offscreen bitmap does not attempt to
00800 // capture transparency info but rather captures the RESULTS of transparency...
00801     if (DoesOffscreenBMPCaptureBackground())
00802         return FALSE;
00803 
00804     if (pGRR == NULL)
00805     {
00806         ERROR3("FeatherAttrValue::DoesOffscreenBmpRequireTransp; Invalid params!");
00807         return FALSE;
00808     }
00809 
00810     const double ScaledPixelWidth = pGRR->GetScaledPixelWidthDouble();
00811     const double FeatherPixelSize = GetFeatherPixelSize(ScaledPixelWidth);
00812 
00813     return (FeatherPixelSize < 2*MIN_BLUR_DIAMETER) ? TRUE :
00814             OffscreenAttrValue::DoesOffscreenBmpRequireTransp(pGRR) ;
00815 }

BOOL FeatherAttrValue::GenerateOuterContour  ) 
 

Definition at line 1407 of file fthrattr.cpp.

01408 {
01409     // fail now if we have no linked node.
01410     if (GetLinkedNode() == NULL)
01411     {
01412         ERROR3("FeatherAttrValue::GenerateOuterContour; Aarrgh!! Where's our linked node?!!");
01413         return FALSE;
01414     }
01415 
01416     // We know we are about to overwrite this value so if it's still set up
01417     // we shuold delete it now to prevent memory leaks
01418     if (m_pOuterContour)
01419     {
01420         delete m_pOuterContour;
01421         m_pOuterContour = NULL;
01422     }
01423 
01424     // Get outer contour
01425     // NB m_pOuterContour is a contour which is m_GapSize outside m_pPath's outline
01426     // Outer contour with m_GapSize is used so that small gaps are forced out. This is
01427     // especially desireable when there are a large number of tiny gaps within the object
01428     // we are trying feather (eg the gaps between the 'front windscreen' shape and the 
01429     // 'windscreen frame')
01430 
01431     m_pOuterContour = new Path;
01432     BOOL fSuccess =
01433         NodeContour::GenerateContourPathForNode(m_pOuterContour, GetLinkedNode(), NULL,
01434                                                 m_GapSize, TRUE, RoundJoin, -1, TRUE, TRUE);
01435 
01436     if (!fSuccess)
01437     {
01438         delete m_pOuterContour;
01439         m_pOuterContour = NULL;
01440     }
01441 
01442     return fSuccess;
01443 }

double FeatherAttrValue::GetFeatherPixelSize double  fPixelWidth  )  [inline]
 

Return the size of this feather, in pixels of the specified width. Different from GetFeatherSize(PIXELS) mainly because: 1. we return a double, so eg you can get back a value of 2.5 pix. 2. we're inline.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/08/2000
Parameters:
fPixelWidth width of a pixel in millipoints - accepts non-integer values. [INPUTS]
Returns:
The feather size, in pixels which are fPixelWidth millipoints wide, capped off to a maximum of (2 * MAX_SHADOW_BLUR) pixels.
Notes: inline, as it's small and fast.

Definition at line 1341 of file fthrattr.cpp.

01342 {
01343     const double MaxFeatherBlurDiameter = 2.0 * MAX_SHADOW_BLUR;
01344     double fFeatherSize = (fPixelWidth <= 0) ? 0 : (double)m_FeatherSize / fPixelWidth;
01345     return (fFeatherSize > MaxFeatherBlurDiameter) ? MaxFeatherBlurDiameter : fFeatherSize;
01346 }

MILLIPOINT FeatherAttrValue::GetFeatherSize  ) 
 

Accessor method for our feather size.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/01/2001
Returns:
Our feather size, in millipoints.
Notes: This value is always capped off to MaxUserFeatherSize millipoints, to prevent anybody ever using a feather size which we cannot handle.

Definition at line 1287 of file fthrattr.cpp.

01288 {
01289     return (m_FeatherSize > MaxUserFeatherSize) ? MaxUserFeatherSize : m_FeatherSize;
01290 }

void FeatherAttrValue::GetMinimumOffscreenBmpDimensions UINT32 RequiredWidth,
UINT32 RequiredHeight
[virtual]
 

Reimplemented from OffscreenAttrValue.

Definition at line 505 of file fthrattr.cpp.

00506 {
00507     *RequiredWidth = 2;
00508     *RequiredHeight = 2;
00509 }

Path* FeatherAttrValue::GetOuterContour  )  [inline]
 

Definition at line 265 of file fthrattr.h.

00265 { return m_pOuterContour; }

CProfileBiasGain FeatherAttrValue::GetProfile  )  [inline]
 

Definition at line 244 of file fthrattr.h.

00244 { return m_Profile; }

CProfileBiasGain* FeatherAttrValue::GetProfilePtr  )  [inline]
 

Definition at line 245 of file fthrattr.h.

00245 { return &m_Profile; }      // return pointer to profile

Path * FeatherAttrValue::GetVisibleBoundingPath  )  [private]
 

Definition at line 1194 of file fthrattr.cpp.

01195 {
01196     DocRect dr = GetOffscreenBoundingRect();
01197     Path* p = new Path();
01198     if (p != NULL)
01199     {
01200         p->Initialise(5);
01201         p->CreatePathFromDocRect(&dr);
01202     }
01203     return p;
01204 }

BOOL FeatherAttrValue::Init void   )  [static]
 

Declares a preference that allows you to clear memory in delete().

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/94
Returns:
TRUE if it worked OK, FALSE if not

Reimplemented from SimpleCCObject.

Definition at line 309 of file fthrattr.cpp.

00310 {
00311     // Default to no feathering
00312     FeatherAttrValue *pAttr = new FeatherAttrValue;
00313     if (pAttr==NULL)
00314         // error message has already been set by new
00315         return FALSE;
00316 
00317     pAttr->SetDefault();
00318 
00319     UINT32 AttrID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(NodeRenderableInk),
00320                                                          pAttr);
00321 
00322     ERROR2IF(AttrID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising FeatherAttrValue");
00323     ERROR2IF(AttrID != ATTR_FEATHER, FALSE, "Incorrect ID for FeatherAttrValue");
00324 
00325     return TRUE;
00326 }

NodeAttribute * FeatherAttrValue::MakeNode  )  [virtual]
 

Used when restoring attributes from the render region's context stack.Used when a render region needs to change a particular rendering attribute.This function provides a way of copying the contents of an AttributeValue derived class to another. It is assumed that the source object is the same class as the destination object. The data from the object pointed to by pAttr is copied into this object. This is primarily used when cloning render regions - the context stack must be copied, and if it points to any temporary objects, then they must be copied too, to avoid multiple deletion errors. Given an AttributeValue object, construct the appropriate NodeAttribute object which can be put into a document tree. This should be over-ridden for all derived AttributeValue classes, except those that cannot be put into the document tree (e.g. DrawingModeAttribute). The base class version (i.e. this one) will always ENSURE because it should not be called.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/04/94
Returns:
Pointer to NodeAttribute object, or NULL if out of memory.

Errors: Out of memory.

See also:
NodeAttribute

Reimplemented from AttributeValue.

Definition at line 371 of file fthrattr.cpp.

00372 {
00373     AttrFeather* pNode = new AttrFeather();
00374     pNode->Value.SimpleCopy(this);
00375     return pNode;
00376 }

void FeatherAttrValue::OffscreenRenderingCompleted RenderRegion pRender,
LPBITMAPINFO  lpBitmapInfo,
LPBYTE  lpBits,
DocRect  BitmapRect
[virtual]
 

Notes: 1) This function gets called when the RR exits the context under which the attribute was Render()ed (ie after completeing a DrawPath("this->m_pLinkedNode->Path"). 2) The offscreen rendering system (implemented in GRenderRegion) has already restored the clip rect and GDraw bitmap and matrix state of the previous offscreen attribute. This function is actually being called by the RenderRegion in the process of Restore()ing this previous offscreen attribute (ie the process of taking the attribute which is sitting on top of the attribute context stack, and restoring it to the CurrentAttrs table). So at this point the GRenderRegion and GDraw context are back the way they were before "this" offscreen attribute was Render()ed. 3) m_pOffscreenBmpBits points to the buffer holding the fully rendered bitmap of the subtree rooted at m_pLinkedNode 4) Any transparency attribute existing at the same level as this offscreen attr (ie attached to "this->m_pLinkedNode") will already have affected the bitmap in "this->m_pOffscreenBmpBits". 5) You don't need to delete the bitmap pointers UNLESS you installed "this" attribute as a non-temporary attribute in the Render() function (ie SetFeathering(this, FALSE..)). If it is a temporary attribute (which is the default) then the deconstructor will handle the deallocation of the memory pointed to by m_pOffscreenBmpBits & m_pOffscreenBmpInfo

See also:
GRenderRegion::RestoreFeathering(); ~FeatherAttrValue(); RenderRegion::RestoreAttribute() FeatherAttrValue::Render(), GRenderRegion::SetFeathering()

Implements OffscreenAttrValue.

Definition at line 542 of file fthrattr.cpp.

00543 {
00544 //  TRACEUSER( "Gerry", _T("Feather attribute OffscreenRenderingCompleted (0x%08x)\n"), this);
00545 //  TRACEUSER( "Phil", _T("Feather attribute OffscreenRenderingCompleted (0x%08x)\n"), this);
00546 
00547 // TEMP BODGE
00548     m_OffBB = BitmapRect;
00549 
00550     // Karim 20/07/2000
00551     // currently, we only generate an offscreen bitmap for GRenderRegions, although we are
00552     // 'rendered' into all RR's. therefore we must quit quietly if pRender is not a GRR.
00553     if (!pRender->IS_KIND_OF(GRenderRegion))
00554         return;
00555 
00556     GRenderRegion* pGRR = (GRenderRegion*)pRender;
00557     RRCaps Caps;
00558     pGRR->GetRenderRegionCaps(&Caps);
00559     if (!Caps.DoesRegionDoAll())
00560         return;
00561 
00562     // Karim 19/10/2000
00563     // The offscreen rendering may possibly fail,
00564     // in which case all we can do now is quit.
00565     if (lpBitmapInfo == NULL || lpBits == NULL)
00566     {
00567 //      ERROR3("FeatherAttrValue::OffscreenRenderingCompleted; don't have any bitmap info!");
00568         return;
00569     }
00570 
00571     double fScaledPixelWidth = pGRR->GetScaledPixelWidthDouble();
00572 //  TRACEUSER( "Gerry", _T("ScaledPixelWidth = %f\n"), fScaledPixelWidth);
00573     double pixBlurDiameter = GetFeatherPixelSize(fScaledPixelWidth);
00574 //  TRACEUSER( "Gerry", _T("BlurDiameter = %f\n"), pixBlurDiameter);
00575 
00576     // Setup path to draw
00577     Path* pPathToDraw = GetVisibleBoundingPath();
00578     if (pPathToDraw == NULL)
00579     {
00580         ERROR3("FeatherAttrValue::OffscreenRenderingCompleted; Couldn't create path!");
00581         return;
00582     }
00583 
00585     //  Create the bitmap fill containing the offscreen rendition of the objects to feather.
00587 
00588     CWxBitmap          *wBitmap = NULL;
00589     KernelBitmap       *OffscreenBitmap = NULL;
00590 
00591 //  TRACEUSER( "Gerry", _T("Offscreen size = (%d, %d)\n"), pOffBmpHdr->biWidth, pOffBmpHdr->biHeight);
00592 
00593     // Create a Kernel bitmap from the bmp data.
00594     wBitmap         = new CWxBitmap(lpBitmapInfo, lpBits);
00595     OffscreenBitmap = new KernelBitmap(wBitmap,TRUE);
00596 
00597     // Setup the bitmap fill.
00598     // Since the offscreen bitmap has been plotted using the full rendering matrix
00599     // which may include a rotation during printing, we must now force GDraw to
00600     // render it using the same rotation (see GRenderRegion::AllocateOffScreenState)
00601     BitmapFillAttribute BmpFill;
00602     ANGLE rot;
00603     Matrix m = pGRR->GetMatrix();
00604     m.Decompose(NULL, NULL, &rot, NULL, NULL);
00605     if (rot==0)
00606 //      CreateBitmapFill(OffscreenBitmap, &m_OffBB, &BmpFill);
00607         CreateBitmapFill(OffscreenBitmap, &BitmapRect, &BmpFill);
00608     else
00609 //      CreateBitmapFillRot90(OffscreenBitmap, &m_OffBB, &BmpFill);
00610         CreateBitmapFillRot90(OffscreenBitmap, &BitmapRect, &BmpFill);
00611     // No other rotations are currently possible...
00612 
00613 // DEBUG: add offscreen bmp to bitmap gallery
00614 #ifdef DEBUG_ATTACH_OFFSCREEN_BMP
00615     OffscreenBitmap->AttachDebugCopyToCurrentDocument("Offscreen Bitmap");
00616 #endif
00617 
00618 
00620     //  Create the feather bitmap transparency mask.
00622 
00623     KernelBitmap* FeatherBitmap = CreateFeatherBitmap(pGRR, pixBlurDiameter);
00624 
00625     BitmapTranspFillAttribute BmpTranspFill;
00626     if (FeatherBitmap != NULL)
00627     {
00628         CreateBitmapTranspFill(FeatherBitmap, &m_drFeatherBB, &BmpTranspFill);
00629     }
00630 
00631 
00633     //  Render the bitmaps together for the final feathered result.
00634     //
00635     //  If we had any problems creating the feather bitmap transparency, or if our debug
00636     //  rendering is enabled, then we try to fail gracefully by rendering just the
00637     //  offscreen bitmap. Note that this bitmap will only have an alpha channel if some of
00638     //  the feathered objects require it, and will have a white background otherwise.
00640     pGRR->SaveContext();
00641 
00642 // DEBUG: see note above.
00643 #ifndef DEBUG_RENDER_OFFSCREEN_BMP_WITHOUT_MASK
00644     if (FeatherBitmap != NULL)
00645         pGRR->RenderBitmapWithTransparency(pPathToDraw, &BmpFill, &BmpTranspFill);
00646 #else
00647     pGRR->RenderBitmapWithTransparency(pPathToDraw, &BmpFill, NULL);
00648 #endif
00649 
00650     pGRR->RestoreContext();
00651 
00653     //  Clean up all our data structures.
00655     if (FeatherBitmap != NULL)
00656     {
00657         delete FeatherBitmap;
00658         FeatherBitmap = NULL;
00659     }
00660 
00661     if (pPathToDraw != NULL)
00662     {
00663         delete pPathToDraw;
00664         pPathToDraw = NULL;
00665     }
00666 
00667     FreeDIB(lpBitmapInfo, lpBits, NULL, FALSE);
00668 
00669     // makes ~CWxBitmap() think that bmp HasBeenDeleted().
00670     wBitmap->BMBytes = ( (CWxBitmap *)OILBitmap::Default )->BMBytes;
00671     delete OffscreenBitmap;
00672 }

BOOL FeatherAttrValue::RegenerateOuterContourOnNextRedraw UndoableOperation pOp = NULL  ) 
 

Clear the cache of our outer-contour path.

Author:
Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>; Karim MacDonald
Date:
24/01/2000; 01/03/2001
Parameters:
pOp optional ptr to an UndoOp, letting us store undo information. [INPUTS]
Returns:
TRUE if we were successful, FALSE otherwise.
See also: AttrFeather::Transform(), AttrFeather::LinkedNodeGeometryHasChanged().

Definition at line 1480 of file fthrattr.cpp.

01481 {
01482     if (m_pOuterContour != NULL)
01483     {
01484         if (pOp != NULL)
01485         {
01486             // make this undoable
01487             RegenerateFeatherContourAction* pAct = NULL;
01488             if (RegenerateFeatherContourAction::Init(pOp, pOp->GetUndoActionList(), this, m_pOuterContour, &pAct) == AC_FAIL)
01489             {
01490                 TRACEALL( _T("FeatherAttrValue::RegenerateOuterContourOnNextRedraw; Could not record undo information.\n"));
01491                 return FALSE;
01492             }
01493         }
01494         // don't actually delete the old outer contour
01495         // if it's been saved via the undoable operation.
01496         if (pOp == NULL)
01497             delete m_pOuterContour;
01498 
01499         m_pOuterContour = NULL;
01500     }
01501 
01502     return TRUE;
01503 }

void FeatherAttrValue::Render RenderRegion ,
BOOL  Temp = FALSE
[virtual]
 

Reimplemented from OffscreenAttrValue.

Definition at line 448 of file fthrattr.cpp.

00449 {
00450 //  TRACEUSER( "Gerry", _T("Rendering feather attribute of %d (0x%08x)\n"), GetFeatherSize(), this);
00451     
00452     // Karim 20/07/2000
00453     // currently, we only generate an offscreen bitmap for GRenderRegions, although we are
00454     // 'rendered' into all RR's. therefore we must quit quietly if pRender is not a GRR.
00455     // Gerry 12/01/2005
00456     // This is no longer true.  We need to render this into all types of render region
00457     // so the code has been removed
00458     
00459 //  if (!pRender->IS_KIND_OF(GRenderRegion))
00460 //      return;
00461 
00462     // if the feather size is zero, then quit now - no feathering is necessary.
00463     MILLIPOINT mpFeather = GetFeatherSize();
00464     if (mpFeather == 0)
00465         return;
00466 
00467     // ... and shout out if the feather size is negative - something is WRONG!
00468     else if (mpFeather < 0)
00469     {
00470         ERROR3("Negative feather size! What's going on?");
00471         return;
00472     }
00473 
00474     // you would place code here if you need to affect currentAttrs table
00475     // also alloc any mem you need for the duration of the rendering cycle
00476     OffscreenAttrValue::Render(pRender, Temp);
00477 }

void FeatherAttrValue::Restore RenderRegion ,
BOOL 
[virtual]
 

Reimplemented from OffscreenAttrValue.

Definition at line 486 of file fthrattr.cpp.

00487 {
00488 //TRACEUSER( "Phil", _T("Restoring feather attribute of %d (0x%08x)\n"), GetFeatherSize(), this);
00489     // NB this function doesn't need to be implemented - the base class handles everything
00490     // Just showing you where to put extra code
00491 
00492     OffscreenAttrValue::Restore(pRegion, Temp);
00493 }

void FeatherAttrValue::SetFeatherProfile CProfileBiasGain biasgain  ) 
 

Definition at line 1357 of file fthrattr.cpp.

01358 {
01359     AFp BiasValue = biasgain.GetBias();
01360     AFp GainValue = biasgain.GetGain();
01361 
01362     m_Profile.SetBias(BiasValue);
01363     m_Profile.SetGain(GainValue);
01364 }

MILLIPOINT FeatherAttrValue::SetFeatherSize MILLIPOINT  mpWidth  ) 
 

Mutator method for our feather size.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/01/2001
Parameters:
Our new feather size, in millipoints. [INPUTS]
Returns:
The feather size we actually set, taking cap values into account.
Notes: This method will not set a value <0 mp or >MaxUserFeatherSize mp, to prevent us dealing in feather sizes that we cannot handle.

Definition at line 1311 of file fthrattr.cpp.

01312 {
01313     m_FeatherSize = mpWidth < 0                     ? 0 :
01314                     mpWidth > MaxUserFeatherSize    ? MaxUserFeatherSize :
01315                     mpWidth;
01316 
01317     return m_FeatherSize;
01318 }

void FeatherAttrValue::SetLinkedNode NodeRenderableBounded pNode  )  [virtual]
 

Our outer contour gap size depends on what our linked node is, so we must recalculate our gap size whenever our linked node is set.

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

Reimplemented from GeometryLinkedAttrValue.

Definition at line 1378 of file fthrattr.cpp.

01379 {
01380     m_pLinkedNode = pNode;
01381 
01382     if (pNode != NULL)
01383     {
01384         if (IS_A(GetLinkedNode(), NodeGroup) ||
01385             IS_A(GetLinkedNode(), NodeMould) ||
01386             IS_A(GetLinkedNode(), NodeBlend) ||
01387             GetLinkedNode()->IsANodeClipViewController())
01388         {
01389             m_GapSize = DEFAULT_GAP_TOLERANCE_MP;
01390         }
01391         else
01392         {
01393             m_GapSize = 1;
01394         }
01395     }
01396 }

void FeatherAttrValue::SetOuterContour Path pNewOuterContour  )  [inline]
 

Definition at line 267 of file fthrattr.h.

00267 { m_pOuterContour = pNewOuterContour; }

BOOL FeatherAttrValue::SetupFeather Node pNode,
INT32  Width = ((MILLIPOINT) ( 2  * PX_MP_VAL)),
UnitType  type = MILLIPOINTS
 

Setup feather member variables so that it is created properly on rendering.

type - which measurment used for size

See also:
OpFeather::Do

Definition at line 1219 of file fthrattr.cpp.

01220 {
01221     // Get required feather size in Millipoints, taking current zoom into account
01222     // if width specified in Pixels
01223     MILLIPOINT BlurSize = ConvertMeasurementToMillipointsAtCurrentViewScale(Width,type);
01224     if (BlurSize == -1)
01225         BlurSize = DEFAULT_FEATHERSIZE_MP;
01226     SetFeatherSize(BlurSize);
01227 
01228     // Save pointer to node so we can get at it in the rendering code.
01229     SetLinkedNode((NodeRenderableBounded*) pNode);
01230 
01231 #ifdef _DEBUG_OFFSCREEN_PIXEL_WIDTH
01232     RenderDebuggingBitmaps(NULL, pNode, 1.0, 32, FALSE);
01233 #endif
01234 
01235     return TRUE;
01236 }

void FeatherAttrValue::SetupFeatherBitmapPalette KernelBitmap pFeatherBMP  )  [private]
 

Definition at line 1113 of file fthrattr.cpp.

01114 {
01115     LPRGBQUAD pPalette = pFeatherBMP->GetPaletteForBitmap();
01116 
01117     // Using linear palette
01118     // For some reason we have to initialise the palette even though the rendering
01119     // code sets up the palette using the profile which is attached to the bitmap
01120     // transparency attribute which contains the feather bitmap mask.
01121     for (INT32 i = 0; i < 256; i ++)
01122     {
01123         pPalette[i].rgbRed = pPalette[i].rgbBlue = pPalette[i].rgbGreen = (BYTE)i;
01124         pPalette[i].rgbReserved = 0x00;
01125     }
01126 
01127     // Mark this bitmap as being greyscale to avoid re-conversion by GetGreyscaleVersion
01128     pFeatherBMP->SetAsGreyscale();
01129 }

void FeatherAttrValue::SimpleCopy AttributeValue  )  [virtual]
 

Reimplemented from OffscreenAttrValue.

Definition at line 336 of file fthrattr.cpp.

00337 {
00338     ERROR3IF(!pVal->IS_KIND_OF(FeatherAttrValue), "Incorrect runtime class passed to FeatherAttrValue::SimpleCopy");
00339     FeatherAttrValue* pFthr = (FeatherAttrValue*) pVal;
00340 
00341     m_Profile = pFthr->m_Profile;
00342     SetFeatherSize(pFthr->GetFeatherSize());
00343     m_GapSize = pFthr->m_GapSize;
00344 
00345 // NOTE! Don't copy m_outerContour because callers assume that this will
00346 // not be copied and rely on it being regenerated on demand. Urgh!
00347     // Remember to copy or blank cached path data without leaking memory...
00348     if (m_pOuterContour)
00349         delete m_pOuterContour;
00350     m_pOuterContour = NULL;
00351 /*
00352     Path* pSrcPath = pFthr->GetOuterContour();
00353     if (pSrcPath)
00354     {
00355         m_pOuterContour = new Path();
00356         m_pOuterContour->Initialise(pSrcPath->GetNumCoords());
00357         m_pOuterContour->CopyPathDataFrom(pSrcPath);
00358     }
00359 */
00360     // preserves default flag to avoid confusion when copying CCAttrMaps
00361     GeometryLinkedAttrValue::SimpleCopy(pVal);
00362 }


Member Data Documentation

BOOL FeatherAttrValue::m_bCached [private]
 

Definition at line 281 of file fthrattr.h.

DocRect FeatherAttrValue::m_drFeatherBB [private]
 

Definition at line 279 of file fthrattr.h.

MILLIPOINT FeatherAttrValue::m_FeatherSize [private]
 

Definition at line 275 of file fthrattr.h.

MILLIPOINT FeatherAttrValue::m_GapSize [private]
 

Definition at line 276 of file fthrattr.h.

Path* FeatherAttrValue::m_pOuterContour [private]
 

Definition at line 277 of file fthrattr.h.

CProfileBiasGain FeatherAttrValue::m_Profile [private]
 

Definition at line 274 of file fthrattr.h.

const MILLIPOINT FeatherAttrValue::MaxUserFeatherSize = 37500 [static, private]
 

Definition at line 285 of file fthrattr.h.


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