PathProcessorBrush Class Reference

This path processor renders the new brush objects in place of the paths that are passed to it. It contains many variant members which can affect the placing, scaling and other aspects of the objects that are rendered. The ink objects that are actually rendered come from a BrushDefinition object. The path processor maintains a pointer to an AttrBrushType which is the attribute node that 'owns' the processor. More...

#include <ppbrush.h>

Inheritance diagram for PathProcessorBrush:

PathProcessor CCObject SimpleCCObject BlendedPathProcessorBrush List of all members.

Public Member Functions

 PathProcessorBrush ()
 Constructor.
 ~PathProcessorBrush ()
 Destructor - basically this just wipes the caches.
virtual void ProcessPath (Path *pPath, RenderRegion *pRender, PathShape ShapePath=PATHSHAPE_PATH)
 Called by the RenderRegion to apply the path processing operation to the given path.
virtual BOOL WillChangeFillAndBrushSeparately (void)
 Called by the RenderRegion to determine if this PathProcessorBrush affects the "fill" and "Brush" portions of the path separately. (Generally speaking, only fill/Brush providers will cause these two different "bits" of a path to be rendered separately). This call is made BEFORE this Processor's ProcessPath function will be called.
virtual BOOL IsAPathProcessorBrush ()
 Virtual identifier.
virtual BOOL IsDifferent (PathProcessorBrush *pOther)
 Equality operator.
virtual PathProcessorBrushClone (void)
 To copy PathProcessorBrush or derived-class object.
virtual BOOL NeedsTransparency (void) const
virtual BOOL IsBlended ()
virtual BOOL DoBecomeA (BecomeA *pBecomeA, Path *pPath, Node *pParent)
 To convert our brush into its individual paths and attributes, very similar to the bounding box routine in that we extract the path from our parent node and use it to calculate our blenpaths etc.
virtual BOOL DoesActuallyDoAnything (RenderRegion *pRender)
 To determine whether or not our path processor is 'default' i.e. if does not change the path at all. If so then the render region will be free to use DrawPathToOutputDevice which will let us use dash patterns, arrowheads etc.
BOOL WriteNative (BaseCamelotFilter *pFilter)
 Writes out a record that represents the processor, to either Native or Web file format.
DocRect CalculateBoundingBox (Path *pPath, NodeRenderableInk *pParent)
 Calculates the bounding rect, unfortunately the only way to do this is to do a 'fake' render. So this function is essentially the same as processpath but it doesn't require a render region.
DocRect TimeStampBoundingBox ()
 Calculates the bounding rect, unfortunately the only way to do this is to do a 'fake' render. So this function is essentially the same as processpath but it doesn't require a render region.
void SetCalculateBoundingBox (BOOL Set)
 Sets the flag indicating whether or not to calculate the bounding rect on the next pass through RenderBrushAtPoint.
DocRect GetCachedRect ()
 access fn.
INT32 GetObjectCountToDistance (MILLIPOINT Distance)
 To find out how many brush objects we will have in the distance given.
MILLIPOINT GetDistanceToObject (UINT32 ObjectNum)
 Finds out at what we distance we place the ObjectNum'th object.
MILLIPOINT GetSpacingAtDistance (MILLIPOINT Distance)
 If we are Distance along our path then thif function finds out how far it would be to the next brush object.
BOOL GetSpacingAndScalingAtDistance (MILLIPOINT Distance, MILLIPOINT *pSpacing, double *pScaling, UINT32 *pPressure=NULL)
 Retrieves the values for spacing, scaling and pressure, that are in effect at Distance along the path.
BOOL AdvanceBrushToDistance (MILLIPOINT Distance)
 Advances the member variables in this PPB to the values they would acquire if the given distance were to be rendered. Basically another variant on GetSpacing AtDistance.
UINT32 GetLastObject ()
 The last object member keeps track of which object to render next as we proceed along the path.
BOOL IsThisPathProcessorOnTheStack (RenderRegion *pRender)
 as above
void AdjustSpacingForClosedPath (NodeRenderableInk *pInk)
 When we apply a brush to a closed path we want to adjust the spacing so that the distance between the start object and the end object is the same as the distance between the start object and the second object. Here we check to see if the ink node is a single shape that produces a closed path (no groups etc.). We will then get the length of that path and try to get the best spacing value.
void AdjustSpacingForClosedPath (Path *pPath, double dPathLength)
 When we apply a brush to a closed path we want to adjust the spacing so that the distance between the start object and the end object is the same as the distance between the start object and the second object. Here we check to see if the ink node is a single shape that produces a closed path (no groups etc.). We will then get the length of that path and try to get the best spacing value.
void SetBrushDefinition (BrushHandle Handle)
 Sets this path processor up to use the given vector Brush definition in all future rendering.
BrushHandle GetBrushDefinitionHandle (void)
 As above.
virtual BrushDefinitionGetOurBrushDefinition ()
 As above.
MILLIPOINT GetSpacing (void)
 As above.
BOOL SetSpacing (MILLIPOINT Spacing)
 To set the spacing between brush objects.
BOOL SetSpacingIncrProp (double Incr)
 To set the spacing increment between brush objects.
double GetSpacingIncrProp ()
 As above.
BOOL SetSpacingIncrConst (MILLIPOINT Incr)
 To set the proportional spacing increment between brush objects.
MILLIPOINT GetSpacingIncrConst ()
 As above.
UINT32 GetSpacingMaxRand ()
 As above.
BOOL SetSpacingMaxRand (UINT32 Value)
 As above.
UINT32 GetSpacingRandSeed ()
 As above.
BOOL SetSpacingRandSeed (UINT32 Value)
 As above.
void SetSpacingRandCache (UINTArray *pArray)
BOOL SetSpacingMaxPressure (UINT32 NewMax)
 As above.
UINT32 GetSpacingMaxPressure ()
 As above.
MILLIPOINT GetLastSpacing ()
 As above.
PathOffset GetPathOffsetType (void)
 as above
MILLIPOINT GetPathOffsetValue (void)
 as above
void SetPathOffsetType (PathOffset Offset)
 to set the offset type for this brush
void SetPathOffsetValue (MILLIPOINT Value)
 to set the offset distance for this brush
BOOL SetPathOffsetIncrProp (double Incr)
 to set the offset distance for this brush
double GetPathOffsetIncrProp ()
 as above
BOOL SetPathOffsetIncrConst (MILLIPOINT Incr)
 to set the offset distance for this brush
MILLIPOINT GetPathOffsetIncrConst ()
 as above
void SetOffsetTypeRandCache (UINTArray *pArray)
UINT32 GetOffsetTypeRandSeed ()
 As above.
BOOL SetOffsetTypeRandSeed (UINT32 Seed)
 As above.
UINT32 GetOffsetValueMaxRand ()
 As above.
BOOL SetOffsetValueMaxRand (UINT32 Value)
 As above.
UINT32 GetOffsetValueRandSeed ()
 As above.
BOOL SetOffsetValueRandSeed (UINT32 Seed)
 As above.
void SetOffsetValueRandCache (UINTArray *pArray)
void SetTiling (BOOL Value)
 When a brush tiles it means that the attribute types:
  • 3 colour fill
  • 4 colour fill
  • bitmap fill are only rendered once per brush, rather than for every brush step.

BOOL IsTiled ()
 as above
BOOL SetRotationAngle (double Angle)
 as above
double GetRotationAngle ()
 as above
double GetRotationIncrConst ()
 as above
BOOL SetRotationIncrConst (double Value)
 as above
double GetRotationIncrProp ()
 as above
BOOL SetRotationIncrProp (double Value)
 as above
void SetRotated (BOOL Value)
 as above
BOOL IsRotated ()
 as above
UINT32 GetRotationMaxRand ()
 as above
BOOL SetRotationMaxRand (UINT32 Value)
 as above
UINT32 GetRotationRandSeed ()
 as above
void SetRotationRandSeed (UINT32 Seed)
 as above
UINT32 GetRotationMaxPressure ()
 as above
BOOL SetRotationMaxPressure (UINT32 Value)
 as above
double GetBrushScaling ()
 as above
BOOL SetBrushScaling (double Scale)
 to set the member that determine to what scale of the original object each brush object is drawn
double GetBrushScalingIncr ()
 as above
BOOL SetBrushScalingIncr (double Incr)
 to set the member that determine the increment to scaling applied to each brush object Note that the scaling MUST be set before this is called
double GetBrushScalingIncrConst ()
 as above
BOOL SetBrushScalingIncrConst (double Value)
 to set the member that determine the increment to scaling applied to each brush object
UINT32 GetScalingMaxRand ()
 As above.
BOOL SetScalingMaxRand (UINT32 Value)
 As above.
UINT32 GetScalingRandSeed ()
 As above.
BOOL SetScalingRandSeed (UINT32 Value)
 As above.
UINT32 GetScalingMaxPressure ()
 As above.
BOOL SetScalingMaxPressure (UINT32 Max)
 As above.
double GetLastScaling ()
 As above.
void SetScaleToLineWidth (BOOL Value)
 as above
BOOL IsScalingToLineWidth ()
void ScaleToValue (MILLIPOINT Width, BOOL IgnorePressure=FALSE)
 Scales the brush object such that the height of the largest object is equal to Value. Note that as of 27/10/2000 this must incorporate offset, scaling and rotation values.
double GetScaleValue (MILLIPOINT Width)
 as above, but simply retuns the value
double GetHueIncrement ()
 as above
BOOL SetHueIncrement (double Incr)
 as above
UINT32 GetHueMaxRand ()
 as above
BOOL SetHueMaxRand (UINT32 Max)
 as above
UINT32 GetHueRandSeed ()
 as above
BOOL SetHueRandSeed (UINT32 Seed)
 as above
double GetSatIncrement ()
 as above
BOOL SetSatIncrement (double Incr)
 as above
UINT32 GetSatMaxRand ()
 as above
BOOL SetSatMaxRand (UINT32 Max)
 as above
UINT32 GetSatRandSeed ()
 as above
BOOL SetSatRandSeed (UINT32 Seed)
 as above
SequenceType GetSequenceType ()
 as above
void SetSequenceType (SequenceType Type)
 as above
UINT32 GetSequenceSeed ()
 as above
void SetSequenceSeed (UINT32 Seed)
 as above
BOOL GetUseLocalFillColour ()
 as above
void SetUseLocalFillColour (BOOL UseLocal)
 if this flag is set to TRUE, then the cached fill will not be used when rendering. Instead the nearest stroke colour will be rendered. This is so that people can drop colours onto the brush.
BOOL GetUseLocalTransp ()
 as above
void SetUseLocalTransp (BOOL)
 if this flag is set to TRUE then any cached transparencies will not be rendered. Instead the transparency applied to our parent ink object will be rendered.
BOOL GetUseNamedColours ()
 as above
void SetUseNamedColours (BOOL Value)
 if this flag is set to FALSE then any named colours in our brush will not be rendered, instead we will use the local stroke colour
INT32 GetBrushTransparency ()
 as above
BOOL SetBrushTransparency (INT32 Value)
 as above
UINT32 GetTransparencyPressure ()
 Sets the extent to which pressure affects transparency.
BOOL SetTransparencyPressure (UINT32 Value)
 Sets the extent to which pressure affects transparency.
UINT32 GetNumBrushObjects ()
 as above
void SetParentAttribute (AttrBrushType *pAttr)
 as above
AttrBrushTypeGetParentAttribute ()
 returns the attribute associated with this ppb
void SetMaxScaling (double Scale)
 as above
void SetCurrentPressure (UINT32 Pressure)
 As above.
UINT32 GetCurrentPressure ()
 As above.
void CopyBrushData (BrushData *pData)
 copies the info from the path processor to the brushdata object
void CopyDataFromObject (BrushData *pData)
 copies the info from the brushdata object to the processor
MILLIPOINT GetBrushSize (BOOL IgnorePressure=FALSE)
 as above
void SetStrokeColour (DocColour Col)
 if the brush is overriding colours then this function can be used to set the stroke colour to use. Although this will be set automatically in ProcessPath. Mostly for use by OpDrawBrush
void RenderBrushAtPoint (DocCoord Point, double Angle, UINT32 BrushObjectIndex, UINT32 Counter, RenderRegion *pRender, HandleBrushBecomeA *pBecomeA=NULL, BOOL RealtimeBrush=FALSE, BrushDefinition *pBrushDefinition=NULL)
 Multipurpose ! Renders a brush object at the point specified if we supply a render region, or calculates the bounding box of the brush at this point and adds it to our cached rect, or makes calls PassBack for our BecomeA object.Multipurpose ! Renders a brush object at the point specified if we supply a render region, or calculates the bounding box of the brush at this point and adds it to our cached rect, or makes calls PassBack for our BecomeA object.
BOOL ResetRandomNumberGenerators ()
 Seeds srand with either the seed supplied or by using time (i.e. a random seed) as above, note that you MUST have already seeded the sequence as above, note that you MUST have already seeded the sequence to reset all the random number generators so that they repeat their sequence from the beginning. Call this prior to rendering.
CDistanceSamplerGetPressureCacheAndInitialise ()
 This should be called to get the pressure cache from the attribute and to set up the relevant members when we wish to start retrieving pressure data from the beginning.
CDistanceSamplerGetPressureCacheAndInitialise (RenderRegion *pRegion, ValueFunction **ppValFunc)
 This should be called to get the pressure cache from the attribute and to set up the relevant members when we wish to start retrieving pressure data from the beginning.
CDistanceSamplerGetPressureCacheAndInitialise (NodeRenderableInk *pInkNode, ValueFunction **ppValFunc)
 This should be called to get the pressure cache from the attribute and to set up the relevant members when we wish to start retrieving pressure data from the beginning.
void SwitchAlternateValue ()
void Reset ()
 Sets the various members etc. to the values that they must hold at the beginning of any of the following:
  • Rendering;
  • Bounding box calculation;
  • Convert to shapes;
  • GetObjectCount;.

double GetNextScaling (UINT32 Index)
 Pretty much as above, but with the following notes: There are several different ways of applying a rotation angle to brush objects:.
MILLIPOINT GetNextSpacing ()
 Returns the next spacing to use, this can be determined in several ways, as with the other object placement attributes.
UINT32 GetNextInkObject (UINT32 LastObject, UINT32 NumObjects)
 as above
UINT32 GetNextOffsetType ()
 as above
void SetNextOffsetType ()
 Asks the processor to determine its next offset type and record it in a data member. This only occurs if the processor has its path offset type set to random. If you are calling RenderBrushAtPoint externally rather than from ProcessPath then you should call this for each ink object.
BOOL PrepareForRenderingLoop (UINT32 NumBrushObjects)
 Prepares the caches that we will use to store data about the transformations performed during rendering. Currently only scaling has been implemented but we should also get rotation and tangential information too. This should be called sometime after calling Reset and before you start actually rendering.
void CleanUpAfterRender ()
 deletes the caches that we used to store rendering data
BOOL SetLastRenderedData (UINT32 BrushObject, double Scaling, double Tangent, double Rotation)
 Should be called to update the caches that store our cached transformation data so that we only have to perform changes in transformations. Currently only OpDrawBrush need call this as the normal path processor rendering loop updates itself, though this may change. Note also that the rotation and tangent data are not yet used.
void DecideWhetherToUseActualScaling (UINT32 BrushObject)
 Decides whether or not to set the UseActualScaling flag for the next call of GetNextScaling. Basically if we have not rendered this object before then the scaling we wish to use will be the absolute scaling. However subsequently we only wish to know about scaling changes. This function is called by OpDrawBrush::RenderStepsForTime, and ProcessPath.

Static Public Member Functions

static void GetRandomLimits (UINT32 Base, UINT32 MaxRand, UINT32 *pLower, UINT32 *pUpper)
 To determine the upper and lower bounds of a random range.
static void GetRotationRandomLimits (UINT32 Base, UINT32 MaxRand, UINT32 *pLower, UINT32 *pUpper)
 To determine the upper and lower bounds of a random range, differs from the above function in that the maximum rotation random factor is different.

Protected Member Functions

void RenderAttributes (RenderRegion *pRender, CCAttrMap *pAttrMap, CHSVChanger *pReplacer, CTransparencyReplacer *pTranspRep)
 Renders the attributes to the given render region. This function has ended up being really messy because people have insisted on being able to override various of the cached attributes. Heres a brief rundown:
  • m_bUseLocalFillColour means that we use to fill colour closest to our attribute node instead of the cached fill colour. Note that if m_bUseLocalFillColour is FALSE we may still use the local fill colour instead of our Named colours.
  • Instead of our cached transparency we may choose not to render transparency, thereby letting the previously rendered transparency apply to our brush objects.

void AdjustFillAttributes (CCAttrMap *pAttrMap, CHSVChanger *pReplacer, CTransparencyReplacer *pTransRep)
DocCoord AdjustPositionForOffset (DocCoord OriginalPosition, double Angle, double Scaling, MILLIPOINT, UINT32 OffsetType)
 To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.
DocCoord AdjustPositionForBlendPathOffset (DocCoord OriginalPosition, BlendPathOffset *pOffset, double Scaling, double Angle)
 To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.
void AddPointsInRectToList (DocRect Rect, Path *pPath, CPathPointList *pList)
void AddAllPointsToList (Path *pPath, CPathPointList *pList)
BOOL GetPointAtDistance (Path *pPath, MILLIPOINT Distance, DocCoord *pPoint, double *pTangent)
 Gets the coordinate of a point a certain distance along this path, either by looking in its cache pr by calling the Path class function.
void RenderTimeStampPoints (RenderRegion *pRender)
 Accesses the timestamp cache of the parent attribute and tests its points against the bounds of the render region, rendering them if they are inside.
INT32 HowManyObjectsInDistance (MILLIPOINT Distance)
 as above
UINT32 GetCurrentPressureEffect (UINT32 MaxEffect, BOOL FixedMax=FALSE)
 Simply pass in the maximum effect that you allow and this returns the effect caused by the current pressure value.
void AdjustAndRenderTransparency (RenderRegion *pRender, AttrFillGeometry *pAttrTransp, CTransparencyReplacer *pRep)
double GetNextAngle ()
 Pretty much as above, but with the following notes: There are several different ways of applying a rotation angle to brush objects:.
