#include <ppbrush.h>
Inheritance diagram for PathProcessorBrush:

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 PathProcessorBrush * | Clone (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 BrushDefinition * | GetOurBrushDefinition () |
| 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:
| |
| 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 | |
| AttrBrushType * | GetParentAttribute () |
| 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. | |
| CDistanceSampler * | 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. | |
| CDistanceSampler * | 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. | |
| CDistanceSampler * | 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. | |
| void | SwitchAlternateValue () |
| void | Reset () |
Sets the various members etc. to the values that they must hold at the beginning of any of the following:
| |
| 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:
| |
| 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 |
| AttrBrushType * | m_pParentAttr |
| PressureItem | m_CurrentPressure |
| DocRect | m_CachedRect |
| BOOL | m_bCalculateRect |
| BOOL | m_bValidPressure |
| AttrFlatTranspFill * | m_pDefaultTransp |
| MILLIPOINT | m_LastSpacingNoRandom |
| MILLIPOINT | m_LastOffsetNoRandom |
| double | m_LastScalingNoRandom |
| double | m_LastRotationNoRandom |
| double | m_MaxScaling |
| UINT32 | m_LastObject |
| MTRand * | m_pSpacingRNG |
| MTRand * | m_pScalingRNG |
| MTRand * | m_pOffsetTypeRNG |
| MTRand * | m_pOffsetValueRNG |
| MTRand * | m_pRotationRNG |
| MTRand * | m_pSaturationRNG |
| MTRand * | m_pHueRNG |
| MTRand * | m_pSequenceRNG |
Private Member Functions | |
| CC_DECLARE_DYNAMIC (PathProcessorBrush) | |
Definition at line 150 of file ppbrush.h.
|
|
|
Destructor - basically this just wipes the caches.
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 }
|
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||||||
|
To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.
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 }
|
|
||||||||||||||||||||||||
|
To determine where the next brush object should be drawn. The position from the line can be altered by the following factors;.
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 }
|
|
||||||||||||
|
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.
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 }
|
|
|
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.
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 }
|
|
|
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.
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 }
|
|
||||||||||||
|
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.
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 }
|
|
|
|
|
|
deletes the caches that we used to store rendering data
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 }
|
|
|
|
|
copies the info from the brushdata object to the processor
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 }
|
|
|
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.
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 }
|
|
||||||||||||||||
|
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.
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 }
|
|
|
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.
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 }
|
|
|
As above.
Definition at line 3263 of file ppbrush.cpp. 03264 { 03265 return m_BrushHandle; 03266 }
|
|
|
as above
Definition at line 4833 of file ppbrush.cpp. 04834 { 04835 return m_BrushScaling; 04836 }
|
|
|
as above
Definition at line 4890 of file ppbrush.cpp. 04891 { 04892 return m_BrushScalingIncr; 04893 }
|
|
|
as above
Definition at line 4938 of file ppbrush.cpp. 04939 { 04940 return m_BrushScalingIncrConst; 04941 }
|
|
|
as above
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 }
|
|
|
as above
Definition at line 5544 of file ppbrush.cpp. 05545 { 05546 return m_BrushTransparency; 05547 }
|
|
|
access fn.
Definition at line 2744 of file ppbrush.cpp. 02745 { 02746 return m_CachedRect; 02747 }
|
|
|
As above.
Definition at line 6771 of file ppbrush.cpp. 06772 { 06773 return m_CurrentPressure.m_Pressure; 06774 }
|
|
||||||||||||
|
Simply pass in the maximum effect that you allow and this returns the effect caused by the current pressure value.
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 }
|
|
|
Finds out at what we distance we place the ObjectNum'th object.
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 }
|
|
|
as above
Definition at line 5120 of file ppbrush.cpp. 05121 { 05122 return m_BrushHueIncrement; 05123 }
|
|
|
as above
Definition at line 5159 of file ppbrush.cpp. 05160 { 05161 return m_BrushHueMaxRand; 05162 }
|
|
|
as above
Definition at line 5199 of file ppbrush.cpp. 05200 { 05201 return m_BrushHueRandSeed; 05202 }
|
|
|
The last object member keeps track of which object to render next as we proceed along the path.
Definition at line 3573 of file ppbrush.cpp. 03574 { 03575 return m_LastObject; 03576 }
|
|
|
As above.
Definition at line 5081 of file ppbrush.cpp. 05082 { 05083 return m_LastScaling; 05084 }
|
|
|
As above.
Definition at line 4172 of file ppbrush.cpp. 04173 { 04174 return m_LastSpacing; 04175 }
|
|
|
Pretty much as above, but with the following notes: There are several different ways of applying a rotation angle to brush objects:.
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 }
|
|
|
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
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 }
|
|
||||||||||||
|
as above
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 }
|
|
|
as above
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 }
|
|
|
as above
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 }
|
|
|
as above, currently the only thing that affects transparency is pressure. Note that -1 indicates that we are not adjusting transparency
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 }
|
|
||||||||||||||||
|
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.
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 }
|
|
|
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
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 }
|
|
|
Pretty much as above, but with the following notes: There are several different ways of applying a rotation angle to brush objects:.
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 }
|
|
|
Returns the next spacing to use, this can be determined in several ways, as with the other object placement attributes.
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 }
|
|
|
Definition at line 6723 of file ppbrush.cpp. 06724 { 06725 return (double)m_BrushTransparency * 0.01; 06726 }
|
|
|
as above
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 }
|
|
|
To find out how many brush objects we will have in the distance given.
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 }
|
|
|
As above.
Definition at line 4451 of file ppbrush.cpp. 04452 { 04453 return m_OffsetTypeRandSeed; 04454 }
|
|
|
As above.
Definition at line 4362 of file ppbrush.cpp. 04363 { 04364 return m_OffsetValueMaxRand; 04365 }
|
|
|
As above.
Definition at line 4401 of file ppbrush.cpp. 04402 { 04403 return m_OffsetValueRandSeed; 04404 }
|
|
|
As above.
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 }
|
|
|
returns the attribute associated with this ppb
Definition at line 5888 of file ppbrush.cpp. 05889 { 05890 return m_pParentAttr; 05891 }
|
|
|
as above
Definition at line 4282 of file ppbrush.cpp. 04283 { 04284 return m_PathOffsetIncrConst; 04285 }
|
|
|
as above
Definition at line 4319 of file ppbrush.cpp. 04320 { 04321 return m_PathOffsetIncrProp; 04322 }
|
|
|
as above
Definition at line 4190 of file ppbrush.cpp. 04191 { 04192 return m_PathOffsetType; 04193 }
|
|
|
as above
Definition at line 4238 of file ppbrush.cpp. 04239 { 04240 return m_PathOffsetValue; 04241 }
|
|
||||||||||||||||||||
|
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.
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 }
|
|
||||||||||||
|
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.
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 }
|
|
||||||||||||
|
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.
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 }
|
|
|
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.
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 }
|
|
||||||||||||||||||||
|
To determine the upper and lower bounds of a random range.
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 }
|
|
|
as above
Definition at line 4570 of file ppbrush.cpp. 04571 { 04572 return m_RotateAngle; 04573 }
|
|
|
as above
Definition at line 4609 of file ppbrush.cpp. 04610 { 04611 return m_RotAngleIncrConst; 04612 }
|
|
|
as above
Definition at line 4648 of file ppbrush.cpp. 04649 { 04650 return m_RotAngleIncrProp; 04651 }
|
|
|
as above
Definition at line 4754 of file ppbrush.cpp. 04755 { 04756 return m_RotationMaxPressure; 04757 }
|
|
|
as above
Definition at line 4666 of file ppbrush.cpp. 04667 { 04668 return m_RotationMaxRand; 04669 }
|
|
||||||||||||||||||||
|
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.
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 }
|
|
|
as above
Definition at line 4705 of file ppbrush.cpp. 04706 { 04707 return m_RotationRandSeed; 04708 }
|
|
|
as above
Definition at line 5250 of file ppbrush.cpp. 05251 { 05252 return m_BrushSatIncrement; 05253 }
|
|
|
as above
Definition at line 5289 of file ppbrush.cpp. 05290 { 05291 return m_BrushSatMaxRand; 05292 }
|
|
|
as above
Definition at line 5329 of file ppbrush.cpp. 05330 { 05331 return m_BrushSatRandSeed; 05332 }
|
|
|
as above, but simply retuns the value
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 }
|
|
|
As above.
Definition at line 5064 of file ppbrush.cpp. 05065 { 05066 return m_ScalingMaxPressure; 05067 }
|
|
|
As above.
Definition at line 4979 of file ppbrush.cpp. 04980 { 04981 return m_BrushScalingMaxRand; 04982 }
|
|
|
As above.
Definition at line 5018 of file ppbrush.cpp. 05019 { 05020 return m_BrushScalingRandSeed; 05021 }
|
|
|
as above
Definition at line 5456 of file ppbrush.cpp. 05457 { 05458 return m_SequenceRandSeed; 05459 }
|
|
|
as above
Definition at line 5379 of file ppbrush.cpp. 05380 { 05381 return m_SequenceType; 05382 }
|
|
|
As above.
Definition at line 3949 of file ppbrush.cpp. 03950 { 03951 return m_BrushSpacing; 03952 }
|
|
||||||||||||||||||||
|
Retrieves the values for spacing, scaling and pressure, that are in effect at Distance along the path.
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 }
|
|
|
If we are Distance along our path then thif function finds out how far it would be to the next brush object.
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 }
|
|
|
As above.
Definition at line 4028 of file ppbrush.cpp. 04029 { 04030 return m_BrushSpacingIncrConst; 04031 }
|
|
|
As above.
Definition at line 3990 of file ppbrush.cpp. 03991 { 03992 return m_BrushSpacingIncrProp; 03993 }
|
|
|
As above.
Definition at line 4153 of file ppbrush.cpp. 04154 { 04155 return m_SpacingMaxPressure; 04156 }
|
|
|
As above.
Definition at line 4045 of file ppbrush.cpp. 04046 { 04047 return m_BrushSpacingMaxRand; 04048 }
|
|
|
As above.
Definition at line 4084 of file ppbrush.cpp. 04085 { 04086 return m_BrushSpacingRandSeed; 04087 }
|
|
|
Sets the extent to which pressure affects transparency.
Definition at line 5606 of file ppbrush.cpp. 05607 { 05608 return m_TranspMaxPressure; 05609 }
|
|
|
as above
Definition at line 5499 of file ppbrush.cpp. 05500 { 05501 return m_bUseLocalFillColour; 05502 }
|
|
|
as above
Definition at line 5624 of file ppbrush.cpp. 05625 { 05626 return m_bUseLocalTransp; 05627 }
|
|
|
as above
Definition at line 5663 of file ppbrush.cpp. 05664 { 05665 return m_bUseNamedColours; 05666 }
|
|
|
as above
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 }
|
|
|
Virtual identifier.
Reimplemented from PathProcessor. Definition at line 336 of file ppbrush.cpp. 00337 { 00338 return TRUE; 00339 }
|
|
|
Reimplemented in BlendedPathProcessorBrush. Definition at line 181 of file ppbrush.h. 00181 { return FALSE;}
|
|
|
Equality operator.
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 }
|
|
|
as above
Definition at line 4795 of file ppbrush.cpp. 04796 { 04797 return m_bRotate; 04798 }
|
|
|
Definition at line 299 of file ppbrush.h. 00299 { return m_bScaleToLineWidth;}
|
|
|
as above
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 }
|
|
|
as above
Definition at line 4523 of file ppbrush.cpp. 04524 { 04525 return m_bTile; 04526 }
|
|
|
Reimplemented from PathProcessor. Definition at line 178 of file ppbrush.h. 00178 {return FALSE;};
|
|
||||||||||||||||||||||||||||
|
as above
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; |