MILLIPOINT GetNextOffset ()
 as above
double GetNextSaturationMultiplier ()
 this differs slightly from the other GetNext functions in that it does not return a saturation value. Instead it returns a multiplier value which should be given to an HSVChanger object, the HSVChanger should then apply that multiplier to the colours in the brush
double GetNextHueMultiplier ()
 this differs slightly from the other GetNext functions in that it does not return a hue value. Instead it returns a multiplier value which should be given to an HSVChanger object, the HSVChanger should then apply that multiplier to the colours in the brush
double GetNextTransparencyAdjust ()
double GetNextPressureTranspAdjust ()
 as above, currently the only thing that affects transparency is pressure. Note that -1 indicates that we are not adjusting transparency
BOOL ObjectIsWithinRect (DocRect Rect, DocCoord Centre, MILLIPOINT HalfWidth, MILLIPOINT HalfHeight, double Scaling, double Angle=0)
 as above
CSampleItem GetNextSampleItem (CDistanceSampler *pSampler, ValueFunction *pValFunc, double PathProportion=0)
 Your one stop shop for getting the next pressure value to use. Note that we may not be using pressure at all in which case all of the inputs will be NULL.

Protected Attributes

BrushHandle m_BrushHandle
double m_LastScalingRendered
BOOL * m_pObjectRendered
BOOL m_UseActualScaling
double * m_pLastScalingRendered
double * m_pLastTangent
double * m_pLastRotation
DocColour m_CurrentStrokeCol
BOOL m_DisableMe
MILLIPOINT m_BrushSpacing
double m_BrushSpacingIncrProp
MILLIPOINT m_BrushSpacingIncrConst
UINT32 m_BrushSpacingMaxRand
UINT32 m_BrushSpacingRandSeed
UINT32 m_SpacingMaxPressure
MILLIPOINT m_LastSpacing
BOOL m_bTile
BOOL m_bRotate
double m_RotateAngle
double m_RotAngleIncrProp
double m_RotAngleIncrConst
double m_LastAngle
UINT32 m_RotationMaxRand
UINT32 m_RotationRandSeed
UINT32 m_RotationMaxPressure
PathOffset m_PathOffsetType
MILLIPOINT m_PathOffsetValue
double m_PathOffsetIncrProp
MILLIPOINT m_PathOffsetIncrConst
UINT32 m_OffsetMaxPressure
MILLIPOINT m_LastOffset
UINT32 m_LastOffsetType
UINT32 m_OffsetTypeRandSeed
UINT32 m_OffsetValueMaxRand
UINT32 m_OffsetValueRandSeed
double m_BrushScaling
double m_BrushScalingIncr
double m_BrushScalingIncrConst
double m_LastScaling
double m_CurrentScaling
UINT32 m_BrushScalingMaxRand
UINT32 m_BrushScalingRandSeed
UINT32 m_ScalingMaxPressure
double m_BrushHueIncrement
UINT32 m_BrushHueMaxRand
UINT32 m_BrushHueRandSeed
UINT32 m_HueMaxPressure
double m_LastHueMultiplier
double m_BrushSatIncrement
UINT32 m_BrushSatMaxRand
UINT32 m_BrushSatRandSeed
UINT32 m_SatMaxPressure
double m_LastSatMultiplier
SequenceType m_SequenceType
UINT32 m_SequenceRandSeed
BOOL m_MirrorSeqAscend
BOOL m_bUseLocalFillColour
BOOL m_bUseLocalTransp
BOOL m_bUseNamedColours
INT32 m_BrushTransparency
UINT32 m_TranspMaxPressure
UINT32 m_TimeStampMaxPressure
UINT32 m_AltValue
MILLIPOINT m_LineWidth
BOOL m_bScaleToLineWidth
BOOL m_bRenderAllAttributes
AttrBrushTypem_pParentAttr
PressureItem m_CurrentPressure
DocRect m_CachedRect
BOOL m_bCalculateRect
BOOL m_bValidPressure
AttrFlatTranspFillm_pDefaultTransp
MILLIPOINT m_LastSpacingNoRandom
MILLIPOINT m_LastOffsetNoRandom
double m_LastScalingNoRandom
double m_LastRotationNoRandom
double m_MaxScaling
UINT32 m_LastObject
MTRandm_pSpacingRNG
MTRandm_pScalingRNG
MTRandm_pOffsetTypeRNG
MTRandm_pOffsetValueRNG
MTRandm_pRotationRNG
MTRandm_pSaturationRNG
MTRandm_pHueRNG
MTRandm_pSequenceRNG

Private Member Functions

 CC_DECLARE_DYNAMIC (PathProcessorBrush)

Detailed Description

This path processor renders the new brush objects in place of the paths that are passed to it. It contains many variant members which can affect the placing, scaling and other aspects of the objects that are rendered. The ink objects that are actually rendered come from a BrushDefinition object. The path processor maintains a pointer to an AttrBrushType which is the attribute node that 'owns' the processor.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/12/96
See also:
RenderRegion::DrawPath; PathProcessor::ProcessPath

Definition at line 150 of file ppbrush.h.


Constructor & Destructor Documentation

PathProcessorBrush::PathProcessorBrush  ) 
 

Constructor.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99

Definition at line 175 of file ppbrush.cpp.

00176 {
00177     m_AltValue = 0;
00178     m_BrushSpacing = 10000;
00179     m_bScaleToLineWidth = TRUE;
00180     m_LineWidth = -1;
00181     m_pParentAttr = NULL;
00182 
00183     m_BrushScaling          = 1.0;
00184     m_BrushScalingIncr      = 1.0;
00185     m_BrushScalingIncrConst = 0.0;
00186     m_BrushScalingMaxRand   = 0;
00187     m_BrushScalingRandSeed  = 0;
00188     m_ScalingMaxPressure    = 0;
00189 
00190     m_BrushSpacingIncrProp  = 1.0;
00191     m_BrushSpacingIncrConst = 0;
00192     m_BrushSpacingMaxRand   = 0;
00193     m_BrushSpacingRandSeed  = 5;
00194     m_SpacingMaxPressure    = 0;
00195 
00196     m_RotationMaxRand       = 0;
00197     m_RotationRandSeed      = 0;
00198 #ifdef USE_MTRNG
00199     m_pSpacingRNG           = NULL;
00200     m_pScalingRNG           = NULL;
00201     m_pOffsetTypeRNG        = NULL;
00202     m_pOffsetValueRNG       = NULL;
00203     m_pRotationRNG          = NULL;
00204     m_pSaturationRNG        = NULL;
00205     m_pHueRNG               = NULL;
00206     m_pSequenceRNG          = NULL;
00207 #endif
00208     m_PathOffsetIncrProp = 1.0;
00209     m_PathOffsetIncrConst = 0;
00210 
00211     m_SequenceType            = SEQ_FORWARD;
00212     m_SequenceRandSeed        = 0;
00213 
00214     m_OffsetTypeRandSeed      = 0;
00215     m_bUseLocalFillColour = FALSE;
00216     m_bUseLocalTransp     = FALSE;
00217     m_bUseNamedColours    = TRUE;
00218     m_CurrentPressure.m_Pressure = MAXPRESSURE / 2;
00219     m_bCalculateRect  = FALSE;
00220 
00221     m_RotateAngle = 0.0;
00222     m_RotAngleIncrProp = 1.0;
00223     m_RotAngleIncrConst = 0;
00224     
00225     m_BrushSatMaxRand = 0;
00226     m_BrushSatRandSeed = 0;
00227     m_BrushHueMaxRand = 0;
00228     m_BrushHueRandSeed = 0;
00229     m_BrushHueIncrement = 1.0;
00230     m_BrushSatIncrement = 1.0;
00231 
00232     m_LastOffset = 0;   
00233     m_LastScaling = 10000;
00234     m_LastObject = 0;
00235 
00236     m_pObjectRendered = NULL;
00237     m_pLastScalingRendered = NULL;
00238     m_pLastTangent  = NULL;
00239     m_pLastRotation = NULL;
00240 
00241     m_BrushTransparency = 100;
00242     m_TranspMaxPressure = 0;
00243 
00244     // we have to allocate our 'dummy' transparency attribute, which we must use in order to 
00245     // prevent transparency from one blendpath being 'carried over' to other blendpaths.
00246     m_pDefaultTransp = NULL;
00247     
00248     m_pDefaultTransp = new AttrFlatTranspFill;
00249     if (m_pDefaultTransp != NULL)
00250     {
00251         TranspFillAttribute* pVal = (TranspFillAttribute*)m_pDefaultTransp->GetAttributeValue();
00252         if (pVal != NULL)
00253             pVal->Transp = 0;
00254     }
00255 }

PathProcessorBrush::~PathProcessorBrush  ) 
 

Destructor - basically this just wipes the caches.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99

Definition at line 270 of file ppbrush.cpp.

00271 {
00272 
00273 #ifdef USE_MTRNG
00274     if (m_pSpacingRNG != NULL)
00275         delete m_pSpacingRNG;
00276     if (m_pScalingRNG != NULL)
00277         delete m_pScalingRNG;
00278     if (m_pOffsetTypeRNG != NULL)
00279         delete m_pOffsetTypeRNG;
00280     if (m_pOffsetValueRNG != NULL)
00281         delete m_pOffsetValueRNG;
00282     if (m_pRotationRNG != NULL)
00283         delete m_pRotationRNG;
00284     if (m_pSaturationRNG != NULL)
00285         delete m_pSaturationRNG;
00286     if (m_pHueRNG != NULL)
00287         delete m_pHueRNG;
00288     if (m_pSequenceRNG != NULL)
00289         delete m_pSequenceRNG;
00290 #endif
00291 
00292     if (m_pDefaultTransp != NULL)
00293         delete m_pDefaultTransp;
00294 }


Member Function Documentation

void PathProcessorBrush::AddAllPointsToList Path pPath,
CPathPointList pList
[protected]
 

void PathProcessorBrush::AddPointsInRectToList DocRect  Rect,
Path pPath,
CPathPointList pList
[protected]
 

void PathProcessorBrush::AdjustAndRenderTransparency RenderRegion pRender,
AttrFillGeometry pAttrTransp,
CTransparencyReplacer pRep
[protected]
 

Definition at line 1786 of file ppbrush.cpp.

01788 {
01789     if (pRender == NULL || pAttrTransp == NULL || pRep == NULL)
01790         return;
01791 
01792     if (!pAttrTransp->IsATranspFill())
01793     {       
01794         ERROR3("Attribute is not transparent in PathProcessorBrush::AdjustAndRenderTransparency");
01795         return;
01796     }
01797 
01798     TranspFillAttribute* pTranspVal = (TranspFillAttribute*)pAttrTransp->GetAttributeValue();
01799     if (pTranspVal != NULL)
01800     {
01801         // see if our parent attr has a local transparency value, if so we will use that
01802         if (m_pParentAttr != NULL)
01803         {
01804             UINT32 ReplaceVal = m_pParentAttr->GetLocalTranspValue();
01805             if (ReplaceVal > 0)
01806                 pRep->SetReplacementValue((INT32)ReplaceVal);
01807             UINT32 Type = m_pParentAttr->GetLocalTranspType();
01808             pTranspVal->SetTranspType(Type);
01809         }
01810         pRep->SetTransparencyAttr(pTranspVal);
01811         pRep->ReplaceTransparency();
01812     }
01813 
01814     pAttrTransp->Render(pRender);
01815 }

void PathProcessorBrush::AdjustFillAttributes CCAttrMap pAttrMap,
CHSVChanger pColChange,
CTransparencyReplacer pTranspRep
[protected]
 

See also:
-

Definition at line 1837 of file ppbrush.cpp.

01839 {
01840     if (pAttrMap == NULL || pColChange == NULL || pTranspRep == NULL)
01841     {
01842         ERROR3("Invalid inputs to PathProcessorBrush::AdjustFillAttributes");
01843         return;
01844     }
01845 
01846 
01847     // lets find our attributes
01848     CCRuntimeClass     *pType;
01849     void               *pVal;
01850     NodeAttribute      *pNodeAttr;
01851     
01852     BOOL FoundTransp = FALSE;
01853 
01854     // iterating all (key, value) pairs
01855     for( CCAttrMap::iterator Pos = pAttrMap->GetStartPosition(); Pos != pAttrMap->GetEndPosition(); )
01856     {
01857         // Get attr at position Pos
01858         pAttrMap->GetNextAssoc(Pos,pType,pVal);
01859 
01860         // pVal is actually an attribute, so get a ptr to it and render it
01861         pNodeAttr = (NodeAttribute *)pVal;
01862 
01863         if (pNodeAttr->IsAColourFill())
01864         {
01865             if (!m_bUseLocalFillColour)
01866             {
01867                 
01868                 //first find out if we have a named colour
01869                 ColourFillAttribute* pVal = (ColourFillAttribute*)pNodeAttr->GetAttributeValue();
01870                 if (pVal->ContainsNamedColour())
01871                 {
01872                     if (!m_bUseNamedColours)
01873                     {
01874                         // we need to initialise the Replacer with our attribute and the local
01875                         // stroke colour
01876                         if (m_pParentAttr != NULL && pColChange != NULL)
01877                         {
01878                             DocColour Col = m_CurrentStrokeCol;
01879                             pColChange->Initialise(pVal, &Col);
01880                             pColChange->ReplaceColours();
01881 
01882                         }
01883                         // note that CNamedColorReplacer::RestoreColours() MUST be called AFTER 
01884                         // DrawPaths in the render routine, if it is not the the colours are permanently replaced.
01885                     }
01886                 }
01887 
01888                 // change HSV values if we need to
01889                 if (pColChange->ShouldChangeHSV())
01890                 {
01891                     pColChange->SetColourFill(pVal);
01892                     pColChange->ChangeHSVValues();
01893                 }
01894 
01895             }
01896         
01897         }
01898         if (pNodeAttr->IsATranspFill())
01899         {
01900             TranspFillAttribute* pTranspVal = (TranspFillAttribute*)pNodeAttr->GetAttributeValue();
01901             if (pTranspVal != NULL)
01902             {
01903                 // see if our parent attr has a local transparency value, if so we will use that
01904                 if (m_pParentAttr != NULL)
01905                 {
01906                     UINT32 ReplaceVal = m_pParentAttr->GetLocalTranspValue();       
01907                     if (ReplaceVal > 0)
01908                     {
01909                         pTranspRep->SetReplacementValue((INT32)ReplaceVal);
01910                         UINT32 Type = m_pParentAttr->GetLocalTranspType();
01911                         pTranspVal->SetTranspType(Type);
01912                     }
01913 
01914                 }
01915                 
01916                 pTranspRep->SetTransparencyAttr(pTranspVal);
01917                 pTranspRep->ReplaceTransparency();
01918                 FoundTransp = TRUE;
01919             }
01920         }
01921         
01922     }
01923     
01924     // if we didn't find a transparency attribute then we might have to make one
01925     if (FoundTransp == FALSE)
01926     {
01927         AttrFlatTranspFill* pTransp = new AttrFlatTranspFill;
01928         if (m_pParentAttr != NULL && pTransp != NULL)
01929         {
01930             // get the transparency value of our parent
01931             UINT32 TranspVal = m_pParentAttr->GetLocalTranspValue();        
01932             TranspFillAttribute* pTranspVal = (TranspFillAttribute*)pTransp->GetAttributeValue();
01933             pTranspVal->Transp = TranspVal;
01934             
01935             UINT32 Type = m_pParentAttr->GetLocalTranspType();
01936             pTranspVal->SetTranspType(Type);
01937 
01938             // add it to the map
01939             pAttrMap->SetAt( CC_RUNTIME_CLASS(AttrFlatTranspFill), (void*)pTransp );
01940 
01941             // now do the replacing
01942             pTranspRep->SetTransparencyAttr(pTranspVal);
01943             pTranspRep->ReplaceTransparency();
01944 
01945         }
01946 
01947     }
01948 }

DocCoord PathProcessorBrush::AdjustPositionForBlendPathOffset DocCoord  OriginalPoint,
BlendPathOffset pOffset,
double  Scaling,
double  Angle
[protected]
 

To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
OriginalPoint - the point on the line at the correct distance for us to draw an object [INPUTS] Offset - the blendpathoffset for this blendpath Scaling Angle
- [OUTPUTS]
Returns:
the new position where we wish the object to be drawn
See also:
-

Definition at line 2078 of file ppbrush.cpp.

02080 {
02081     if (pOffset->m_XOffset == 0 && pOffset->m_YOffset == 0)
02082         return OriginalPoint;
02083 
02084     MILLIPOINT XOffset;
02085     MILLIPOINT YOffset;
02086 
02087     DocCoord RotateCentre = OriginalPoint;
02088 
02089     XOffset = (MILLIPOINT)(pOffset->m_XOffset *Scaling);
02090     YOffset = (MILLIPOINT)(pOffset->m_YOffset *Scaling);
02091 
02092     // not much to it really
02093     OriginalPoint.translate(XOffset, YOffset);
02094 
02095     return OriginalPoint;
02096 }

DocCoord PathProcessorBrush::AdjustPositionForOffset DocCoord  OriginalPoint,
double  Angle,
double  Scaling,
MILLIPOINT  OffsetValue,
UINT32  OffsetType
[protected]
 

To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
OriginalPoint - the point on the line at the correct distance for us to draw an object [INPUTS] Angle - the tangent at this point on the path Scaling - the scaling to use Offset - the blendpathoffset for this blendpath OffsetType - used only for random offset types, this can be left right or centre and is determined by GetNextOffsetType
- [OUTPUTS]
Returns:
the new position where we wish the object to be drawn
  • m_PathOffsetType and m_PathOffsetValue: These translations map the point on one side of the path or the other, the value determines exactly how far from the path they will be.

  • m_PositionRandomness: introduces a random element to the position of the object
    See also:
    -

Definition at line 1978 of file ppbrush.cpp.

01981 {   
01982     // if its zero or less we don't want to know
01983     if (OffsetValue <= 0)
01984         return OriginalPoint;
01985 
01986     // scale it to our current scaling
01987     OffsetValue = (MILLIPOINT)((double) OffsetValue * Scaling);
01988 //  TRACEUSER( "Diccon", _T("OffsetVal = %d\n"), OffsetValue);
01989     double theta;
01990     double NewX;
01991     double NewY;
01992 
01993     
01994     switch (m_PathOffsetType)
01995     {
01996         case OFFSET_NONE:
01997             break;
01998         case OFFSET_ALTERNATE:
01999             if (m_AltValue == 0)
02000             {
02001                 theta = Angle - (PI / 2);               
02002             }
02003             else
02004             {
02005                 theta = Angle + (PI / 2);
02006             }
02007             
02008             NewX = OffsetValue * cos (theta);
02009             NewY = OffsetValue * sin (theta);
02010         //  TRACEUSER( "Diccon", _T("Y Offset = %d\n"), (INT32)NewY);
02011             OriginalPoint.translate((INT32)NewX, (INT32)NewY);
02012             break;
02013         case OFFSET_RIGHT:
02014             theta = Angle - (PI / 2);
02015             NewX = OffsetValue * cos (theta);
02016             NewY = OffsetValue * sin (theta);
02017             OriginalPoint.translate((INT32)NewX, (INT32)NewY);
02018             break;
02019         case OFFSET_LEFT:
02020             theta = Angle + (PI / 2);
02021             NewX = OffsetValue * cos (theta);
02022             NewY = OffsetValue * sin (theta);
02023             OriginalPoint.translate((INT32)NewX, (INT32)NewY);
02024             break;
02025         case OFFSET_RANDOM: 
02026         {
02027         //  TRACEUSER( "Diccon", _T("Offset type = %d\n"), OffsetType);
02028             switch (OffsetType)
02029             {
02030                 case OFFSETTYPE_LEFT:
02031                     theta = Angle + (PI / 2);
02032                     NewX = OffsetValue * cos (theta);
02033                     NewY = OffsetValue * sin (theta);
02034                     OriginalPoint.translate((INT32)NewX, (INT32)NewY);
02035                     break;
02036                 case OFFSETTYPE_RIGHT:
02037                     theta = Angle - (PI / 2);
02038                     NewX = OffsetValue * cos (theta);
02039                     NewY = OffsetValue * sin (theta);
02040                     OriginalPoint.translate((INT32)NewX, (INT32)NewY);
02041                     break;
02042                 case OFFSETTYPE_CENTRE:
02043                     break;
02044                 default:
02045                     ERROR3("Invalid offset type returned");
02046                     break;
02047             }
02048             break;
02049         }
02050             
02051         default:
02052             ERROR3("Unknown offset type");
02053             break;
02054     }
02055 
02056     return OriginalPoint;
02057 }

void PathProcessorBrush::AdjustSpacingForClosedPath Path pPath,
double  dPathLength
 

When we apply a brush to a closed path we want to adjust the spacing so that the distance between the start object and the end object is the same as the distance between the start object and the second object. Here we check to see if the ink node is a single shape that produces a closed path (no groups etc.). We will then get the length of that path and try to get the best spacing value.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/2000
Parameters:
pInk - the ink node that this path processor will process [INPUTS]
Returns:
-
double Length = pPath->GetPathLength(); // Don't keep calling this - It's complex!

Definition at line 3645 of file ppbrush.cpp.

03646 {
03647     if (pPath == NULL || !pPath->IsClosed())
03648         return;
03649     
03651             
03652     // what we want to do is set the spacing so that it places the first
03653     // and last object on the same spot
03654 
03655     // get the number of objects with the current spacing
03656     double ActualSpacing = m_BrushScaling * (double)m_BrushSpacing;
03657     INT32 NumObjects = (INT32)(dPathLength / ActualSpacing);
03658 
03659     // Ensure that the NumObjects value isn't equal to zero. This prevents a divide by
03660     // zero error from being thrown.
03661     if ( NumObjects == 0 )
03662     {
03663         NumObjects = 1;
03664     }
03665 
03666     // work out what the spacing would be if we used the whole of the path exactly
03667     double NewActualSpacing = dPathLength / (double)NumObjects;
03668     
03669     double NewSpacing = NewActualSpacing / m_BrushScaling;
03670 
03671     // set the new value
03672     SetSpacing((MILLIPOINT)NewSpacing);
03673 }

void PathProcessorBrush::AdjustSpacingForClosedPath NodeRenderableInk pInk  ) 
 

When we apply a brush to a closed path we want to adjust the spacing so that the distance between the start object and the end object is the same as the distance between the start object and the second object. Here we check to see if the ink node is a single shape that produces a closed path (no groups etc.). We will then get the length of that path and try to get the best spacing value.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/2000
Parameters:
pInk - the ink node that this path processor will process [INPUTS]
Returns:
-

Definition at line 3597 of file ppbrush.cpp.

03598 {
03599     if (pInk == NULL)
03600     {
03601         ERROR3("Ink node is NULL in PathProcessorBrush::AdjustSpacingForClosedPath");
03602         return;
03603     }
03604     if (pInk->IsCompound())
03605         return;
03606 
03607     // Use a SimpleBecomeA to get the path from the parent object
03608     SimpleBecomeA BecomeA(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), NULL);
03609         
03610     if (pInk->DoBecomeA(&BecomeA))
03611     {
03612         NodePath* pNodePath = BecomeA.GetNodePath();
03613         if (pNodePath) 
03614         {
03615             if (pNodePath->InkPath.IsClosed())
03616             {
03617                 AdjustSpacingForClosedPath(&(pNodePath->InkPath), pNodePath->InkPath.GetPathLength(750/2));
03618             }
03619 
03620             // delete the nodepath we got
03621             delete pNodePath;
03622         }
03623     }
03624         
03625 }

BOOL PathProcessorBrush::AdvanceBrushToDistance MILLIPOINT  Distance  ) 
 

Advances the member variables in this PPB to the values they would acquire if the given distance were to be rendered. Basically another variant on GetSpacing AtDistance.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/2000
Parameters:
Distance along the path [INPUTS]
Returns:
TRUE, unless something goes wrong

Definition at line 3490 of file ppbrush.cpp.

03491 {
03492     ERROR2IF(Distance < 0, FALSE, "Invalid input to PathProcessorBrush::GetSpacingAndScalingAtDistance");
03493     BrushDefinition* pDef = BrushComponent::FindBrushDefinition(m_BrushHandle);
03494     ERROR2IF(pDef == NULL, FALSE,"No brush definition in PathProcessorBrush::AdvanceBrushToDistance");
03495 
03496     // first reset our members so we start at the beginning
03497     Reset();
03498 
03499     // get the pressure cache from our attribute, if there is one
03500     CDistanceSampler* pSampler = GetPressureCacheAndInitialise();
03501     CSampleItem TheItem;
03502 
03503     UINT32 Count = 0;
03504     
03505     UINT32 NumBrushObjects = pDef->GetNumBrushObjects();
03506     UINT32 BrushObject = m_LastObject;
03507     if (NumBrushObjects > 1 && m_SequenceType == SEQ_RANDOM)
03508         BrushObject = GetNextInkObject(m_LastObject, NumBrushObjects);
03509 
03510     m_CurrentScaling = GetNextScaling(Count++);
03511     MILLIPOINT Spacing = GetNextSpacing();
03512     MILLIPOINT DistanceSoFar = 0;  // we start at 10 MP in from the start of the path, for consistenc
03513 
03514     while (DistanceSoFar <= Distance)
03515     {
03516         // increment our distance
03517 #ifdef SCALESPACING
03518         DistanceSoFar += (MILLIPOINT)(Spacing * m_CurrentScaling);
03519 #else
03520         DistanceSoFar += (MILLIPOINT)Spacing;
03521 #endif
03522         GetNextOffsetType();
03523         GetNextOffset();
03524         GetNextAngle();
03525         GetNextHueMultiplier();
03526         GetNextSaturationMultiplier();
03527         // get the next pressure value, if there is one
03528         if (pSampler != NULL)
03529         {
03530             if (pSampler->GetNext(&TheItem))
03531             {
03532                 if (TheItem.m_Pressure < MAXPRESSURE)
03533                     m_CurrentPressure.m_Pressure = TheItem.m_Pressure;
03534             }
03535 #ifdef SCALESPACING
03536             pSampler->SetSampleRateFromSpacing((INT32)(Spacing * m_CurrentScaling));
03537 #else
03538             pSampler->SetSampleRateFromSpacing(Spacing);
03539 #endif
03540         }   
03541         
03542         
03543         // get the next spacing and scaling values
03544         Spacing = GetNextSpacing();
03545         m_CurrentScaling = GetNextScaling(Count++);
03546 
03547         if (m_AltValue == 0)
03548             m_AltValue = 1;
03549         else
03550             m_AltValue = 0;
03551 
03552         if (NumBrushObjects > 1)
03553             BrushObject = GetNextInkObject(BrushObject, NumBrushObjects);
03554     }
03555     m_LastObject = BrushObject;
03556     return TRUE;
03557 }

DocRect PathProcessorBrush::CalculateBoundingBox Path pPath,
NodeRenderableInk pParent
 

Calculates the bounding rect, unfortunately the only way to do this is to do a 'fake' render. So this function is essentially the same as processpath but it doesn't require a render region.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Path along which this brush will be applied [INPUTS] pParent - the ink node that generated pPath.
Returns:
the bounding rect of the given path with the brush applied

Definition at line 2431 of file ppbrush.cpp.

02432 {
02433     DocRect ReturnRect(0,0,0,0);
02434 
02435     ERROR2IF(pPath == NULL, ReturnRect, "Path is null in PathProcessorBrush::CalculateBoundingBox");
02436     ERROR2IF(pParent == NULL, ReturnRect, "Parent is null in PathProcessorBrush::CalculateBoundingBox");
02437 
02438     // if we are timestamping then use a different method and return
02439     if (m_pParentAttr != NULL)
02440     {
02441         if (m_pParentAttr->IsTimeStamping())
02442         {
02443             return TimeStampBoundingBox();
02444         }
02445     }
02446     BrushDefinition* pBrushDef = GetOurBrushDefinition();
02447     if (pBrushDef == NULL)
02448     {
02449         return ReturnRect;
02450     }
02451     
02452     // get the definition to generate its data copies for us
02453     if (!pBrushDef->StartRender())
02454     {
02455         TRACEUSER( "Diccon", _T("Unable to start render brush for bounding box\n"));
02456         return ReturnRect;
02457     }
02458 
02459     Reset();
02460 
02461     if (m_BrushScaling <= 0)
02462         return ReturnRect;
02463 
02464     UINT32 NumBrushObjects = pBrushDef->GetNumBrushObjects();
02465     
02466     if (!PrepareForRenderingLoop(NumBrushObjects))
02467         return ReturnRect;
02468 
02469     // some variables to keep track of where we are on the path
02470     double dPathLength = pPath->GetPathLength(750/2);
02471 //  double dOrigPathLength = dPathLength;
02472     MILLIPOINT PathLength = (MILLIPOINT)dPathLength;
02473     double PathProportion = 0.0;
02474 
02475     // this records the distance along the path at which we want to find a point
02476     MILLIPOINT DistanceToPoint = 10;
02477     
02478     // declare some locals that we need in the loop
02479     MILLIPOINT Spacing = m_BrushSpacing;
02480     CPathPointInfo PathPoint;
02481     double Angle;
02482     DocCoord Point; 
02483     BOOL ok = FALSE;
02484 //  BOOL Found = TRUE;
02485     UINT32 Count = 0;
02486     UINT32 BrushObjectToRender = m_LastObject;
02487 
02488     
02489     /* To get our pressure data we will use either a cache that is held by our parent attribute
02490     OR use a value function if a VariableWidthAttribute has been rendered into the render region*/ 
02491 
02492     // get our pressure data
02493     ValueFunction* pValFunc = NULL;
02494     CDistanceSampler* pPressure = GetPressureCacheAndInitialise(pParent, &pValFunc);
02495     CSampleItem TheItem; // we need this in the loop
02496 
02497     // find our line width
02498 /*  AttrLineWidth* pLineWidth = NULL;
02499     pParent->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrLineWidth), (NodeAttribute**)pLineWidth);
02500     if (pLineWidth)
02501     {
02502         INT32 Width = pLineWidth->Value.LineWidth;
02503         ScaleToValue(Width, !m_bValidPressure);
02504     }
02505 */
02506     m_bRenderAllAttributes = TRUE;
02507 
02508     m_CachedRect = DocRect(0,0,0,0);
02509     m_bCalculateRect = TRUE;
02510 
02511     TRACEUSER( "Diccon", _T("About to calculate bounding box\n"));
02512     
02513     // get the first spacing and scaling values
02514     m_UseActualScaling = TRUE;
02515     m_CurrentScaling = GetNextScaling(Count);
02516     m_LastScalingRendered = m_CurrentScaling;
02517     
02518     Spacing = GetNextSpacing();
02519     
02520     
02521     while (DistanceToPoint < PathLength)
02522     {
02523     //  TRACEUSER( "Diccon", _T("Count %d\n"), Count);
02524         // try and get the point    
02525         ok = GetPointAtDistance(pPath, DistanceToPoint, &Point, &Angle);
02526         
02527         if (ok)  
02528         {
02529             GetNextAngle();
02530             SetNextOffsetType();
02531             GetNextOffset();
02532                 
02533             if (m_CurrentScaling > 0)
02534                 RenderBrushAtPoint(Point, Angle,
02535                          BrushObjectToRender, Count,  NULL);
02536             Count++;
02537 
02538             // get the index of the next object.
02539             if (NumBrushObjects > 1)
02540                 BrushObjectToRender = GetNextInkObject(BrushObjectToRender, NumBrushObjects);
02541             
02542             DecideWhetherToUseActualScaling(BrushObjectToRender);
02543         }
02544     
02545         if (pPressure != NULL)
02546         {
02547             if (pPressure->GetNext(&TheItem))
02548             {   
02549                 if (TheItem.m_Pressure < 0 || TheItem.m_Pressure > MAXPRESSURE)
02550                 {
02551                     //ERROR3("Invalid pressure in PathProcessorBrush::CalculateBoundingBox");
02552                     //TRACEUSER( "Diccon", _T("Invalid pressure %d at count %d\n"), TheItem.m_Pressure, Count);
02553                 }
02554                 else
02555                 {
02556                     m_CurrentPressure.m_Pressure = TheItem.m_Pressure;
02557                     //RACEUSER("Diccon", "BBox pressure %d, = %d\n", Count, m_CurrentPressure.m_Pressure);
02558                 }
02559             }
02560         //  else
02561         //      ERROR3("Unable to get pressure item in PathProcessorBrush::CalculateBoundingBox");
02562         }
02563 #ifdef SCALESPACING     
02564         DistanceToPoint += (MILLIPOINT)(Spacing * m_LastScaling);
02565         
02566         if (pPressure)
02567             pPressure->SetSampleRateFromSpacing((INT32)(Spacing * m_CurrentScaling));
02568 #else
02569         DistanceToPoint += (MILLIPOINT)(Spacing * m_BrushScaling);
02570         
02571         if (pPressure)
02572             pPressure->SetSampleRateFromSpacing((INT32)(Spacing * m_CurrentScaling));
02573 #endif  
02574         
02575         // get the next distance
02576         Spacing = GetNextSpacing();
02577         m_LastScalingRendered = m_pLastScalingRendered[BrushObjectToRender];
02578 
02579         if (pValFunc != NULL)
02580         {
02581             PathProportion = (double)DistanceToPoint / dPathLength;
02582             m_CurrentPressure.m_Pressure = GetNextSampleItem(NULL, pValFunc, PathProportion).m_Pressure;
02583             if (m_CurrentPressure.m_Pressure > MAXPRESSURE)
02584                 m_CurrentPressure.m_Pressure = MAXPRESSURE;
02585         }
02586 
02587         m_CurrentScaling = GetNextScaling(Count);
02588 
02589         // we're now allowed to go to zero scaling, but if we do so we must stop rendering
02590         if (m_CurrentScaling <= 0)
02591             break;
02592 
02593         // this member keeps track of which side we should offset on if we have
02594         // an alternating offset
02595         if (m_AltValue == 0)
02596             m_AltValue = 1;
02597         else
02598             m_AltValue = 0;
02599     
02600     }
02601 
02602     /*some more awful hacks
02603     if (!m_CachedRect.IsEmpty() && (!pBrushDef->BrushContainsGroup()))
02604     {
02605         DocRect InkRect = pBrushDef->GetLargestBoundingBox();
02606         MILLIPOINT Height = (MILLIPOINT)(InkRect.Height() * m_BrushScaling);
02607         MILLIPOINT Width = (MILLIPOINT)(InkRect.Width() * m_BrushScaling);
02608     }
02609     */
02610 //  TRACEUSER( "Diccon", _T("Bounding rect: Height = %d, Width = %d\n"), m_CachedRect.Height(), m_CachedRect.Width());
02611     m_bCalculateRect = FALSE;   
02612     TRACEUSER( "Diccon", _T("Finished bounding box\n"));
02613     CleanUpAfterRender();
02614     pBrushDef->StopRender();
02615 
02616     return m_CachedRect;
02617 }   

PathProcessorBrush::CC_DECLARE_DYNAMIC PathProcessorBrush   )  [private]
 

void PathProcessorBrush::CleanUpAfterRender  ) 
 

deletes the caches that we used to store rendering data

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/2000
Parameters:
- [INPUTS] Returns -
See also:
-

Definition at line 7185 of file ppbrush.cpp.

07186 {
07187     if (m_pObjectRendered != NULL)
07188     {
07189         delete m_pObjectRendered;
07190         m_pObjectRendered = NULL;
07191     }
07192     if (m_pLastScalingRendered != NULL)
07193     {
07194         delete m_pLastScalingRendered;
07195         m_pLastScalingRendered = NULL;
07196     }
07197     if (m_pLastTangent != NULL)
07198     {
07199         delete m_pLastTangent;
07200         m_pLastTangent = NULL;
07201     }
07202     if (m_pLastRotation != NULL)
07203     {
07204         delete m_pLastRotation;
07205         m_pLastRotation = NULL;
07206     }
07207 }

PathProcessorBrush * PathProcessorBrush::Clone void   )  [virtual]
 

To copy PathProcessorBrush or derived-class object.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Returns:
NULL if we're out of memory, else a pointer to a clone (exact copy) of this object

Reimplemented in BlendedPathProcessorBrush.

Definition at line 3164 of file ppbrush.cpp.

03165 {
03166 
03167     // Clone this object 
03168     PathProcessorBrush *pClone = new PathProcessorBrush;
03169 
03170     if (pClone == NULL)
03171         return NULL;
03172 
03173     // copy the data
03174     pClone->SetBrushDefinition(m_BrushHandle);
03175     pClone->SetPathOffsetType(m_PathOffsetType);
03176     pClone->SetPathOffsetValue(m_PathOffsetValue);
03177     pClone->SetRotated(m_bRotate);
03178     pClone->SetRotationAngle(m_RotateAngle);
03179     pClone->SetRotationIncrConst(m_RotAngleIncrConst);
03180     pClone->SetRotationIncrProp(m_RotAngleIncrProp);
03181     pClone->SetRotationMaxPressure(m_RotationMaxPressure);
03182 
03183     pClone->SetSpacing(m_BrushSpacing);
03184     pClone->SetTiling(m_bTile);
03185     pClone->SetBrushScaling(m_BrushScaling);
03186     pClone->SetBrushScalingIncr(m_BrushScalingIncr);
03187     pClone->SetBrushScalingIncrConst(m_BrushScalingIncrConst);
03188     pClone->SetMaxScaling(m_MaxScaling);
03189     pClone->SetScalingMaxPressure(m_ScalingMaxPressure);
03190     pClone->SetSpacingIncrProp(m_BrushSpacingIncrProp);
03191     pClone->SetSpacingIncrConst(m_BrushSpacingIncrConst);
03192     pClone->SetSpacingMaxPressure(m_SpacingMaxPressure);
03193     pClone->SetPathOffsetIncrConst(m_PathOffsetIncrConst);
03194     pClone->SetPathOffsetIncrProp(m_PathOffsetIncrProp);
03195     pClone->SetSpacingMaxRand(m_BrushSpacingMaxRand);
03196     pClone->SetSpacingRandSeed(m_BrushSpacingRandSeed);
03197     pClone->SetScalingMaxRand(m_BrushScalingMaxRand);
03198     pClone->SetScalingRandSeed(m_BrushScalingRandSeed);
03199     pClone->SetSequenceType(m_SequenceType);
03200     pClone->SetSequenceSeed(m_SequenceRandSeed);
03201     pClone->SetOffsetValueMaxRand(m_OffsetValueMaxRand);
03202     pClone->SetOffsetValueRandSeed(m_OffsetValueRandSeed);
03203     pClone->SetOffsetTypeRandSeed(m_OffsetTypeRandSeed);
03204 
03205     pClone->SetRotationMaxRand(m_RotationMaxRand);
03206     pClone->SetRotationRandSeed(m_RotationRandSeed);
03207 
03208     pClone->SetUseLocalFillColour(m_bUseLocalFillColour);
03209     pClone->SetUseLocalTransp(m_bUseLocalTransp);
03210     pClone->SetUseNamedColours(m_bUseNamedColours);
03211     
03212     pClone->SetHueIncrement(m_BrushHueIncrement);
03213     pClone->SetHueMaxRand(m_BrushHueMaxRand);
03214     pClone->SetHueRandSeed(m_BrushHueRandSeed);
03215     pClone->SetSatIncrement(m_BrushSatIncrement);
03216     pClone->SetSatMaxRand(m_BrushSatMaxRand);
03217     pClone->SetSatRandSeed(m_BrushSatRandSeed); 
03218 
03219     pClone->SetBrushTransparency(m_BrushTransparency);
03220     pClone->SetTransparencyPressure(m_TranspMaxPressure);
03221 
03222     pClone->SetParentAttribute(m_pParentAttr);
03223     
03224     return(pClone);
03225 }

void PathProcessorBrush::CopyBrushData BrushData pData  ) 
 

copies the info from the path processor to the brushdata object

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
pData - pointer to the brushdata object
See also:
-

Definition at line 5704 of file ppbrush.cpp.

05705 {
05706     if (pData == NULL)
05707     {
05708         ERROR3("NULL brush data object");
05709         return;
05710     }
05711 
05712     pData->m_BrushHandle = m_BrushHandle;
05713     
05714     pData->m_BrushScaling = m_BrushScaling;
05715     pData->m_BrushScalingIncr = m_BrushScalingIncr;
05716     pData->m_BrushScalingIncrConst = m_BrushScalingIncrConst;
05717     pData->m_BrushScalingMaxRand = m_BrushScalingMaxRand;
05718     pData->m_BrushScalingRandSeed = m_BrushScalingRandSeed;
05719     pData->m_ScalingMaxPressure  = m_ScalingMaxPressure;
05720 
05721     pData->m_bRotate = m_bRotate;
05722     pData->m_RotateAngle = m_RotateAngle;
05723     pData->m_RotAngleIncrConst = m_RotAngleIncrConst;
05724     pData->m_RotAngleIncrProp  = m_RotAngleIncrProp;
05725     pData->m_RotationMaxRand = m_RotationMaxRand;
05726     pData->m_RotationRandSeed = m_RotationRandSeed;
05727     pData->m_RotationMaxPressure = m_RotationMaxPressure;
05728 
05729     pData->m_BrushSpacing  = m_BrushSpacing;
05730     pData->m_BrushSpacingIncrConst = m_BrushSpacingIncrConst;
05731     pData->m_BrushSpacingIncrProp = m_BrushSpacingIncrProp;
05732     pData->m_BrushSpacingMaxRand = m_BrushSpacingMaxRand;
05733     pData->m_BrushSpacingRandSeed = m_BrushSpacingRandSeed;
05734 
05735     pData->m_PathOffsetType = m_PathOffsetType;
05736     pData->m_PathOffsetValue = m_PathOffsetValue;
05737     pData->m_PathOffsetIncrConst = m_PathOffsetIncrConst;
05738     pData->m_PathOffsetIncrProp = m_PathOffsetIncrProp;
05739     pData->m_OffsetValueMaxRand = m_OffsetValueMaxRand;
05740     pData->m_OffsetValueRandSeed = m_OffsetValueRandSeed;
05741     pData->m_OffsetTypeRandSeed = m_OffsetTypeRandSeed;
05742 
05743     pData->m_bTile = m_bTile;
05744 
05745     pData->m_SequenceType = m_SequenceType;
05746     pData->m_SequenceRandSeed = m_SequenceRandSeed;
05747 
05748     pData->m_bUseLocalFillColour = m_bUseLocalFillColour;
05749     pData->m_bUseLocalTransp = m_bUseLocalTransp;
05750     pData->m_bUseNamedColour = m_bUseNamedColours;
05751     
05752     if (m_pParentAttr != NULL)
05753         pData->m_bTimeStampBrushes = m_pParentAttr->IsTimeStamping();
05754     else
05755         pData->m_bTimeStampBrushes = FALSE;
05756 
05757     pData->m_TimeStampPeriod = (UINT32)-1;
05758 
05759         
05760     pData->m_BrushHueIncrement = m_BrushHueIncrement;
05761     pData->m_BrushHueMaxRand = m_BrushHueMaxRand;
05762     pData->m_BrushHueRandSeed = m_BrushHueRandSeed;
05763     pData->m_BrushSatIncrement = m_BrushSatIncrement;
05764     pData->m_BrushSatMaxRand = m_BrushSatMaxRand;
05765     pData->m_BrushSatRandSeed = m_BrushSatRandSeed; 
05766 
05767     pData->m_BrushTransparency = m_BrushTransparency;
05768     pData->m_TranspMaxPressure = m_TranspMaxPressure;
05769 
05770     // Get the name from the definition
05771     BrushDefinition* pDef = GetOurBrushDefinition();
05772 
05773     if (pDef)
05774         pData->m_Name = *pDef->GetLineName();
05775 }

void PathProcessorBrush::CopyDataFromObject BrushData pData  ) 
 

copies the info from the brushdata object to the processor

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
pData - pointer to the brushdata object
See also:
-

Definition at line 5791 of file ppbrush.cpp.

05792 {
05793     if (pData == NULL)
05794     {
05795         ERROR3("NULL brush data object");
05796         return;
05797     }   
05798     m_BrushHandle = pData->m_BrushHandle;
05799 
05800     // scaling
05801     SetBrushScaling(pData->m_BrushScaling);
05802     m_BrushScalingIncr = pData->m_BrushScalingIncr;
05803     m_BrushScalingIncrConst = pData->m_BrushScalingIncrConst;
05804     m_BrushScalingMaxRand = pData->m_BrushScalingMaxRand;
05805     m_BrushScalingRandSeed = pData->m_BrushScalingRandSeed;
05806     m_ScalingMaxPressure   = pData->m_ScalingMaxPressure;
05807 
05808     // rotation
05809     m_bRotate = pData->m_bRotate;
05810     SetRotationAngle(pData->m_RotateAngle);
05811     m_RotAngleIncrConst = pData->m_RotAngleIncrConst;
05812     m_RotAngleIncrProp  = pData->m_RotAngleIncrProp;
05813     m_RotationMaxRand = pData->m_RotationMaxRand;
05814     m_RotationRandSeed = pData->m_RotationRandSeed;
05815 
05816     //spacing
05817     SetSpacing(pData->m_BrushSpacing);
05818     m_BrushSpacingIncrConst = pData->m_BrushSpacingIncrConst;
05819     m_BrushSpacingIncrProp = pData->m_BrushSpacingIncrProp;
05820     m_BrushSpacingMaxRand = pData->m_BrushSpacingMaxRand;
05821     m_BrushSpacingRandSeed = pData->m_BrushSpacingRandSeed;
05822 
05823     //offset
05824     m_PathOffsetType = pData->m_PathOffsetType;
05825     SetPathOffsetValue(pData->m_PathOffsetValue);
05826     m_PathOffsetIncrConst = pData->m_PathOffsetIncrConst;
05827     m_PathOffsetIncrProp = pData->m_PathOffsetIncrProp;
05828     m_OffsetValueMaxRand = pData->m_OffsetValueMaxRand;
05829     m_OffsetValueRandSeed = pData->m_OffsetValueRandSeed;
05830     m_OffsetTypeRandSeed = pData->m_OffsetTypeRandSeed;
05831 
05832     // colour variation
05833     m_BrushHueMaxRand    = pData->m_BrushHueMaxRand;
05834     m_BrushHueRandSeed   = pData->m_BrushHueRandSeed;
05835     m_BrushSatMaxRand    = pData->m_BrushSatMaxRand;
05836     m_BrushSatRandSeed   = pData->m_BrushSatRandSeed;
05837 
05838     // Transparency
05839     m_BrushTransparency  = pData->m_BrushTransparency;
05840     m_TranspMaxPressure  = pData->m_TranspMaxPressure;
05841 
05842 
05843     m_bTile = pData->m_bTile;
05844 
05845     m_SequenceType = pData->m_SequenceType;
05846     m_SequenceRandSeed = pData->m_SequenceRandSeed;
05847 
05848     m_bUseLocalFillColour = pData->m_bUseLocalFillColour;
05849     m_bUseLocalTransp = pData->m_bUseLocalTransp;
05850     m_bUseNamedColours = pData->m_bUseNamedColour;
05851     
05852 
05853 }

void PathProcessorBrush::DecideWhetherToUseActualScaling UINT32  BrushObject  ) 
 

Decides whether or not to set the UseActualScaling flag for the next call of GetNextScaling. Basically if we have not rendered this object before then the scaling we wish to use will be the absolute scaling. However subsequently we only wish to know about scaling changes. This function is called by OpDrawBrush::RenderStepsForTime, and ProcessPath.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/2000
Parameters:
NumBrushObjects - the brush object last rendered [INPUTS]
See also:
-

Definition at line 7276 of file ppbrush.cpp.

07277 {
07278     if  (m_pObjectRendered == NULL || m_pLastScalingRendered == NULL)
07279     {
07280         ERROR3("Data caches have not been initialised in PathProcessorBrush::DecideWhetherToUseActualScaling");
07281         return;
07282     }
07283              
07284 
07285 
07286 //#ifdef _DEBUG
07287     if (BrushObject >= GetNumBrushObjects())
07288     {
07289         ERROR3("Object index out of bounds in PathProcessorBrush::SetLastRenderedData");
07290         return;
07291     }
07292     
07293 //#endif
07294 
07295     if (m_pObjectRendered[BrushObject])
07296     {
07297         m_UseActualScaling = FALSE;
07298         m_LastScalingRendered = m_pLastScalingRendered[BrushObject];
07299     }
07300     else
07301     {
07302         m_UseActualScaling = TRUE;
07303     }
07304 // Phil, 14/01/2004 this change accompanies the rewritten RenderBrushAtPoint function
07305 // This routine was a bodge because RenderBrushAtPoint used to permanently affect the size (scale)
07306 // of the brush path definitions!!! ARGH!
07307 // The new routine leave path definitions untouched.
07308 #ifdef NEW_RENDERBRUSHATPOINT
07309     m_UseActualScaling = TRUE;
07310 #endif
07311 
07312 }

BOOL PathProcessorBrush::DoBecomeA BecomeA pBecomeA,
Path pPath,
Node pParent
[virtual]
 

To convert our brush into its individual paths and attributes, very similar to the bounding box routine in that we extract the path from our parent node and use it to calculate our blenpaths etc.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/2000
Parameters:
pBecomeA - the object that tells us what to become, and recieves the results [INPUTS] pPath - the path that we are processing pParent- the node that this brush is applied to
[OUTPUTS] 
Returns:
TRUE if everything went ok,

Reimplemented from PathProcessor.

Definition at line 2766 of file ppbrush.cpp.

02767 {
02768     ERROR2IF(pBecomeA == NULL, FALSE, "BecomeA pointer is NULL in PathProcessorBrush::DoBecomeA");
02769     ERROR2IF(pParent == NULL, FALSE, "Parent is NULL in PathProcessorBrush::DoBecomeA");
02770     ERROR2IF(pPath == NULL, FALSE, "Path is NULL in PathProcessorBrush::DoBecomeA");
02771 
02772     BeginSlowJob();
02773 
02774     TRACEUSER( "Diccon", _T("ABOUT TO BECOME A\n"));
02775 
02776     BrushDefinition* pBrushDef = GetOurBrushDefinition();
02777     if (pBrushDef == NULL)
02778     {
02779         return FALSE;
02780     }
02781     if (!pBrushDef->StartRender())
02782         return FALSE;
02783 
02784     UINT32 NumBrushObjects = pBrushDef->GetNumBrushObjects();
02785     if (!PrepareForRenderingLoop(NumBrushObjects))
02786         return FALSE;
02787     Reset();
02788 
02789     if (m_BrushScaling <= 0)
02790         return TRUE;
02791 
02792     // some variables to keep track of where we are on the path
02793     double dPathLength = pPath->GetPathLength(750/2);
02794     double dOrigPathLength = dPathLength;
02795     MILLIPOINT PathLength = (MILLIPOINT)dPathLength;
02796     double PathProportion = 0.0;
02797     
02798     // this records the distance along the path at which we want to find a point
02799     MILLIPOINT DistanceToPoint = 0;
02800     
02801     // declare some locals that we need in the loop
02802     MILLIPOINT Spacing = m_BrushSpacing;
02803     CPathPointInfo PathPoint;
02804     double Angle;
02805     DocCoord Point; 
02806     BOOL ok = FALSE;
02807 //  BOOL Found = TRUE;
02808     UINT32 Count = 0;
02809     UINT32 BrushObjectToRender = m_LastObject;
02810     
02811     m_bRenderAllAttributes = TRUE;
02812     
02813     if (pPath->IsClosed())
02814     {
02815         // if the path is closed then hopefully we will have adjusted the spacing so that the
02816         // path length fits an integer number of objects.  However we do not want to render
02817         // two objects on the start point so reduce the path length we actually use
02818         double ActualSpacing = m_BrushScaling * (double)m_BrushSpacing;
02819 
02820         PathLength -= (MILLIPOINT)(ActualSpacing * 0.2); // we need some margin for error
02821         dPathLength = (double)PathLength;
02822         AdjustSpacingForClosedPath(pPath, dOrigPathLength);
02823 
02824         if (pParent->IsARegularShape())
02825             pPath->Reverse();
02826 
02827     }
02828 
02829     // get our pressure data
02830     ValueFunction* pValFunc = NULL;
02831     CDistanceSampler* pPressure = GetPressureCacheAndInitialise((NodeRenderableInk*)pParent, &pValFunc);
02832     CSampleItem TheItem; // we need this in the loop
02833 
02834     // make an object to deal with the blendpaths etc
02835     HandleBrushBecomeA HandleBecomeA;
02836     HandleBecomeA.SetSecondary(pBecomeA->IsSecondary());
02837 
02838     // Allocate a new group to hold all our objects
02839     UndoableOperation* pUndoOp = pBecomeA->GetUndoOp();
02840     NodeRenderableInk* pContext = (NodeRenderableInk*)pParent;
02841     NodeGroup* pNodeGroup = NULL;
02842     
02843     // we need a new group node if we are replacing the brush or passing back to BrushBecomeAGroup
02844     if (pBecomeA->GetReason() == BECOMEA_REPLACE || pBecomeA->IsBrushBecomeAGroup())
02845     {   
02846         ALLOC_WITH_FAIL(pNodeGroup, (new NodeGroup), pUndoOp); 
02847         if (pNodeGroup == NULL)
02848             return FALSE;
02849     
02850         pContext = pNodeGroup;
02851     }
02852     
02853     
02854     if (pBecomeA->GetReason() == BECOMEA_REPLACE)
02855     {
02856         // insert the new group next to our parent
02857         if (pUndoOp)
02858         {
02859             BOOL ok = TRUE;
02860             // If we don't own the parent node, we should insert after (on top of) it
02861             if (pBecomeA->IsSecondary())
02862                 ok = pUndoOp->DoInsertNewNode(pContext,pParent,NEXT,FALSE,FALSE,FALSE,FALSE);
02863             else
02864                 ok = pUndoOp->DoInsertNewNode(pContext,pParent,PREV,FALSE,FALSE,FALSE,FALSE);
02865 
02866             if (!ok)
02867             {
02868                 delete pNodeGroup;
02869                 return FALSE;
02870             }
02871         }
02872         else
02873         {
02874             pContext->AttachNode(pParent, PREV);
02875         }
02876 
02877         HandleBecomeA.Initialise(pBecomeA, pNodeGroup, pParent);
02878     }
02879     else
02880         HandleBecomeA.Initialise(pBecomeA, pContext, pParent);
02881 
02882     // we need the local stroke colour
02883     NodeAttribute* pStrokeColour = NULL;
02884     
02885     // get the attribute
02886     ((NodeRenderableInk*)pParent)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeColour), &pStrokeColour);
02887 
02888     if (pStrokeColour != NULL)
02889     {
02890 
02891         // get the stroke colour
02892         StrokeColourAttribute* pVal = (StrokeColourAttribute*)pStrokeColour->GetAttributeValue();
02893         if (pVal != NULL)
02894             m_CurrentStrokeCol = pVal->Colour;
02895     }
02896     
02897     // get the first spacing and scaling values
02898     m_UseActualScaling = TRUE;
02899     m_CurrentScaling = GetNextScaling(Count);
02900     m_LastScalingRendered = m_CurrentScaling;
02901 
02902     Spacing = GetNextSpacing();
02903     while (DistanceToPoint < PathLength)
02904     {
02905     //  TRACEUSER( "Diccon", _T("Count %d\n"), Count);
02906         // try and get the point 
02907         ok = GetPointAtDistance(pPath, DistanceToPoint, &Point, &Angle);
02908         GetNextAngle();
02909         GetNextOffset();
02910         GetNextHueMultiplier();
02911         GetNextSaturationMultiplier();
02912         if (ok)  
02913         {
02914             SetNextOffsetType();
02915 
02916             if (m_CurrentScaling > 0)
02917                 RenderBrushAtPoint(Point, Angle,
02918                          BrushObjectToRender, Count,  NULL, &HandleBecomeA);
02919 
02920             // get the next pressure value
02921             if (pPressure != NULL)
02922             {
02923                 double pLength = dOrigPathLength;       // Don't keep calling pPath->GetPathLength(); It's complex!
02924                 double pDataLength = pPressure->GetDistanceRep (), count = pPressure->GetCount ();
02925                 double dataRatio = 1.0;
02926 
02927                 if (pDataLength < pLength)
02928                 {
02929                     dataRatio = pDataLength / pLength;
02930                 }
02931                 else
02932                 {
02933                     dataRatio = pLength / pDataLength;
02934                 }
02935 
02936                 double offset = 1.0;
02937                     
02938                 if (DistanceToPoint < pLength)
02939                 {
02940                     offset = (DistanceToPoint / pLength) * dataRatio * count;
02941                 }
02942                 else
02943                 {
02944                     offset = (pLength / DistanceToPoint) * dataRatio * count;
02945                 }
02946                 
02947                 if (pPressure->GetAtPos (offset, &TheItem))//GetNext(&TheItem))
02948                 {
02949                     if (TheItem.m_Pressure < MAXPRESSURE)
02950                         m_CurrentPressure.m_Pressure = TheItem.m_Pressure;
02951                     else
02952                         m_CurrentPressure.m_Pressure = MAXPRESSURE;
02953                 //  TRACEUSER( "Diccon", _T("Pressure = %d\n"), TheItem.m_Pressure);
02954                 }
02955             }
02956     
02957             Count++;
02958         
02959             // get the index of the next object.
02960             if (NumBrushObjects > 1)
02961                 BrushObjectToRender = GetNextInkObject(BrushObjectToRender, NumBrushObjects);
02962 
02963             DecideWhetherToUseActualScaling(BrushObjectToRender);
02964         }
02965 #ifdef SCALESPACING     
02966         DistanceToPoint += (MILLIPOINT)(Spacing * m_LastScaling);
02967         
02968         if (pPressure)
02969             pPressure->SetSampleRateFromSpacing((INT32)(Spacing * m_CurrentScaling));
02970 #else
02971             DistanceToPoint += (MILLIPOINT)(Spacing * m_BrushScaling);
02972         
02973         if (pPressure)
02974             pPressure->SetSampleRateFromSpacing(Spacing);
02975 #endif
02976         
02977         if (pValFunc != NULL)
02978         {
02979             PathProportion = (double)DistanceToPoint / dPathLength;
02980             m_CurrentPressure.m_Pressure = GetNextSampleItem(NULL, pValFunc, PathProportion).m_Pressure;
02981             if (m_CurrentPressure.m_Pressure > MAXPRESSURE)
02982                 m_CurrentPressure.m_Pressure = MAXPRESSURE;
02983         }
02984 
02985         // get the next distance
02986         Spacing = GetNextSpacing();
02987         m_LastScalingRendered = m_pLastScalingRendered[BrushObjectToRender];
02988         m_CurrentScaling = GetNextScaling(Count);
02989         
02990         // this member keeps track of which side we should offset on if we have
02991         // an alternating offset
02992         if (m_AltValue == 0)
02993             m_AltValue = 1;
02994         else
02995             m_AltValue = 0;
02996     
02997     }
02998     
02999     pBrushDef->StopRender();
03000 
03001     CleanUpAfterRender();
03002     TRACEUSER( "Diccon", _T("FINISHED BRUSH DOBECOMEA\n"));
03003 
03004     if (pBecomeA->GetReason() == BECOMEA_REPLACE)
03005     {
03006         HandleBecomeA.FinishPassback();             // Call passback even in Replace mode to inform handler of
03007                                                     // location of new object(s) in document
03008         return HandleBecomeA.HideCreatedByNode();   // hide the original node 
03009     }
03010     else
03011         return HandleBecomeA.FinishPassback();
03012 
03013     return FALSE;
03014 }

BOOL PathProcessorBrush::DoesActuallyDoAnything RenderRegion pRender  )  [virtual]
 

To determine whether or not our path processor is 'default' i.e. if does not change the path at all. If so then the render region will be free to use DrawPathToOutputDevice which will let us use dash patterns, arrowheads etc.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/10/2000
Parameters:
pRender - pointer to the render region that we are about to render our path into [INPUTS]
Returns:
TRUE if it is anticipated that this path processor will alter the path in any way, FALSE if not

Errors:

Reimplemented from PathProcessor.

Definition at line 3034 of file ppbrush.cpp.

03035 {
03036     if (pRender == NULL)
03037     {
03038         ERROR3("No render region supplied to PathProcessorBrush::DoesActuallyDoAnything");
03039         return FALSE;
03040     }
03041 
03042     // get the line width , if its too small we don't want to draw anything
03043     LineWidthAttribute* pLine = (LineWidthAttribute*)pRender->GetCurrentAttribute(ATTR_LINEWIDTH);
03044     
03045     if (pLine && pLine->LineWidth < 500)
03046         return FALSE;
03047 
03048     // if we have a transparent stroke colour then don't bother either
03049     StrokeColourAttribute* pStroke = (StrokeColourAttribute*)pRender->GetCurrentAttribute(ATTR_STROKECOLOUR);
03050     
03051     if (pStroke && pStroke != NULL)
03052     {
03053         if (pStroke->Colour.IsTransparent())
03054             return FALSE;
03055     }
03056     return TRUE;
03057 }

BrushHandle PathProcessorBrush::GetBrushDefinitionHandle void   ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/99
Parameters:
- [INPUTS]
Returns:
the handle currently used by this pathprocessor

Definition at line 3263 of file ppbrush.cpp.

03264 {
03265     return m_BrushHandle;
03266 }

double PathProcessorBrush::GetBrushScaling  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the scaling factor to use when drawing the objects
See also:
-

Definition at line 4833 of file ppbrush.cpp.

04834 {
04835     return m_BrushScaling;
04836 }

double PathProcessorBrush::GetBrushScalingIncr  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the scaling factor increment to use when drawing the objects
See also:
-

Definition at line 4890 of file ppbrush.cpp.

04891 {
04892     return m_BrushScalingIncr;
04893 }

double PathProcessorBrush::GetBrushScalingIncrConst  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the scaling factor increment to use when drawing the objects
See also:
-

Definition at line 4938 of file ppbrush.cpp.

04939 {
04940     return m_BrushScalingIncrConst;
04941 }

MILLIPOINT PathProcessorBrush::GetBrushSize BOOL  IgnorePressure = FALSE  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the height of the largest bounding box, to be used as a default line width
See also:
-

Definition at line 6007 of file ppbrush.cpp.

06008 {
06009     BrushDefinition* pBrushDef = GetOurBrushDefinition();
06010     if (pBrushDef == NULL)
06011         return -1;
06012     DocRect BRect = pBrushDef->GetLargestBoundingBox();
06013     if (BRect.IsEmpty())
06014         return -1;
06015 
06016     MILLIPOINT Height = BRect.Height();
06017     MILLIPOINT Width = BRect.Width();
06018 //  double dHeight = (double)Height;
06019 //  double dWidth = (double)Width;
06020 
06021     double ScaleFactor = 1.0;
06022 
06023     // firstly, if we are rotated, or have random rotation, then use the longest side
06024     if (m_RotationMaxRand > 0 || m_RotateAngle != 0.0 || !m_bRotate)
06025     {
06026         if (Width > Height)
06027             Height = Width;
06028     }
06029     
06030     if (m_BrushScalingMaxRand > 0)
06031     {
06032         // find out the random range
06033         UINT32 Lower = 0;
06034         UINT32 Upper = 0;
06035         GetRandomLimits(100, m_BrushScalingMaxRand, &Lower, &Upper);
06036         
06037         //Use the upper limit
06038         ScaleFactor *= ((double)Upper * 0.01);
06039     }
06040 
06041 /*  if (m_ScalingMaxPressure > 0 && !IgnorePressure)
06042     {
06043         ScaleFactor *= ((double)m_ScalingMaxPressure * 0.01 + 1.0);
06044         
06045     }
06046 */
06047     MILLIPOINT NewHeight = (MILLIPOINT)((double)Height * ScaleFactor);
06048 
06049     // if we have random offset then there will be some effect, this is separate from the offset amount
06050     if (m_OffsetValueMaxRand > 0)
06051     {
06052         // rand value is a percentage of object size
06053         double RandMultiplier = (double)m_OffsetValueMaxRand * 0.01;
06054         double OffsetAmount = (double)Height * RandMultiplier;
06055         
06056         // remember that it goes both sides
06057         MILLIPOINT mpAmount = (MILLIPOINT)(2*OffsetAmount);
06058         NewHeight += mpAmount;
06059     }
06060 
06061     switch (m_PathOffsetType)
06062     {
06063         case OFFSET_NONE:
06064             break;
06065         case OFFSET_LEFT:
06066         case OFFSET_RIGHT:
06067         case OFFSET_ALTERNATE:
06068         {
06069             MILLIPOINT OffsetIncr = 2 * m_PathOffsetValue;
06070             NewHeight += OffsetIncr;
06071         }
06072         break;
06073         case OFFSET_RANDOM:
06074             break;
06075         default:
06076             ERROR3("Invalid offset type");
06077     }
06078 
06079     return NewHeight;
06080 }

INT32 PathProcessorBrush::GetBrushTransparency  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
our transparency value (-1 indicates unused)
See also:
-

Definition at line 5544 of file ppbrush.cpp.

05545 {
05546     return m_BrushTransparency;
05547 }

DocRect PathProcessorBrush::GetCachedRect  ) 
 

access fn.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the cached bounding rect

Definition at line 2744 of file ppbrush.cpp.

02745 {
02746     return m_CachedRect;
02747 }

UINT32 PathProcessorBrush::GetCurrentPressure  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the current pressure value for the point to be rendered

Definition at line 6771 of file ppbrush.cpp.

06772 {
06773     return m_CurrentPressure.m_Pressure;
06774 }

UINT32 PathProcessorBrush::GetCurrentPressureEffect UINT32  MaxEffect,
BOOL  FixedMaximum = FALSE
[protected]
 

Simply pass in the maximum effect that you allow and this returns the effect caused by the current pressure value.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
MaxEffect - the maximum % effect that pressure can have [INPUTS] FixedMaximum - flag indicating that the maximum should always be 100% Returns the % effect of the current pressure
See also:
-

Definition at line 6682 of file ppbrush.cpp.

06683 {
06684     if (m_CurrentPressure.m_Pressure < 0 || m_CurrentPressure.m_Pressure > MAXPRESSURE)
06685     {
06686         ERROR3("Invalid pressure here Jim");
06687         return 0;
06688     }
06689     
06690     // set the maximum, we have the option to fix this at 100% if we want
06691     UINT32 MaxPercent = 100;
06692     if (!FixedMaximum)
06693         MaxPercent += MaxEffect;
06694 
06695     UINT32 MinPercent = 100 - MaxEffect;
06696     UINT32 Range = MaxPercent - MinPercent;
06697 
06698     double PressureVal = (double)((double)Range / (double)MAXPRESSURE);
06699     UINT32 CurrentPressure = (UINT32)(PressureVal * m_CurrentPressure.m_Pressure);
06700 
06701     return MinPercent + CurrentPressure;
06702 }

MILLIPOINT PathProcessorBrush::GetDistanceToObject UINT32  ObjectNum  ) 
 

Finds out at what we distance we place the ObjectNum'th object.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
ObjectNum - the object number that we want to get to [INPUTS]
Returns:
the distance along a path that we have to go before we reach ObjectNum

Definition at line 3333 of file ppbrush.cpp.

03334 {
03335     MILLIPOINT Distance = 0;
03336     UINT32 ObjectCounter = 0;
03337 
03338     Reset(); // reset our RNG
03339 
03340     while (ObjectCounter < ObjectNum)
03341     {
03342         Distance += GetNextSpacing();
03343         ObjectCounter++;
03344     }
03345     return Distance;
03346 }

double PathProcessorBrush::GetHueIncrement  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the hue increment for this brush
See also:
-

Definition at line 5120 of file ppbrush.cpp.

05121 {
05122     return m_BrushHueIncrement;
05123 }

UINT32 PathProcessorBrush::GetHueMaxRand  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the hue increment random amount for this brush
See also:
-

Definition at line 5159 of file ppbrush.cpp.

05160 {
05161     return m_BrushHueMaxRand;
05162 }

UINT32 PathProcessorBrush::GetHueRandSeed  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the hue increment random amount for this brush
See also:
-

Definition at line 5199 of file ppbrush.cpp.

05200 {
05201     return m_BrushHueRandSeed;
05202 }

UINT32 PathProcessorBrush::GetLastObject  ) 
 

The last object member keeps track of which object to render next as we proceed along the path.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/2000
Parameters:
- [INPUTS]
Returns:
the last object member

Definition at line 3573 of file ppbrush.cpp.

03574 {
03575     return m_LastObject;
03576 }

double PathProcessorBrush::GetLastScaling  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the last scaling value that was generated

Definition at line 5081 of file ppbrush.cpp.

05082 {
05083     return m_LastScaling;
05084 }

MILLIPOINT PathProcessorBrush::GetLastSpacing  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99 Inputs : -
Returns:
the maximum effect that pressure will have on spacing

Definition at line 4172 of file ppbrush.cpp.

04173 {
04174     return m_LastSpacing;
04175 }

double PathProcessorBrush::GetNextAngle  )  [protected]
 

Pretty much as above, but with the following notes: There are several different ways of applying a rotation angle to brush objects:.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
[INPUTS] 
Returns:
The rotation angle to be applied to the brush object at this point
  • Rotate along the path(i.e. rotate according to the tangent of the path at this point) this is not included here, as the path tangent is known by the time you get to RenderBrushAtPoint

  • Constant angle of rotation, as set by the m_RotateAngle member

  • Random a random fn. determines a different value for each distance

See also:
-

Definition at line 6107 of file ppbrush.cpp.

06108 {
06109     double NewAngle = m_LastRotationNoRandom;
06110     
06111     NewAngle += m_RotAngleIncrConst;
06112     m_LastRotationNoRandom = NewAngle;
06113     double Rand = 0;
06114     double PressureAngle = 1.0;
06115 #ifdef USE_MTRNG
06116     if (m_RotationMaxRand != 0)
06117     {
06118         if (m_pRotationRNG != NULL)
06119         {
06120             // first find out our random range
06121 //          UINT32 UpperLimit = 0;
06122 //          UINT32 LowerLimit = 0;
06123 
06124         //  GetRotationRandomLimits(100, m_RotationMaxRand, &LowerLimit, &UpperLimit);
06125 
06126             Rand = (double)m_pRotationRNG->GetNextRandomNumberScaled(m_RotationMaxRand, 0);
06127 
06128 //double R =  (Rand * 0.01) * 360;
06129 //TRACEUSER( "Phil", _T("Random = %f, Random angle = %f\n"), Rand, R);
06130         }
06131         else
06132             ERROR3("Rotation RNG is NULL");
06133     }
06134     
06135 #endif
06136     if (m_RotationMaxPressure > 0 && m_bValidPressure)
06137     {
06138         UINT32 PressureVal = GetCurrentPressureEffect(m_RotationMaxPressure);
06139         //TRACEUSER( "Diccon", _T("Pressure adj = %d\n"), PressureVal);
06140         PressureAngle = (double)PressureVal / 100; //* 180;
06141     
06142     }
06143     m_LastAngle = (NewAngle * PressureAngle) + Rand;
06144 
06145     while (m_LastAngle > 360)
06146         m_LastAngle -= 360;
06147     //TRACEUSER( "Diccon", _T("Next angle = %f\n"), m_LastAngle);
06148     return m_LastAngle;
06149 }

double PathProcessorBrush::GetNextHueMultiplier  )  [protected]
 

this differs slightly from the other GetNext functions in that it does not return a hue value. Instead it returns a multiplier value which should be given to an HSVChanger object, the HSVChanger should then apply that multiplier to the colours in the brush

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS] Returns the next hue multiplier
See also:
-

Definition at line 6566 of file ppbrush.cpp.

06567 {
06568     double NextHue = 0;
06569 #ifdef USE_MTRNG
06570     if (m_BrushHueMaxRand > 0)
06571     {       
06572         if (m_pHueRNG != NULL)
06573         {
06574             // first find out our random range
06575 //          UINT32 UpperLimit = 0;
06576             UINT32 LowerLimit = 0;
06577 
06578         //  GetRandomLimits(100, m_BrushHueMaxRand, &LowerLimit, &UpperLimit);
06579 
06580             // we want our random numbers in the range 100% +/- MaxRand
06581             UINT32 Random = m_pHueRNG->GetNextRandomNumberScaled(m_BrushHueMaxRand*2, LowerLimit);
06582 
06583         //  INT32 RealRand = Random - 100;
06584             //double Mult = (double)RealRand / 100;
06585             NextHue = (double)Random - m_BrushHueMaxRand ;
06586         }
06587         else
06588             ERROR3("HueVal RNG  is NULL");
06589     }
06590 #endif
06591     m_LastHueMultiplier = NextHue;
06592 //  TRACEUSER( "Diccon", _T("Next Hue = %f\n"), NextHue);
06593     return NextHue;
06594 }

UINT32 PathProcessorBrush::GetNextInkObject UINT32  LastObject,
UINT32  NumObjects
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Lastobject - the index of the last object rendered [INPUTS] Numobjects - the number of ink objects in this brush Returns the index number of the next ink object to use
See also:
-

Definition at line 6338 of file ppbrush.cpp.

06339 {
06340     if (LastObject > NumObjects)
06341     {
06342         ERROR3("Duh, last object can't be greater than maximum");
06343         return 0;
06344     }
06345     UINT32 RetVal = 0;
06346     switch (m_SequenceType)
06347     {
06348         case SEQ_FORWARD:
06349             if (LastObject < NumObjects -1)
06350                 RetVal=  ++LastObject;
06351             else
06352                 RetVal =  0;
06353             break;
06354         case SEQ_BACKWARD:
06355             if (LastObject > 0)
06356                 RetVal = --LastObject;
06357             else
06358                 RetVal =  NumObjects -1;
06359             break;
06360         case SEQ_MIRROR:
06361             // go forward if we are ascending
06362             if (m_MirrorSeqAscend)
06363             {
06364                 if (LastObject < NumObjects -1)
06365                         RetVal = ++LastObject;
06366                 else
06367                 {
06368                     m_MirrorSeqAscend = FALSE;
06369                     RetVal = NumObjects -1;
06370                 }
06371             }
06372             else // go backward if we are descending
06373             {
06374                 if (LastObject > 0)
06375                     RetVal =  --LastObject;
06376                 else
06377                 {
06378                     m_MirrorSeqAscend = TRUE;
06379                     RetVal =  0;
06380                 }
06381             }
06382             break;
06383         case SEQ_RANDOM:
06384             //RetVal =  GetNextRandomNumberScaled(NumObjects, 0);
06385             if (m_pSequenceRNG != NULL)
06386             {
06387                 RetVal = m_pSequenceRNG->GetNextRandomNumberScaled(NumObjects, 0);
06388             }
06389             else
06390             {
06391                 ERROR3("Trying to get a random number with no RNG");
06392             }
06393 
06394             break;
06395         default:
06396             ERROR3("invalid sequence type");
06397             RetVal = 0;
06398             break;
06399     }
06400     // quick check
06401     if (RetVal >= NumObjects)
06402         RetVal--;
06403 
06404 //  TRACEUSER( "Diccon", _T("Ink object = %d, "), RetVal);
06405     return RetVal;
06406 
06407 
06408 }

MILLIPOINT PathProcessorBrush::GetNextOffset  )  [protected]
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS] Returns the next offset to use
See also:
-

Definition at line 6426 of file ppbrush.cpp.

06427 {
06428     ERROR2IF(m_LastOffset < 0, 0, "Invalid last Offset");
06429     ERROR2IF(m_PathOffsetValue < 0, 0, "Invalid Offset value");
06430     
06431     MILLIPOINT NewOffset = m_LastOffsetNoRandom;
06432 
06433     // do the proportional incrementfirst
06434     if (m_PathOffsetIncrProp != 1.0)
06435         NewOffset = (MILLIPOINT)(m_PathOffsetIncrProp * m_LastOffset);
06436     
06437     // add the constant increment
06438     if (m_PathOffsetIncrConst != 0)
06439         NewOffset += m_PathOffsetIncrConst;
06440     
06441     m_LastOffsetNoRandom = NewOffset;
06442     
06443 #ifdef USE_MTRNG
06444     if (m_OffsetValueMaxRand > 0)
06445     {
06446     //  if (m_PathOffsetValue > 0)
06447         {
06448             if (m_pOffsetValueRNG != NULL)
06449             {
06450                 // first find out our random range
06451 //              UINT32 UpperLimit = 0;
06452                 UINT32 LowerLimit = 0;
06453 
06454             //  GetRandomLimits(100, m_OffsetValueMaxRand, &LowerLimit, &UpperLimit);
06455 
06456                 // we want our random numbers in the range 100% +/- MaxRand
06457                 UINT32 Random = m_pOffsetValueRNG->GetNextRandomNumberScaled(m_OffsetValueMaxRand, LowerLimit);
06458                 
06459                 double Mult = (double)Random / 100;
06460 
06461                 BrushDefinition* pBrushDef = GetOurBrushDefinition();
06462                 if (pBrushDef != NULL)
06463                 {
06464                     DocRect BRect = pBrushDef->GetLargestBoundingBox();
06465                     if (!BRect.IsEmpty())
06466                     {
06467                         double Height = (double)BRect.Height();
06468                         Height = Height * Mult;     
06469 
06470                         NewOffset += (INT32)Height;
06471                     }
06472                 }
06473 
06474                 //NewOffset = (MILLIPOINT)(((double)NewOffset) * Mult);
06475                 //TRACEUSER( "Diccon", _T("Spacing = %d\n"), NewSpacing);
06476             }
06477             else
06478                 ERROR3("OffsetVal RNG  is NULL");
06479         }
06480     }
06481 #endif
06482     
06483 
06484     if (NewOffset < 0)
06485         NewOffset = 0;
06486     else 
06487     {
06488         if (NewOffset > MAX_BRUSH_OFFSET)
06489             NewOffset = MAX_BRUSH_OFFSET;
06490     }
06491     m_LastOffset = NewOffset;
06492 //  TRACEUSER( "Diccon", _T("Offset = %d\n"), m_LastOffset);
06493     return m_LastOffset;
06494 }

UINT32 PathProcessorBrush::GetNextOffsetType  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS] Returns the next offset type
See also:
-

Definition at line 6635 of file ppbrush.cpp.

06638 {
06639 
06640     if (m_PathOffsetType != OFFSET_RANDOM )
06641     {
06642         //ERROR3("Trying to get random offset type when we shouldn't be");
06643         return OFFSETTYPE_CENTRE;
06644     }
06645     
06646     UINT32 Offset = OFFSETTYPE_CENTRE;
06647 #ifdef USE_MTRNG
06648     if (m_pOffsetTypeRNG == NULL)
06649     {
06650         ERROR3("Offset Type RNG is NULL");
06651         return OFFSETTYPE_CENTRE;
06652     }
06653     // get a random number, if its even we go left, if its odd we go right
06654     UINT32 Rand = m_pOffsetTypeRNG->operator ()();
06655     if (Rand % 2 == 0)
06656         Offset = OFFSETTYPE_LEFT;
06657     else
06658         Offset = OFFSETTYPE_RIGHT;
06659 
06660     //TRACEUSER( "Diccon", _T("Offset Type = %d\n"), Offset);
06661 #endif
06662     return Offset;
06663 }

double PathProcessorBrush::GetNextPressureTranspAdjust  )  [protected]
 

as above, currently the only thing that affects transparency is pressure. Note that -1 indicates that we are not adjusting transparency

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/6/2000
Parameters:
- [INPUTS] Returns the transparency adjuster value
See also:
notes for GetNextTransparency

Definition at line 6744 of file ppbrush.cpp.

06745 {
06746     double Retval = 1.0;
06747 
06748     if (m_TranspMaxPressure != 0)
06749     {
06750         double PressureEffect = (double)GetCurrentPressureEffect(m_TranspMaxPressure);
06751         if (PressureEffect != 100)
06752         {
06753             Retval = PressureEffect *0.01;
06754         //  TRACEUSER( "Diccon", _T("Transp adjust %f\n"), Retval);     
06755         }
06756     }
06757     return Retval;
06758 }

CSampleItem PathProcessorBrush::GetNextSampleItem CDistanceSampler pSampler,
ValueFunction pValFunc,
double  PathProportion = 0
[protected]
 

Your one stop shop for getting the next pressure value to use. Note that we may not be using pressure at all in which case all of the inputs will be NULL.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
pSampler - the pressure cache that we may be using [INPUTS] pValFunc - the value function that we may be using PathProportion - if you are using a value function then you need to provide this
Returns:
The next item to use from either the value function or the cache. Note that we will use the value function in preference to the cache.

Definition at line 3876 of file ppbrush.cpp.

03878 {
03879     if (PathProportion > 1.0)
03880         PathProportion = 0.98;
03881     if (PathProportion < 0.0)
03882         PathProportion = 0.0;
03883 
03884     // make a default item 
03885     CSampleItem TheItem;
03886     TheItem.m_Pressure = MAXPRESSURE / 2;
03887 
03888     // if we have a value function then use that
03889     if (pValFunc != NULL)
03890     {
03891         double Val = pValFunc->GetValue(PathProportion);
03892         TheItem.m_Pressure = (UINT32)((double)MAXPRESSURE * Val);
03893     //  TRACEUSER( "Diccon", _T("Sample pressure = %d\n"), TheItem.m_Pressure);
03894     }
03895     else if (pSampler != NULL) // otherwise use the sampler
03896     {
03897         pSampler->GetNext(&TheItem);
03898     }
03899 
03900     return TheItem;
03901 }

double PathProcessorBrush::GetNextSaturationMultiplier  )  [protected]
 

this differs slightly from the other GetNext functions in that it does not return a saturation value. Instead it returns a multiplier value which should be given to an HSVChanger object, the HSVChanger should then apply that multiplier to the colours in the brush

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS] Returns the next saturation multiplier
See also:
-

Definition at line 6515 of file ppbrush.cpp.

06516 {
06517     double NextSat = 0;
06518 #ifdef USE_MTRNG
06519     if (m_BrushSatMaxRand > 0)
06520     {       
06521         if (m_pSaturationRNG != NULL)
06522         {
06523             // first find out our random range
06524             UINT32 UpperLimit = 0;
06525             UINT32 LowerLimit = 0;
06526 
06527             GetRandomLimits(100, m_BrushSatMaxRand, &LowerLimit, &UpperLimit);
06528 
06529             // we want our random numbers in the range 100% +/- MaxRand
06530             UINT32 Random = m_pSaturationRNG->GetNextRandomNumberScaled(UpperLimit, LowerLimit);
06531 
06532             // do a bit of cheating here as we want to allow negative numbers
06533             INT32 NewRand = Random - 100;
06534             double Mult = (double)NewRand / 100;
06535         //  TRACEUSER( "Diccon", _T("Sat Rand = %d\n"), NewRand);
06536             NextSat = Mult;
06537             
06538         }
06539         else
06540             ERROR3("SaturationVal RNG  is NULL");
06541     }
06542 #endif  
06543     m_LastSatMultiplier = NextSat;
06544     return NextSat;
06545 }

double PathProcessorBrush::GetNextScaling UINT32  Index  ) 
 

Pretty much as above, but with the following notes: There are several different ways of applying a rotation angle to brush objects:.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
[INPUTS] 
Returns:
The scaling to be applied to the brush object at this point
  • Constant scaling, as set by the m_BrushScaling member
  • Increasing/decreasing as set by m_ScalingIncr and m_LastScaling
  • Random - a random fn. provides a value to be applied

See also:
-

Definition at line 6170 of file ppbrush.cpp.

06171 {
06172     ERROR2IF(m_LastScaling < 0, 1.0, "Invalid scaling value");
06173     ERROR2IF(m_BrushScalingIncr <= 0, 1.0, "Invalid scaling value");
06174     
06175     double NewScaling = m_BrushScaling;
06176     if (Index > 0)
06177         NewScaling = m_LastScalingNoRandom; 
06178     double RandomScale = 1.0;
06179     double PressureScale = 1.0;
06180 
06181     // record the last value before randomness
06182     m_LastScalingNoRandom = NewScaling;
06183     if (m_BrushScalingMaxRand != 0)
06184     {
06185 #ifdef USE_MTRNG
06186         if (m_pScalingRNG != NULL)
06187         {
06188             // first find out our random range
06189             UINT32 UpperLimit = 0;
06190             UINT32 LowerLimit = 0;
06191 
06192             GetRandomLimits(100, m_BrushScalingMaxRand, &LowerLimit, &UpperLimit);
06193             // we want our random numbers in the range 100% +/- MaxRand
06194             UINT32 Random = m_pScalingRNG->GetNextRandomNumberScaled(UpperLimit, LowerLimit, 100);
06195                                                                    
06196             //TRACEUSER( "Diccon", _T("Random val =  %d\n"), Random);
06197             RandomScale = (double)Random / 100; 
06198 //TRACEUSER( "Phil", _T("Scaling = %f\n"), m_BrushScaling * RandomScale);
06199         }
06200 #endif  
06201     }
06202     if (m_ScalingMaxPressure > 0 && m_bValidPressure)
06203     {
06204         UINT32 PressureVal = GetCurrentPressureEffect(m_ScalingMaxPressure, TRUE);
06205         
06206         PressureScale = (double)PressureVal / 100;
06207     //  TRACEUSER( "Diccon", _T("Pressure Val = %d, Scale = %f\n"), PressureVal, PressureScale);
06208     }
06209     
06210     NewScaling = NewScaling * RandomScale * PressureScale;
06211 
06212     // we're no longer stopping you from going under the minimum scaling, but there is code in place
06213     // to break out of the rendering loop if you do so.
06214 
06215 /*  if (NewScaling <= MIN_BRUSH_SCALE)
06216         NewScaling = MIN_BRUSH_SCALE;
06217     else */
06218     {
06219         if (NewScaling >= m_MaxScaling)
06220                 NewScaling = m_MaxScaling;
06221     }
06222 
06223     // if its the first object then we want to return the actual scaling value, 
06224     // not the change in scaling
06225     double NextScaling = NewScaling;
06226     
06227     if (!m_UseActualScaling)
06228         NextScaling = NewScaling / m_LastScalingRendered;
06229     
06230     m_LastScaling = NewScaling;
06231     
06232     //TRACEUSER( "Diccon", _T("Actual Scaling = %f, Next Scaling = %f, Last Rendered = %f\n"), NewScaling, NextScaling, m_LastScalingRendered);
06233 
06234     return NextScaling;
06235 }

MILLIPOINT PathProcessorBrush::GetNextSpacing  ) 
 

Returns the next spacing to use, this can be determined in several ways, as with the other object placement attributes.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS] Returns the next spacing to use
See also:
-
TRACEUSER( "Diccon", _T("Spacing = %d\n"), NewSpacing);

Definition at line 6253 of file ppbrush.cpp.

06254 {
06255     ERROR2IF(m_LastSpacing <= 0, 10000, "Invalid last spacing");
06256     ERROR2IF(m_BrushSpacing <= 0, 10000, "Invalid spacing value");
06257     
06258     // start of with the previous spacing value, before it had its random effect added.
06259     // If we don't do this then we end up with a random walk effect, always getting either
06260     // bigger or smaller
06261     MILLIPOINT NewSpacing = m_LastSpacingNoRandom;
06262     
06263     // do the proportional incrementfirst
06264     if (m_BrushSpacingIncrProp != 1.0)
06265         NewSpacing = (MILLIPOINT)(m_BrushSpacingIncrProp * m_LastSpacing);
06266     
06267     // add the constant increment
06268     if (m_BrushSpacingIncrConst != 0)
06269         NewSpacing += m_BrushSpacingIncrConst;
06270     
06271     // store this value so we can use it next time
06272     m_LastSpacingNoRandom = NewSpacing;
06273 
06274     if (m_BrushSpacingMaxRand != 0)
06275     {
06276 #ifdef USE_MTRNG
06277         if (m_pSpacingRNG != NULL)
06278         {
06279             // first find out our random range
06280             UINT32 UpperLimit = 0;
06281             UINT32 LowerLimit = 0;
06282 
06283             GetRandomLimits(100, m_BrushSpacingMaxRand, &LowerLimit, &UpperLimit);
06284             // we want our random numbers in the range 100% +/- MaxRand
06285             //UINT32 Random = m_pSpacingRNG->GetNextRandomNumberScaled(100 + m_BrushSpacingMaxRand,
06286             //                                                      100 - m_BrushSpacingMaxRand);
06287             
06288             // now ask our RNG to get a number between these limits
06289             UINT32 Random = m_pSpacingRNG->GetNextRandomNumberScaled(UpperLimit, LowerLimit/2, 100);
06290         
06291             // we treat our numbers as percentages
06292             double Mult = (double)Random / 100;
06293             //TRACEUSER( "Diccon", _T("Random spacing multiplier = %f\n"), Mult);
06294             NewSpacing = (MILLIPOINT)(((double)NewSpacing) * Mult);
06295     
06296         }
06297 #endif
06298     }
06299     if (m_SpacingMaxPressure > 0 && m_bValidPressure)
06300     {
06301         UINT32 PressureVal = GetCurrentPressureEffect(m_SpacingMaxPressure);
06302     //  TRACEUSER( "Diccon", _T("Pressure adj = %d\n"), PressureVal);
06303         double PressureScale = (double)PressureVal / 100;
06304         NewSpacing = (MILLIPOINT)((double)NewSpacing * PressureScale);
06305     }
06306     
06307     
06308 
06309     if (NewSpacing < MIN_BRUSH_SPACING)
06310         NewSpacing = MIN_BRUSH_SPACING;
06311     else 
06312     {
06313         if (NewSpacing > MAX_BRUSH_SPACING)
06314             NewSpacing = MAX_BRUSH_SPACING;
06315     }
06316 
06317     m_LastSpacing = NewSpacing;
06319     return m_LastSpacing;
06320 }

double PathProcessorBrush::GetNextTransparencyAdjust  )  [protected]
 

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/6/2000
Parameters:
- [INPUTS] Returns the first transparency adjustment value
See also:
GetPressureTranspAdjust()
Notes: Transparency variations now work through multipliers, as opposed to the previous replacement system. This value returned from this function is the main transparency adjuster value.

Definition at line 6723 of file ppbrush.cpp.

06724 {
06725     return (double)m_BrushTransparency * 0.01;
06726 }

UINT32 PathProcessorBrush::GetNumBrushObjects  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the number of objects used by our brush definition, or zero if something goes wrong
See also:
-

Definition at line 5477 of file ppbrush.cpp.

05478 {
05479     BrushDefinition* pBrushDef = GetOurBrushDefinition();
05480     if (pBrushDef == NULL)
05481         return 0;
05482     return pBrushDef->GetNumBrushObjects();
05483 }

INT32 PathProcessorBrush::GetObjectCountToDistance MILLIPOINT  Distance  ) 
 

To find out how many brush objects we will have in the distance given.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
Distance along the path to find the object count for [INPUTS]
Returns:
the number of brush objects in the distance provided.

Definition at line 3305 of file ppbrush.cpp.

03306 {
03307     if (Distance < 0)
03308         return -1;
03309     Reset();  // set our RNG back to the start
03310     MILLIPOINT DistanceSoFar = 0;
03311     INT32 Count = 0;
03312     while (DistanceSoFar < Distance)
03313     {
03314         DistanceSoFar += GetNextSpacing();
03315         Count++;
03316     }
03317     return Count;
03318 }

UINT32 PathProcessorBrush::GetOffsetTypeRandSeed  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the seed used to determine the sequence of random numbers for offset value

Definition at line 4451 of file ppbrush.cpp.

04452 {
04453     return m_OffsetTypeRandSeed;
04454 }

UINT32 PathProcessorBrush::GetOffsetValueMaxRand  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the maximum percentage randomness to be applied to Offset

Definition at line 4362 of file ppbrush.cpp.

04363 {
04364     return m_OffsetValueMaxRand;
04365 }

UINT32 PathProcessorBrush::GetOffsetValueRandSeed  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the seed used to determine the sequence of random numbers for offset value

Definition at line 4401 of file ppbrush.cpp.

04402 {
04403     return m_OffsetValueRandSeed;
04404 }

BrushDefinition * PathProcessorBrush::GetOurBrushDefinition  )  [virtual]
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the brush definition corresponding to our brush handle

Reimplemented in BlendedPathProcessorBrush.

Definition at line 3070 of file ppbrush.cpp.

03071 {
03072     // first check to see that we have been assigned a brush
03073     if (m_BrushHandle == BrushHandle_NoBrush)
03074     {
03075         //ERROR3("This processor has not been assigned a brush");
03076         return NULL;
03077     }
03078 
03079     return BrushComponent::FindBrushDefinition(m_BrushHandle);
03080 
03081 }

AttrBrushType * PathProcessorBrush::GetParentAttribute  ) 
 

returns the attribute associated with this ppb

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
-
See also:
-

Definition at line 5888 of file ppbrush.cpp.

05889 {
05890     return m_pParentAttr;
05891 }

MILLIPOINT PathProcessorBrush::GetPathOffsetIncrConst  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
The value of the constant path offset increment used by this brush
See also:
-

Definition at line 4282 of file ppbrush.cpp.

04283 {
04284     return m_PathOffsetIncrConst;
04285 }

double PathProcessorBrush::GetPathOffsetIncrProp  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
The value of the proportional path offset increment used by this brush
See also:
-

Definition at line 4319 of file ppbrush.cpp.

04320 {
04321     return m_PathOffsetIncrProp;
04322 }

PathOffset PathProcessorBrush::GetPathOffsetType void   ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
The type of pathoffset this brush is using
See also:
-

Definition at line 4190 of file ppbrush.cpp.

04191 {
04192     return m_PathOffsetType;
04193 }

MILLIPOINT PathProcessorBrush::GetPathOffsetValue void   ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
The value of the path offset used by this brush
See also:
-

Definition at line 4238 of file ppbrush.cpp.

04239 {
04240     return m_PathOffsetValue;
04241 }

BOOL PathProcessorBrush::GetPointAtDistance Path pPath,
MILLIPOINT  Distance,
DocCoord pPoint,
double *  pTangent
[protected]
 

Gets the coordinate of a point a certain distance along this path, either by looking in its cache pr by calling the Path class function.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
pPath - the path along which is the poiht we want [INPUTS] Distance = a length along the path
pPoint = the coordinate of the point that distance along the path [OUTPUTS] pTangent = tangent at this point (can be NULL)
Returns:
TRUE/FALSE for success/failure

Definition at line 2278 of file ppbrush.cpp.

02280 {
02281     ERROR2IF(pPoint == NULL,FALSE,"NULL pPoint param");
02282     ERROR2IF(pPath == NULL, FALSE, "Path is NULL");
02283 //  ERROR2IF(m_pParentAttr == NULL, FALSE, "parent attribute is NULL");
02284     BOOL Found = FALSE;
02285     BrushPointInfo PointInfo;
02286 
02287 
02288 #ifdef BRUSHPOINTSCACHE
02289     // retrieve pointer to the cache from parent attribute
02290     PointsMap* pCache = NULL;
02291     if (m_pParentAttr != NULL && m_pParentAttr->CanUsePointsCache())
02292     {
02293         pCache = m_pParentAttr->GetCache();
02294         if (pCache != NULL)
02295         {
02296             // look for point in the cache
02297             PointsMap::iterator iter = pCache->find( Distance );
02298             Found = ( pCache->end() != iter );
02299             if( Found )
02300             {
02301                 PointInfo = iter->second;
02302             }
02303 
02304         //  if (Found)
02305         //      TRACEUSER( "Diccon", _T("Point found in cache %d, %d\n"), PointInfo.m_Point.x, PointInfo.m_Point.y);
02306         }
02307     }
02308     
02309 #endif
02310     if (!Found)
02311     {   
02312         // get the point from the path
02313         if (pPath->GetPointAtDistance(Distance,&PointInfo.m_Point,&PointInfo.m_Tangent, &PointInfo.m_Pressure))
02314         {
02315 #ifdef BRUSHPOINTSCACHE
02316             // insert it into the cache
02317             if (pCache != NULL)
02318                 (*pCache)[Distance] = PointInfo;
02319 #endif
02320             //TRACEUSER( "Diccon", _T("Point %d, %d found from line\n"), PointInfo.m_Point.x, PointInfo.m_Point.y);
02321             Found = TRUE;
02322         }
02323         
02324     }
02325 
02326     if (Found)
02327     {
02328         *pPoint = PointInfo.m_Point;
02329         if (pTangent)
02330             *pTangent = PointInfo.m_Tangent;
02331         
02332     }
02333 
02334 
02335     if (Found == FALSE)
02336         TRACEUSER( "Diccon", _T("Not found at distance %d\n"), Distance);
02337     return Found;
02338 }

CDistanceSampler * PathProcessorBrush::GetPressureCacheAndInitialise NodeRenderableInk pInkNode,
ValueFunction **  ppValFunc
 

This should be called to get the pressure cache from the attribute and to set up the relevant members when we wish to start retrieving pressure data from the beginning.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
pInkNode - the inknode that hsa this brush applied to it [INPUTS]
ppValFunc - if a non-constant variable width attribute is applied to pInkNode then [OUTPUTS] we will return a pointer to it
Returns:
pointer to the pressure data held by our attribute, or NULL if either we don't have a pressure cache OR a non-constant VWF is applied to our inknoded
This overridden version is designed to be use when no render region is available but we still need pressure info, for example when calculating bounding boxes or DoBecomeA's. It is a little slower as we have to search for the applied attribute.

Definition at line 3818 of file ppbrush.cpp.

03820 {
03821     ERROR2IF(pInkNode == NULL, NULL, "Ink node is NULL in PathProcessorBrush::GetPressureCacheAndInitialise");
03822 
03823     ValueFunction* pValFunc = NULL;
03824     AttrVariableWidth* pVarWidth = NULL;
03825     
03826     if (pInkNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrVariableWidth), (NodeAttribute**)&pVarWidth))
03827     {
03828         VariableWidthAttrValue* pVal = (VariableWidthAttrValue*)pVarWidth->GetAttributeValue();
03829         pValFunc = pVal->GetWidthFunction();
03830     }
03831     
03832         // If it is a constant width stroke, then we ignore it, try to get the cache from the attribute instead
03833     if (pValFunc == NULL || IS_A(pValFunc, ValueFunctionConstant))
03834         return GetPressureCacheAndInitialise();
03835     else
03836     {
03837         // set our starting pressure value
03838 
03839         // set the default pressure to normal value
03840         m_CurrentPressure.m_Pressure = MAXPRESSURE / 2;
03841         
03842         // get the first value out of the value function
03843         double Val = pValFunc->GetValue(0);
03844         
03845         m_CurrentPressure.m_Pressure = (UINT32)((double)MAXPRESSURE * Val);
03846 
03847         // assign it to the output pointer
03848         *ppValFunc = pValFunc;
03849 
03850         m_bValidPressure = TRUE;
03851     }
03852 
03853 
03854     return NULL;
03855 }

CDistanceSampler * PathProcessorBrush::GetPressureCacheAndInitialise RenderRegion pRegion,
ValueFunction **  ppValFunc
 

This should be called to get the pressure cache from the attribute and to set up the relevant members when we wish to start retrieving pressure data from the beginning.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
pRegion - the render region we are about to render into [INPUTS]
ppValFunc - if a non-constant variable width attribute has been rendered into [OUTPUTS] pRegion then we return a pointer to it
Returns:
pointer to the pressure data held by our attribute, or NULL if either we don't have a pressure cache OR the render region contains a variable width attribute with a non-constant value function.
This overridden version allows us to use applied variable width strokes to provide pressure information instead of the input pressure data. If we find one of these has been rendered into the render region we will use this in preferenve to the cache found in the AttrBrushType.

Definition at line 3757 of file ppbrush.cpp.

03758 {
03759     ERROR2IF(pRegion == NULL, NULL, "Render region is NULL in PathProcessorBrush::GetPressureCacheAndInitialise");
03760 
03761     ValueFunction* pValFunc = NULL;
03762 
03763     // first look for the variable width function
03764     VariableWidthAttrValue *pVarWidthAttr = (VariableWidthAttrValue *) pRegion->GetCurrentAttribute(ATTR_VARWIDTH);
03765     if (pVarWidthAttr != NULL)
03766         pValFunc = pVarWidthAttr->GetWidthFunction();
03767 
03768     
03769     // If it is a constant width stroke, then we ignore it, try to get the cache from the attribute instead
03770     if (pValFunc == NULL || IS_A(pValFunc, ValueFunctionConstant))
03771         return GetPressureCacheAndInitialise();
03772     else
03773     {
03774         // set our starting pressure value
03775 
03776         // set the default pressure to normal value
03777         m_CurrentPressure.m_Pressure = MAXPRESSURE / 2;
03778         
03779         // get the first value out of the value function
03780         double Val = pValFunc->GetValue(0);
03781         
03782         m_CurrentPressure.m_Pressure = (UINT32)((double)MAXPRESSURE * Val);
03783 
03784         // assign it to the output pointer
03785         *ppValFunc = pValFunc;
03786 
03787         m_bValidPressure = TRUE;
03788     }
03789     return NULL;
03790 }

CDistanceSampler * PathProcessorBrush::GetPressureCacheAndInitialise  ) 
 

This should be called to get the pressure cache from the attribute and to set up the relevant members when we wish to start retrieving pressure data from the beginning.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
- [INPUTS]
Returns:
pointer to the pressure data held by our attribute, or NULL if we fail

Definition at line 3689 of file ppbrush.cpp.

03690 {
03691     // initialise to NULL
03692     CDistanceSampler* pPressure = NULL;
03693     
03694     // get the cache from our parent attribute
03695     if (m_pParentAttr != NULL)
03696         pPressure = m_pParentAttr->GetPressureCache();
03697     
03698     
03699     // initialise members to their starting values
03700     CSampleItem TheItem;
03701     
03702     // our first sample is a short distance in
03703     MILLIPOINT FirstDistance = 10;
03704 
03705     // set the default pressure to normal value
03706     m_CurrentPressure.m_Pressure = MAXPRESSURE / 2;
03707     if (pPressure == NULL)
03708         m_bValidPressure = FALSE;
03709     else
03710     {   
03711         if (pPressure->GetAt(0, &TheItem))
03712         {   
03713             if (TheItem.m_Pressure < 0 || TheItem.m_Pressure > MAXPRESSURE)
03714             {
03715                 ERROR3("Invalid pressure here ");
03716             }
03717             else
03718             {
03719                 m_CurrentPressure.m_Pressure = TheItem.m_Pressure;
03720                 pPressure->SetSampleRateFromSpacing(FirstDistance);
03721             }
03722         }
03723         else
03724             ERROR3("Unable to retrieve first pressure value in PathProcessorBrush::ProcessPath");
03725         
03726         m_bValidPressure = TRUE;
03727     }
03728     return pPressure;
03729 }

void PathProcessorBrush::GetRandomLimits UINT32  Base,
UINT32  MaxRand,
UINT32 pLower,
UINT32 pUpper
[static]
 

To determine the upper and lower bounds of a random range.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Base - the base number which you will use to derive the limits. e.g. if you are [INPUTS] working in percentages then you will probably want to use 100 as your base. In fact this has not been tested with a base other than 100 so that is what is advised.
MaxRand the maximum random amount, only really tested in the range 0 - 100 with 0 being no random (i.e upperlimit = lowerlimit = base) and 100 being the maximum (i.e. lowerlimit = base * 1/MAX_RANDOM_FACTOR and upperlimit = base * MAX_RANDOM_FACTOR
Parameters:
pLower will point to a value which will be the lower bound of our random range [OUTPUTS] pUpper - similar for the upper bound

Definition at line 6818 of file ppbrush.cpp.

06819 {
06820     // quick checks
06821     if (pLower == NULL || pUpper == NULL) 
06822     {
06823         ERROR3("Illegal entry parameters in PathProcessorBrush::GetRandomLimits");
06824         return;
06825     }
06826     
06827     if (MaxRand > MAX_RANDOM_AMOUNT || MaxRand < MIN_RANDOM_AMOUNT)
06828     {
06829         ERROR3("Illegal entry parameters in PathProcessorBrush::GetRandomLimits");
06830         *pLower = Base;
06831         *pUpper = Base;
06832         return;
06833     }
06834     
06835     if (MaxRand == 0)
06836     {
06837         *pLower = Base;
06838         *pUpper = Base;
06839         return;
06840     }
06841 
06842     // so we're ok.
06843     double RandomFactor = (double)MaxRand / 100;
06844     RandomFactor = (RandomFactor * MAX_RANDOM_FACTOR) + MIN_RANDOM_FACTOR;
06845 
06846     *pLower = (UINT32)((double)Base  / RandomFactor);
06847     *pUpper  =(UINT32)((double)Base * RandomFactor);
06848 
06849     
06850     return;
06851 }

double PathProcessorBrush::GetRotationAngle  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the angle of rotation that has been set
See also:
-

Definition at line 4570 of file ppbrush.cpp.

04571 {
04572     return m_RotateAngle;
04573 }

double PathProcessorBrush::GetRotationIncrConst  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the increment to the angle of rotation
See also:
-

Definition at line 4609 of file ppbrush.cpp.

04610 {
04611     return m_RotAngleIncrConst;
04612 }

double PathProcessorBrush::GetRotationIncrProp  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the increment to the angle of rotation
See also:
-

Definition at line 4648 of file ppbrush.cpp.

04649 {
04650     return m_RotAngleIncrProp;
04651 }

UINT32 PathProcessorBrush::GetRotationMaxPressure  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the seed to use to generate the rotation RNG
See also:
-

Definition at line 4754 of file ppbrush.cpp.

04755 {
04756     return m_RotationMaxPressure;
04757 }

UINT32 PathProcessorBrush::GetRotationMaxRand  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the maximum amount of randomness to be applied to the rotation angle
See also:
-

Definition at line 4666 of file ppbrush.cpp.

04667 {
04668     return m_RotationMaxRand;
04669 }

void PathProcessorBrush::GetRotationRandomLimits UINT32  Base,
UINT32  MaxRand,
UINT32 pLower,
UINT32 pUpper
[static]
 

To determine the upper and lower bounds of a random range, differs from the above function in that the maximum rotation random factor is different.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Base - the base number which you will use to derive the limits. e.g. if you are [INPUTS] working in percentages then you will probably want to use 100 as your base. In fact this has not been tested with a base other than 100 so that is what is advised.
MaxRand the maximum random amount, only really tested in the range 0 - 100 with 0 being no random (i.e upperlimit = lowerlimit = base) and 100 being the maximum (i.e. lowerlimit = base * 1/MAX_RANDOM_FACTOR and upperlimit = base * MAX_RANDOM_FACTOR
Parameters:
pLower will point to a value which will be the lower bound of our random range [OUTPUTS] pUpper - similar for the upper bound

Definition at line 6874 of file ppbrush.cpp.

06875 {
06876     // quick checks
06877     if (pLower == NULL || pUpper == NULL) 
06878     {
06879         ERROR3("Illegal entry parameters in PathProcessorBrush::GetRandomLimits");
06880         return;
06881     }
06882     
06883     if (MaxRand > MAX_RANDOM_AMOUNT || MaxRand < MIN_RANDOM_AMOUNT)
06884     {
06885         ERROR3("Illegal entry parameters in PathProcessorBrush::GetRandomLimits");
06886         *pLower = Base;
06887         *pUpper = Base;
06888         return;
06889     }
06890     
06891     if (MaxRand == 0)
06892     {
06893         *pLower = Base;
06894         *pUpper = Base;
06895         return;
06896     }
06897 
06898     // so we're ok.
06899     double RandomFactor = (double)MaxRand / 100;
06900     RandomFactor = (RandomFactor * MAX_ROTATION_RANDOM_FACTOR) + MIN_RANDOM_FACTOR;
06901 
06902     *pLower = (UINT32)((double)Base  / RandomFactor);
06903     *pUpper  =(UINT32)((double)Base * RandomFactor);
06904 
06905     
06906     return;
06907 
06908 }

UINT32 PathProcessorBrush::GetRotationRandSeed  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the seed to use to generate the rotation RNG
See also:
-

Definition at line 4705 of file ppbrush.cpp.

04706 {
04707     return m_RotationRandSeed;
04708 }

double PathProcessorBrush::GetSatIncrement  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the Saturation increment for this brush
See also:
-

Definition at line 5250 of file ppbrush.cpp.

05251 {
05252     return m_BrushSatIncrement;
05253 }

UINT32 PathProcessorBrush::GetSatMaxRand  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the Saturation increment random amount for this brush
See also:
-

Definition at line 5289 of file ppbrush.cpp.

05290 {
05291     return m_BrushSatMaxRand;
05292 }

UINT32 PathProcessorBrush::GetSatRandSeed  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the Saturation increment random amount for this brush
See also:
-

Definition at line 5329 of file ppbrush.cpp.

05330 {
05331     return m_BrushSatRandSeed;
05332 }

double PathProcessorBrush::GetScaleValue MILLIPOINT  Value  ) 
 

as above, but simply retuns the value

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
the value to scale to [INPUTS]
Returns:
the scaling value required to scale to the value given, or -1 if something went wrong
See also:
-

Definition at line 5986 of file ppbrush.cpp.

05987 {
05988     MILLIPOINT Height = GetBrushSize();
05989     double ScaleFactor = double((double)Value / (double)Height);
05990 
05991     return ScaleFactor;
05992 }

UINT32 PathProcessorBrush::GetScalingMaxPressure  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the maximum percentage effect that pressure will have on Scaling

Definition at line 5064 of file ppbrush.cpp.

05065 {
05066     return m_ScalingMaxPressure;
05067 }

UINT32 PathProcessorBrush::GetScalingMaxRand  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the maximum percentage randomness to be applied to Scaling

Definition at line 4979 of file ppbrush.cpp.

04980 {
04981     return m_BrushScalingMaxRand;
04982 }

UINT32 PathProcessorBrush::GetScalingRandSeed  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the seed used to determine the sequence of random numbers for Scaling

Definition at line 5018 of file ppbrush.cpp.

05019 {
05020     return m_BrushScalingRandSeed;
05021 }

UINT32 PathProcessorBrush::GetSequenceSeed  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the seed we are using to generate random sequences
See also:
-

Definition at line 5456 of file ppbrush.cpp.

05457 {
05458     return m_SequenceRandSeed;
05459 }

SequenceType PathProcessorBrush::GetSequenceType  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the type of sequence we are using for mutliple ink objects
See also:
-

Definition at line 5379 of file ppbrush.cpp.

05380 {
05381     return m_SequenceType;
05382 }

MILLIPOINT PathProcessorBrush::GetSpacing void   ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the spacing between the brush objects

Definition at line 3949 of file ppbrush.cpp.

03950 {
03951     return m_BrushSpacing;
03952 }

BOOL PathProcessorBrush::GetSpacingAndScalingAtDistance MILLIPOINT  Distance,
MILLIPOINT pSpacing,
double *  pScaling,
UINT32 pPressure = NULL
 

Retrieves the values for spacing, scaling and pressure, that are in effect at Distance along the path.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/2000
Parameters:
Distance along the path [INPUTS]
pSpacing - the spacing at that distance [OUTPUTS] pScaling - the scaling at that distance pPressure (bonus) - the pressure, defaults to NULL
Returns:
the spacing to the next object, or -1 if Distance is invalid
Notes: This is a replacement for GetSpacingAtDistance which is necessary now that spacing is dependant on the scaling of each brush object. This function duplicates the loop found in ProcessPath, iterating through brush objects replicating the spacing and scaling values that would be found in the render loop.

2nd Note: The spacing value is a bit of a misnomer, what we really retrieve is the distance to the next object after Distance.

Definition at line 3405 of file ppbrush.cpp.

03408 {
03409     // some checks
03410     ERROR2IF(pSpacing == NULL, FALSE, "Invalid input to PathProcessorBrush::GetSpacingAndScalingAtDistance");
03411     ERROR2IF(pScaling == NULL, FALSE, "Invalid input to PathProcessorBrush::GetSpacingAndScalingAtDistance");
03412     ERROR2IF(Distance < 0, FALSE, "Invalid input to PathProcessorBrush::GetSpacingAndScalingAtDistance");
03413 
03414     // first reset our members so we start at the beginning
03415     Reset();
03416 
03417     // get the pressure cache from our attribute, if there is one
03418     CDistanceSampler* pSampler = GetPressureCacheAndInitialise();
03419     CSampleItem TheItem;
03420 
03421     UINT32 Count = 0;
03422     m_CurrentScaling = GetNextScaling(Count);
03423     MILLIPOINT Spacing = GetNextSpacing();
03424     MILLIPOINT DistanceSoFar = 0;  // we start at 10 MP in from the start of the path, for consistenc
03425 
03426     while (DistanceSoFar <= Distance)
03427     {
03428         // increment our distance
03429 #ifdef SCALESPACING
03430         DistanceSoFar += (MILLIPOINT)(Spacing * m_LastScaling);
03431 #else
03432         DistanceSoFar += (MILLIPOINT)Spacing;
03433 #endif
03434         
03435         // get the next pressure value, if there is one
03436         if (pSampler != NULL)
03437         {
03438             if (pSampler->GetNext(&TheItem))
03439             {
03440                 if (TheItem.m_Pressure < MAXPRESSURE)
03441                     m_CurrentPressure.m_Pressure = TheItem.m_Pressure;
03442             }
03443         }   
03444 #ifdef SCALESPACING 
03445         if (pPressure)
03446             pSampler->SetSampleRateFromSpacing((INT32)(Spacing * m_LastScaling));
03447 #else
03448         if (pPressure)
03449             pSampler->SetSampleRateFromSpacing(Spacing);
03450 #endif
03451         
03452         // get the next spacing and scaling values
03453         Spacing = GetNextSpacing();
03454         m_CurrentScaling = GetNextScaling(Count);
03455     }
03456 
03457     // we want the distance to the next brush object
03458     MILLIPOINT DistanceGap = DistanceSoFar - Distance;
03459     if (Spacing < DistanceGap)
03460         DistanceGap = Spacing;
03461 
03462     // hopefully this little hack will deal with the case when we are adding to the start of the path
03463     if (DistanceGap == 0)
03464         DistanceGap = Spacing;
03465 
03466     // assign the data we've found
03467     *pSpacing = DistanceGap;
03468     *pScaling = m_CurrentScaling;
03469     if (pPressure != NULL)
03470         *pPressure = m_CurrentPressure.m_Pressure;
03471 
03472     return TRUE;
03473 }

MILLIPOINT PathProcessorBrush::GetSpacingAtDistance MILLIPOINT  Distance  ) 
 

If we are Distance along our path then thif function finds out how far it would be to the next brush object.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
Parameters:
Distance along the path [INPUTS]
Returns:
the spacing to the next object, or -1 if Distance is invalid

Definition at line 3361 of file ppbrush.cpp.

03362 {
03363     if (Distance < 0)
03364         return -1;
03365 
03366     Reset(); // set our RNG
03367 
03368     MILLIPOINT DistanceSoFar = 0;
03369     
03370     while (DistanceSoFar <= Distance)
03371     {
03372         DistanceSoFar+= GetNextSpacing();
03373     }
03374 
03375     MILLIPOINT SpacingGap = DistanceSoFar - Distance;
03376     TRACEUSER( "Diccon", _T("Spacing at distance = %d\n"), SpacingGap);
03377     return SpacingGap;
03378 }

MILLIPOINT PathProcessorBrush::GetSpacingIncrConst  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the constant spacing increment between the brush objects

Definition at line 4028 of file ppbrush.cpp.

04029 {
04030     return m_BrushSpacingIncrConst;
04031 }

double PathProcessorBrush::GetSpacingIncrProp  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the spacing between the brush objects

Definition at line 3990 of file ppbrush.cpp.

03991 {
03992     return m_BrushSpacingIncrProp;
03993 }

UINT32 PathProcessorBrush::GetSpacingMaxPressure  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99 Inputs : -
Returns:
the maximum effect that pressure will have on spacing

Definition at line 4153 of file ppbrush.cpp.

04154 {
04155     return m_SpacingMaxPressure;
04156 }

UINT32 PathProcessorBrush::GetSpacingMaxRand  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the maximum percentage randomness to be applied to spacing

Definition at line 4045 of file ppbrush.cpp.

04046 {
04047     return m_BrushSpacingMaxRand;
04048 }

UINT32 PathProcessorBrush::GetSpacingRandSeed  ) 
 

As above.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Returns:
the seed used to determine the sequence of random numbers for spacing

Definition at line 4084 of file ppbrush.cpp.

04085 {
04086     return m_BrushSpacingRandSeed;
04087 }

UINT32 PathProcessorBrush::GetTransparencyPressure  ) 
 

Sets the extent to which pressure affects transparency.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
Value - the value to set [INPUTS]
Returns:
See also:
-

Definition at line 5606 of file ppbrush.cpp.

05607 {
05608     return m_TranspMaxPressure;
05609 }

BOOL PathProcessorBrush::GetUseLocalFillColour  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the flag saying whether or not to use our local fill when rendering
See also:
-

Definition at line 5499 of file ppbrush.cpp.

05500 {
05501     return m_bUseLocalFillColour;
05502 }

BOOL PathProcessorBrush::GetUseLocalTransp  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the flag saying whether or not to use our local transparency
See also:
-

Definition at line 5624 of file ppbrush.cpp.

05625 {
05626     return m_bUseLocalTransp;
05627 }

BOOL PathProcessorBrush::GetUseNamedColours  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
- [INPUTS]
Returns:
the flag saying whether or not to use our named colours when rendering
See also:
-

Definition at line 5663 of file ppbrush.cpp.

05664 {
05665     return m_bUseNamedColours;
05666 }

INT32 PathProcessorBrush::HowManyObjectsInDistance MILLIPOINT  Distance  )  [protected]
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
a distance [INPUTS] Returns the number of brush object that will fit in the given distance
See also:
-

Definition at line 7033 of file ppbrush.cpp.

07034 {
07035     INT32 NumObjects = 0;
07036     MILLIPOINT DistanceSoFar = 0;
07037     MILLIPOINT Spacing = m_BrushSpacing;
07038 
07039     while (DistanceSoFar <= Distance)
07040     {
07041         NumObjects++;
07042         Spacing = (MILLIPOINT)(Spacing * m_BrushSpacingIncrProp);
07043         Spacing += m_BrushSpacingIncrConst;
07044         if (Spacing < MIN_BRUSH_SPACING)
07045             Spacing = MIN_BRUSH_SPACING;
07046         else 
07047         {
07048             if (Spacing > MAX_BRUSH_SPACING)
07049                     Spacing = MAX_BRUSH_SPACING;
07050         }
07051         DistanceSoFar += Spacing;
07052     }
07053     return NumObjects;
07054 }

BOOL PathProcessorBrush::IsAPathProcessorBrush  )  [virtual]
 

Virtual identifier.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Returns:
TRUE!

Reimplemented from PathProcessor.

Definition at line 336 of file ppbrush.cpp.

00337 {
00338     return TRUE;
00339 }

virtual BOOL PathProcessorBrush::IsBlended  )  [inline, virtual]
 

Reimplemented in BlendedPathProcessorBrush.

Definition at line 181 of file ppbrush.h.

00181 { return FALSE;}

BOOL PathProcessorBrush::IsDifferent PathProcessorBrush pOther  )  [virtual]
 

Equality operator.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Parameters:
pOther - The other PathProcessorBrush [INPUTS]
Returns:
TRUE if they're considered different, FALSE if they are equivalent
Notes: The base class implementation compares the runtime classes of the 2 objects to see if they are different classes. If they are the same class, it assumes they're cnsidered equal - derived classes should override this behaviour if further comparisons are necessary.

Definition at line 3103 of file ppbrush.cpp.

03104 {
03105     ERROR3IF(pOther == NULL, "Illegal NULL param");
03106 
03107     if (GetRuntimeClass() != pOther->GetRuntimeClass())
03108         return(TRUE);
03109 
03110     // compare all the members
03111     if ( 
03112            (m_BrushHandle           != pOther->GetBrushDefinitionHandle())
03113         || (m_BrushSpacing          != pOther->GetSpacing())
03114         || (m_BrushSpacingIncrConst != pOther->GetSpacingIncrConst())
03115         || (m_BrushSpacingIncrProp  != pOther->GetSpacingIncrProp())
03116         || (m_BrushSpacingMaxRand   != pOther->GetSpacingMaxRand())
03117         || (m_BrushSpacingRandSeed  != pOther->GetSpacingRandSeed())
03118         || (m_BrushScaling          != pOther->GetBrushScaling())
03119         || (m_BrushScalingIncr      != pOther->GetBrushScalingIncr())
03120         || (m_BrushScalingIncrConst != pOther->GetBrushScalingIncrConst())
03121         || (m_BrushScalingMaxRand   != pOther->GetScalingMaxRand())
03122         || (m_BrushScalingRandSeed  != pOther->GetScalingRandSeed())
03123         || (m_RotateAngle           != pOther->GetRotationAngle())
03124         || (m_RotAngleIncrConst     != pOther->GetRotationIncrConst())
03125         || (m_RotationMaxRand       != pOther->GetRotationMaxRand())
03126         || (m_RotationRandSeed      != pOther->GetRotationRandSeed())
03127         || (m_bTile                 != pOther->IsTiled())
03128         || (m_bRotate               != pOther->IsRotated())
03129         || (m_PathOffsetType        != pOther->GetPathOffsetType())
03130         || (m_PathOffsetValue       != pOther->GetPathOffsetValue())
03131         || (m_PathOffsetIncrConst   != pOther->GetPathOffsetIncrConst())
03132         || (m_PathOffsetIncrProp    != pOther->GetPathOffsetIncrProp())
03133         || (m_OffsetValueMaxRand    != pOther->GetOffsetValueMaxRand())
03134         || (m_OffsetValueRandSeed   != pOther->GetOffsetValueRandSeed())
03135         || (m_OffsetTypeRandSeed    != pOther->GetOffsetTypeRandSeed())
03136         || (m_SequenceType          != pOther->GetSequenceType())
03137         || (m_SequenceRandSeed      != pOther->GetSequenceSeed())
03138         || (m_bUseLocalFillColour   != pOther->GetUseLocalFillColour())
03139         || (m_bUseLocalTransp       != pOther->GetUseLocalTransp())
03140         || (m_bUseNamedColours      != pOther->GetUseNamedColours())
03141         )
03142         return TRUE;
03143     
03144     // must be the same
03145     return(FALSE);
03146 }

BOOL PathProcessorBrush::IsRotated  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
[INPUTS] 
Returns:
whether or not the brush objects are rotated
See also:
-

Definition at line 4795 of file ppbrush.cpp.

04796 {
04797     return m_bRotate;
04798 }

BOOL PathProcessorBrush::IsScalingToLineWidth  )  [inline]
 

Definition at line 299 of file ppbrush.h.

00299 { return m_bScaleToLineWidth;}

BOOL PathProcessorBrush::IsThisPathProcessorOnTheStack RenderRegion pRender  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
pRender - the render region containing the path processor stack [INPUTS] Returns TRUE, if another path processor referring to the same brush definition as this one is present on the stack, FALSE if not
See also:
-

Definition at line 7072 of file ppbrush.cpp.

07073 {
07074     if (pRender == NULL)
07075     {
07076         ERROR3("Render Region is NULL in PathProcessorBrush::IsThisPathProcessorOnTheStack");
07077         return TRUE;  // for safety, as returning TRUE means we will probably not regenerate the brush
07078     }
07079 
07080     BOOL Retval = FALSE;
07081     PathProcessor* pPathProc = pRender->GetFirstPathProcessor();
07082 
07083     while (pPathProc != NULL)
07084     {
07085         // is it a brush?
07086         if (pPathProc->IsAPathProcessorBrush())
07087         {
07088             // is it our brush?
07089             if (((PathProcessorBrush*)pPathProc)->GetBrushDefinitionHandle() == m_BrushHandle)
07090             {
07091                 if (pPathProc != this)
07092                 {
07093                     Retval = TRUE;
07094                     break;
07095                 }
07096             }
07097         }
07098         pPathProc = pPathProc->GetNextProcessor();
07099     }
07100 
07101     return Retval;
07102 }

BOOL PathProcessorBrush::IsTiled  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/99
Parameters:
[INPUTS] 
Returns:
whether or not the brush tiles
See also:
-

Definition at line 4523 of file ppbrush.cpp.

04524 {
04525     return m_bTile;
04526 }

virtual BOOL PathProcessorBrush::NeedsTransparency void   )  const [inline, virtual]
 

Reimplemented from PathProcessor.

Definition at line 178 of file ppbrush.h.

00178 {return FALSE;};

BOOL PathProcessorBrush::ObjectIsWithinRect DocRect  Rect,
DocCoord  Centre,
MILLIPOINT  HalfWidth,
MILLIPOINT  HalfHeight,
double  Scaling,
double  Angle = 0
[protected]
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Parameters:
Rect - rect to test against [INPUTS] Centre - the centre of the object to test HalfWidth - half the width of the object bounding rect HalfHeight - half the height; Scaling - the scaling Angle - the angle at which this object is rotated IN DEGREES
Returns:
TRUE, if any part of this object intersects the rect.

Definition at line 2226 of file ppbrush.cpp.

02228 {
02229     if (Rect.IsEmpty())
02230         return FALSE;
02231 
02232     // if we're scaling then adjust the object widths
02233     if (Scaling != 1.0)
02234     {
02235         if (Scaling <=0)
02236             return FALSE;
02237         HalfHeight = (MILLIPOINT)((double)HalfHeight * Scaling);
02238         HalfWidth = (MILLIPOINT)((double)HalfWidth * Scaling);
02239     }
02240     
02241     
02242     DocRect TestRect;
02243     TestRect.hi.x = Centre.x + HalfWidth;
02244     TestRect.lo.x = Centre.x - HalfWidth;
02245     TestRect.hi.y = Centre.y + HalfHeight;