#include <brshattr.h>
Inheritance diagram for BrushAttrValue:

Public Member Functions | |
| BrushAttrValue () | |
| Default Constuctor for BrushAttrValue. | |
| BrushAttrValue (PathProcessorBrush *pPathProcessor) | |
| Default Constuctor for BrushAttrValue. | |
| ~BrushAttrValue () | |
| Destructor Deletes any attached PathProcessor (see the constructor). | |
| virtual void | Render (RenderRegion *pRegion, BOOL Temp=FALSE) |
| Sets the BrushAttrValue attribute for the given render region. | |
| virtual void | Restore (RenderRegion *pRegion, BOOL Temp) |
| Restores the BrushAttrValue attribute for the given render region. | |
| virtual void | GoingOutOfScope (RenderRegion *pRegion) |
| A sister function to Render(). | |
| virtual void | SimpleCopy (AttributeValue *pValue) |
| See AttributeValue::SimpleCopy. | |
| virtual NodeAttribute * | MakeNode () |
| Make a new attribute node for this type of attr value - see base class. | |
| virtual BOOL | IsDifferent (AttributeValue *pAttr) |
| Determines if this AttrValue is different from the given one. | |
| virtual BrushAttrValue & | operator= (BrushAttrValue &Attrib) |
| Assignment operator. | |
| virtual INT32 | operator== (const BrushAttrValue &Attrib) |
| Comparison operator. | |
| virtual BOOL | Blend (BlendAttrParam *pBlendParam) |
| Blends between two brush attributes. In fact at the moment it just blends between the parameters in the two path processors. At some point it should also blend between the ink objects and attributes. | |
| BOOL | DoBecomeA (BecomeA *pBecomeA, Node *pParent) |
| To convert our brush into its individual paths and attributes, works in a very similar way to the bounding box, by finding the paths of our parent node and asking our path processor to do the calculations. | |
| BOOL | EffectsParentBounds () |
| DocRect | GetAttrBoundingRect (NodeRenderableInk *pParent=NULL, CCAttrMap *pAttribMap=NULL) |
| Virtual function for determining the bounding rect of an attribute. It achieves this by giving a path to the path processor which tells it the bounding rect. | |
| void | SetCachedRect (DocRect Rect) |
| This is designed to be called by the path processor, which calculates the bounding rect of this attribute, arbitrarily setting bounding rects by other objects is not recommended. | |
| void | TransformCachedRect (TransformBase &Trans) |
| Because it takes such a long time to calculate the bounding rect of a brushed object we prefer to calculate it once and then simply transform it. | |
| void | SetPathProcessor (PathProcessorBrush *pNewProcessor) |
| To set the path processor used by this object. The processor is now "owned" by this attribute, and will be auto-deleted upon destruction. | |
| PathProcessorBrush * | GetPathProcessor (void) const |
| void | FlushCache () |
| clears out the cached points | |
| void | TransformCache (TransformBase &Trans) |
| transforms the cached path. Attempts to optimise straight transform case. | |
| void | SetCache (PointsMap *pMap) |
| sets the cache member variable | |
| PointsMap * | GetCache () |
| TimeStampList * | GetTimeStampList () |
| void | SetTimeStampList (TimeStampList *pList) |
| sets the timestamp cache member variable | |
| BOOL | IsTimeStamping () |
| as above | |
| void | SetTimeStampUpdateType (ListUpdateType Update) |
| These flags determine what will happen in the NodePathUpdate function which is called after the freehand/brush or bezier tool is used to edit a brushed nodepath. | |
| ListUpdateType | GetTimeStampUpdateType () |
| As above. | |
| void | CalculateProportionalDistances (MILLIPOINT PathLength) |
| Only use when we are utilising the path stamping cache. This fn. proceeds through the list and works out the proportional distance along the path for each object. See Also: TimeStampBrushPoint. | |
| void | TransformTimeStampList (TransformBase &Trans) |
| transforms all the points in the timestamping cache | |
| BOOL | DeleteTimeStampPoints (MILLIPOINT StartDistance, MILLIPOINT EndDistance, TimeStampList *pRemovedPoints=NULL) |
| removes points from the timestamping list between the provided distances | |
| BOOL | DeleteTimeStampPoints (MILLIPOINT StartDistance, UINT32 NumPoints, TimeStampList *pRemovedPoints=NULL) |
| removes points from the timestamping list between the provided distances | |
| BOOL | AddTimeStampPoints (TimeStampList *pNewPoints, MILLIPOINT StartDistance) |
| inserts the list of points after the distance given | |
| BOOL | RecalculateTimeStampList (Path *pPath) |
| If time stamped lists are edited they can get out of shape, call this function to make sure the list is all in order. Note that it can be a bit slow Extra note, depending on exactly how the path was edited our update method differs. RepositionPointsByProportion is used when the path was edited by no points were added or removed from the timestamping list. If points were added then the other method should be used. | |
| BOOL | RepositionPointsByProportion (Path *pPath) |
| This function moves all the points in the timestamping list to their proportional TimeStampList::iterator along pPath. | |
| BOOL | RepositionPointsByPosition (Path *pPath) |
| This function assumes that all the points in the timestamping list are in the path but that their distance and proportion information is incorrect. Therefore it runs through the list and finds the correct distance and proportion. This is useful for those times when the path editing functions conveniently decide to go and reverse the paths because they feel like it. | |
| TimeStampList * | CopyTimeStampList () |
| Copy our timestamping list. | |
| BOOL | WriteTimeStampList (BaseCamelotFilter *pFilter) |
| If this brush uses timestamping then this function writes the timestamped list to the filter provided. | |
| void | SetPresssureCache (CDistanceSampler *pPress) |
| sets the pressure array memeber variable | |
| CDistanceSampler * | GetPressureCache () |
| as above | |
| UINT32 | GetPressureValue (UINT32 Index) |
| as above | |
| BOOL | SetPressureValue (UINT32 Index, PressureItem Value) |
| as above | |
| void | CalculatePressureArrayProportions (MILLIPOINT PathLength) |
| Only use when we are utilising the path stamping cache. This fn. proceeds through the list and works out the proportional distance along the path for each object. See Also: TimeStampBrushPoint. | |
| void | PressureSpacingChange (MILLIPOINT OldSpacing, MILLIPOINT NewSpacing) |
| void | FlushPressureCache () |
| clears out and deletes the cache of pressure values | |
| INT32 | GetPressureListIndexAtDistance (MILLIPOINT Distance) |
| Finds the pressure list index corresponding to the brush object that would appear at Distance along the brushed path. Or rather asks the processor to do it. | |
| BOOL | DeletePressurePoints (MILLIPOINT StartDistance, MILLIPOINT EndDistance, SampleArray *pRemovedPoints=NULL) |
| removes points from the Pressure Sampler list between the provided distances | |
| BOOL | DeletePressurePoints (UINT32 StartIndex, size_t NumPoints, SampleArray *pRemovedPoints=NULL) |
| removes points from the Pressure Sampler between the provided distances | |
| BOOL | AddPressurePoints (CSampleData *pNewPoints, MILLIPOINT StartDistance) |
| inserts the list of points after the distance given | |
| BOOL | AddPressurePoints (CSampleData *pNewPoints, UINT32 StartIndex) |
| inserts the list of points after the index given | |
| void | SetPressureUpdateType (ListUpdateType Update) |
| These flags determine what will happen in the NodePathUpdate function which is called after the freehand/brush or bezier tool is used to edit a brushed nodepath. | |
| ListUpdateType | GetPressureUpdateType () |
| As above. | |
| CDistanceSampler * | CopyPressureCache () |
| To make a carbon copy of our pressure cache and all the items in it. To be used as part of the operator= sequence. | |
| BOOL | WritePressureData (BaseCamelotFilter *pFilter) |
| If this attribute contains pressure data then it will write out that data to the filter provided. | |
| void | ScaleToLineWidth (MILLIPOINT Width) |
| asks the processor to scale to this line width. Note that the relevant flag must also be set | |
| MILLIPOINT | GetDefaultLineWidth (BOOL IgnorePressure=FALSE) |
| as above | |
| BrushDefinition * | GetBrushDefinition (void) |
| as above | |
| BrushHandle | GetBrushHandle (void) |
| interface to the pathprocessor | |
Static Public Member Functions | |
| static BOOL | Init (void) |
| Registers a default attribute of this type with the attribute manager. | |
| static BOOL | RotateBounds (double Angle, DocRect *pBounds, DocCoord *pCentre=NULL) |
| The bounds are updated to contain the rotated version. | |
Protected Member Functions | |
| BOOL | RepositionPressureDataByPosition (Path *pPath) |
| void | InitialisePointsCache () |
| allocates the map to store cached points | |
| void | FlushTimeStampCache () |
| deletes the timestamp cache if we have one | |
| BOOL | RecalculateDistances (Path *pPath) |
| for a timestamped brush, this fn. goes along the path and recalculates the distances of the coordinates along the line. | |
| BOOL | RecalculateTangents (Path *pPath) |
| for a timestamped brush, this fn. goes along the path and recalculates the tangents of the coordinates along the line. | |
| BOOL | SortTimeStampingList () |
| The TimeStamping points lists can become rather disorderly if you edit them a lot. This function sorts them by order of distance using quicksort. Make sure you call RecalculateDistances() first. | |
| BOOL | GetRidOfCrapFromList (Path *pPath) |
| The TimeStamping points lists can become rather disorderly if you edit them a lot. My woefully inadequate undo/redo actions for editing them can still leave some rogue points hanging around. This function proceeds through the list removing any points that are not on the path. | |
Static Protected Member Functions | |
| static void | ShuffleArrayUp (PressureArray *pPressure, UINT32 StartIndex) |
| shuffles each element in the array up by one, assumes that there is already a spare element at the top of the array. | |
| static void | ShuffleArrayDown (PressureArray *pPressure, UINT32 StartIndex) |
| static UINT32 | BlendUINT32 (UINT32 First, UINT32 Second, double BlendRatio) |
| to blend between two numbers and return the result | |
| static INT32 | BlendINT32 (INT32 First, INT32 Second, double BlendRatio) |
| to blend between two numbers and return the result | |
| static double | BlendDouble (double First, double Second, double BlendRatio) |
| to blend between two numbers and return the result | |
Private Attributes | |
| PathProcessorBrush * | m_pProcessor |
| PointsMap * | m_pCachedPoints |
| TimeStampList * | m_pTimeStampList |
| PressureArray * | m_pPressureVals |
| CDistanceSampler * | m_pPressureSampler |
| DocRect | m_CachedBRect |
| ListUpdateType | m_TimeStampUpdateType |
| ListUpdateType | m_PressureUpdateType |
Definition at line 136 of file brshattr.h.
|
|
Default Constuctor for BrushAttrValue.
Definition at line 166 of file brshattr.cpp. 00167 { 00168 #ifdef NEWFASTBRUSHES 00169 pCachedBitmap = NULL; 00170 #endif 00171 m_pProcessor = NULL; 00172 #ifdef BRUSHPOINTSCACHE 00173 m_pCachedPoints = NULL; 00174 #endif 00175 m_pTimeStampList = NULL; 00176 00177 m_pPressureVals = NULL; 00178 m_CachedBRect = DocRect(0,0,0,0); 00179 00180 m_pPressureSampler = NULL; 00181 }
|
|
|
Default Constuctor for BrushAttrValue.
Definition at line 203 of file brshattr.cpp. 00204 { 00205 #ifdef NEWFASTBRUSHES 00206 pCachedBitmap = NULL; 00207 #endif 00208 // Remember our processor, and let it know that we "own" it 00209 m_pProcessor = pPathProcessor; 00210 // if (m_pProcessor != NULL) 00211 // m_pProcessor->SetParentAttribute(this); 00212 #ifdef BRUSHPOINTSCACHE 00213 m_pCachedPoints = NULL; 00214 #endif 00215 m_pTimeStampList = NULL; 00216 00217 00218 m_pPressureVals = NULL; 00219 m_CachedBRect = DocRect(0,0,0,0); 00220 00221 m_pPressureSampler = NULL; 00222 }
|
|
|
Destructor Deletes any attached PathProcessor (see the constructor).
Definition at line 237 of file brshattr.cpp. 00238 { 00239 #ifdef NEWFASTBRUSHES 00240 if (pCachedBitmap != NULL) 00241 { 00242 delete (pCachedBitmap->GetBitmap ()); 00243 delete (pCachedBitmap); 00244 pCachedBitmap = NULL; 00245 } 00246 #endif 00247 if (m_pProcessor != NULL) 00248 { 00249 delete m_pProcessor; 00250 m_pProcessor = NULL; 00251 } 00252 FlushCache(); 00253 FlushTimeStampCache(); 00254 FlushPressureCache(); 00255 00256 }
|
|
||||||||||||
|
inserts the list of points after the index given
Definition at line 1200 of file brshattr.cpp. 01201 { 01202 if (pNewPoints == NULL) 01203 { 01204 ERROR3("Invalid inputs to BrushAttrValue::AddPressurePoints"); 01205 return FALSE; 01206 } 01207 01208 if (m_pPressureSampler == NULL) 01209 return FALSE; 01210 01211 if (StartIndex > m_pPressureSampler->GetNumItems()) 01212 { 01213 ERROR3("Attempting to insert over the end of the array in BrushAttrValue::AddPressurePoints"); 01214 return FALSE; 01215 } 01216 01217 return m_pPressureSampler->InsertNewData(StartIndex, pNewPoints); 01218 }
|
|
||||||||||||
|
inserts the list of points after the distance given
Definition at line 1160 of file brshattr.cpp. 01161 { 01162 // couple of checks 01163 if (pNewPoints == NULL) 01164 { 01165 ERROR3("Invalid inputs to BrushAttrValue::AddPressurePoints"); 01166 return FALSE; 01167 } 01168 01169 if (m_pPressureSampler == NULL) 01170 return FALSE; 01171 01172 // find out where we're inserting 01173 INT32 StartIndex = m_pPressureSampler->GetInternalIndexFromDistance(StartDistance); 01174 if (StartIndex == -1) 01175 { 01176 ERROR3("Attempting to insert over the end of the array in BrushAttrValue::AddPressurePoints"); 01177 return FALSE; 01178 } 01179 01180 // ask the sampler to insert for us 01181 return m_pPressureSampler->InsertNewData((UINT32)StartIndex, pNewPoints); 01182 }
|
|
||||||||||||
|
inserts the list of points after the distance given
Definition at line 1606 of file brshattr.cpp. 01607 { 01608 if (pNewPoints == NULL) 01609 { 01610 ERROR3("Invalid inputs to BrushAttrValue::DeleteTimeStampingPoints"); 01611 return FALSE; 01612 } 01613 01614 if (m_pTimeStampList == NULL) 01615 return FALSE; 01616 01617 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01618 TimeStampList::iterator LastPos = ListPos; 01619 01620 TimeStampBrushPoint TSBP; 01621 TimeStampBrushPoint NewPoint; 01622 MILLIPOINT Distance; 01623 01624 TRACEUSER("Diccon", _T("Num points pre-add = %d\n"), m_pTimeStampList->size()); 01625 01626 // first find the TimeStampList::iterator at which we want to insert the new points 01627 if (StartDistance > 0) 01628 { 01629 while( ListPos != m_pTimeStampList->end() ) 01630 { 01631 LastPos = ListPos; 01632 TSBP = *ListPos; ++ListPos; 01633 Distance = TSBP.m_Distance; 01634 if (Distance > StartDistance) 01635 break; 01636 01637 } 01638 } 01639 else 01640 LastPos = m_pTimeStampList->begin(); 01641 01642 TimeStampList::iterator NewListPos = pNewPoints->begin(); 01643 01644 while( NewListPos != m_pTimeStampList->end() ) 01645 { 01646 // get the point from the new list 01647 NewPoint = *NewListPos; ++NewListPos; 01648 01649 // insert it into the old list, recall that LastPos stores the element just before 01650 // StartDistance was exceeded 01651 if (StartDistance > 0) 01652 { 01653 m_pTimeStampList->insert( LastPos, NewPoint ); 01654 // increment our list position 01655 ++LastPos; 01656 } 01657 else 01658 m_pTimeStampList->push_front( NewPoint ); 01659 } 01660 01661 TRACEUSER("Diccon", _T("Ended with %d points\n"), m_pTimeStampList->size()); 01662 01663 return TRUE; 01664 }
|
|
|
Blends between two brush attributes. In fact at the moment it just blends between the parameters in the two path processors. At some point it should also blend between the ink objects and attributes.
Reimplemented from AttributeValue. Definition at line 450 of file brshattr.cpp. 00451 { 00452 ERROR2IF(pBlendParam == NULL, FALSE, "BlendAttrParam is NULL in BrushAttrValue::Blend"); 00453 00454 // First get the fill that we are blending to 00455 BrushAttrValue* pOtherBrush = 00456 (BrushAttrValue*)pBlendParam->GetOtherAttrVal(); 00457 if (pOtherBrush == NULL) 00458 return FALSE; 00459 00460 // it is ok if we have null path processors as that merely indicates a default line 00461 PathProcessorBrush* pOtherPPB = pOtherBrush->GetPathProcessor(); 00462 PathProcessorBrush* pThisPPB = GetPathProcessor(); 00463 00464 // Now make a new object of the same type as this one 00465 //CCRuntimeClass* ObjectType = GetRuntimeClass(); 00466 BrushAttrValue* pNewAttr = new BrushAttrValue; //(BrushAttrValue*)ObjectType->CreateObject(); 00467 00468 if (pNewAttr == NULL) 00469 { 00470 // Fail if we couldn't create the new fill 00471 pBlendParam->SetBlendedAttrVal(NULL); 00472 return FALSE; 00473 } 00474 00475 // Make the new fill an exact copy of this one 00476 pNewAttr->SimpleCopy(this); 00477 00478 // make a new path processor 00479 PathProcessorBrush* pBlendedPPB = new PathProcessorBrush; 00480 00481 if (pBlendedPPB == NULL) 00482 { 00483 delete pNewAttr; 00484 return FALSE; 00485 } 00486 00487 pBlendedPPB->SetBrushDefinition(BrushHandle_NoBrush); 00488 00489 // find out what point along the blend we are at 00490 double BlendRatio = pBlendParam->GetBlendRatio(); 00491 00492 // we need to ask the brush component to make a blended brush definition for us 00493 Document* pDoc = Document::GetCurrent(); 00494 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 00495 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 00496 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 00497 00498 // don't want to blend the variables any more, lets just copy them 00499 BrushDefinition* pThisDef = GetBrushDefinition(); 00500 BrushDefinition* pOtherDef = pOtherBrush->GetBrushDefinition(); 00501 BrushHandle ThisHandle = BrushHandle_NoBrush; 00502 BrushHandle OtherHandle = BrushHandle_NoBrush; 00503 00504 if (pThisPPB != NULL) 00505 ThisHandle = pThisPPB->GetBrushDefinitionHandle(); 00506 00507 if (pOtherPPB != NULL) 00508 OtherHandle = pOtherPPB->GetBrushDefinitionHandle(); 00509 00510 if (BlendRatio <= 0.5) 00511 { 00512 { 00513 if (pThisDef != NULL) 00514 { 00515 // if we have a ppb then copy the data across 00516 if (pThisPPB != NULL) 00517 { 00518 BrushData ThisData; 00519 pThisPPB->CopyBrushData(&ThisData); 00520 pBlendedPPB->CopyDataFromObject(&ThisData); 00521 } 00522 else // otherwise go with the definition 00523 pThisDef->CopyDataToProcessor(pBlendedPPB); 00524 00525 pBlendedPPB->SetBrushDefinition(GetBrushHandle()); 00526 pBlendedPPB->SetMaxScaling(pThisDef->GetMaxScaling()); 00527 } 00528 else 00529 { 00530 // turns out we're not really a brush so delete our processor 00531 delete pBlendedPPB; 00532 pBlendedPPB = NULL; 00533 } 00534 } 00535 } 00536 else 00537 { 00538 /* if (ThisHandle == OtherHandle) 00539 { 00540 if (pOtherPPB != NULL) 00541 { 00542 delete pBlendedPPB; 00543 pBlendedPPB = pOtherPPB->Clone(); 00544 } 00545 //pBlendedPPB->SetBrushDefinition(BrushHandle_NoBrush); 00546 } 00547 else */ 00548 { 00549 if (pOtherDef != NULL) 00550 { 00551 if (pOtherPPB != NULL) 00552 { 00553 BrushData OtherData; 00554 pOtherPPB->CopyBrushData(&OtherData); 00555 pBlendedPPB->CopyDataFromObject(&OtherData); 00556 00557 // little hack that we need to ensure the scaling is correct 00558 AttrBrushType* pAttrBrush = pOtherPPB->GetParentAttribute(); 00559 if (pAttrBrush != NULL) 00560 { 00561 MILLIPOINT LineWidth = pAttrBrush->GetAppliedLineWidth(); 00562 pOtherPPB->ScaleToValue(LineWidth); 00563 } 00564 00565 } 00566 else 00567 pOtherDef->CopyDataToProcessor(pBlendedPPB); 00568 pBlendedPPB->SetMaxScaling(pOtherDef->GetMaxScaling()); 00569 } 00570 else 00571 { 00572 // special case to deal with blend between a brushed and non=brushed object 00573 delete pBlendedPPB; 00574 pBlendedPPB = NULL; 00575 pNewAttr->SetPathProcessor(NULL); 00576 pBlendParam->SetBlendedAttrVal(pNewAttr); 00577 return TRUE; 00578 } 00579 pBlendedPPB->SetBrushDefinition(pOtherBrush->GetBrushHandle()); 00580 } 00581 } 00582 00583 // trudge through all the variables and blend them 00584 /* 00585 // blend scaling variables 00586 double BlendedScaling = BlendDouble(m_pProcessor->GetBrushScaling(), pOtherPPB->GetBrushScaling(), BlendRatio); 00587 pBlendedPPB->SetBrushScaling(BlendedScaling); 00588 double BlendedScalingIncr = BlendDouble(m_pProcessor->GetBrushScalingIncr(), pOtherPPB->GetBrushScalingIncr(), BlendRatio); 00589 pBlendedPPB->SetBrushScalingIncr(BlendedScalingIncr); 00590 00591 // blend spacing variables 00592 MILLIPOINT BlendedSpacing = BlendINT32(m_pProcessor->GetSpacing(), pOtherPPB->GetSpacing(), BlendRatio); 00593 pBlendedPPB->SetSpacing(BlendedSpacing); 00594 MILLIPOINT BlendedSpacingIncrConst = BlendINT32(m_pProcessor->GetSpacingIncrConst(), pOtherPPB->GetSpacingIncrConst(), BlendRatio); 00595 pBlendedPPB->SetSpacingIncrConst(BlendedSpacingIncrConst); 00596 double BlendedSpacingIncrProp = BlendDouble(m_pProcessor->GetSpacingIncrProp(), pOtherPPB->GetSpacingIncrProp(), BlendRatio); 00597 pBlendedPPB->SetSpacingIncrProp(BlendedSpacingIncrProp); 00598 UINT32 BlendedSpacingMaxRand = BlendUINT32(m_pProcessor->GetSpacingMaxRand(), pOtherPPB->GetSpacingMaxRand(), BlendRatio); 00599 pBlendedPPB->SetSpacingMaxRand(BlendedSpacingMaxRand); 00600 00601 // for the random seed don't blend, just use one or the other 00602 if (BlendRatio <= 0.5) 00603 pBlendedPPB->SetSpacingRandSeed(m_pProcessor->GetSpacingRandSeed()); 00604 else 00605 pBlendedPPB->SetSpacingRandSeed(pOtherPPB->GetSpacingRandSeed()); 00606 00607 // Offset variables 00608 MILLIPOINT BlendedOffsetValue = BlendINT32(m_pProcessor->GetPathOffsetValue(), pOtherPPB->GetPathOffsetValue(), BlendRatio); 00609 pBlendedPPB->SetPathOffsetValue(BlendedOffsetValue); 00610 MILLIPOINT BlendedOffsetIncrConst = BlendINT32(m_pProcessor->GetPathOffsetIncrConst(), pOtherPPB->GetPathOffsetIncrConst(), BlendRatio); 00611 pBlendedPPB->SetPathOffsetIncrConst(BlendedOffsetIncrConst); 00612 double BlendedOffsetIncrProp = BlendDouble(m_pProcessor->GetPathOffsetIncrProp(), pOtherPPB->GetPathOffsetIncrProp(), BlendRatio); 00613 pBlendedPPB->SetPathOffsetIncrProp(BlendedOffsetIncrProp); 00614 UINT32 BlendedOffsetMaxRand = BlendUINT32(m_pProcessor->GetOffsetValueMaxRand(), pOtherPPB->GetOffsetValueMaxRand(), BlendRatio); 00615 pBlendedPPB->SetOffsetValueMaxRand(BlendedOffsetMaxRand); 00616 00617 // don't blend offset type, just use one or the other, likewise random seed 00618 if (BlendRatio <= 0.5) 00619 { 00620 pBlendedPPB->SetPathOffsetType(m_pProcessor->GetPathOffsetType()); 00621 pBlendedPPB->SetOffsetTypeRandSeed(m_pProcessor->GetOffsetTypeRandSeed()); 00622 pBlendedPPB->SetOffsetValueRandSeed(m_pProcessor->GetOffsetValueRandSeed()); 00623 } 00624 else 00625 { 00626 pBlendedPPB->SetPathOffsetType(pOtherPPB->GetPathOffsetType()); 00627 pBlendedPPB->SetOffsetTypeRandSeed(pOtherPPB->GetOffsetTypeRandSeed()); 00628 pBlendedPPB->SetOffsetValueRandSeed(pOtherPPB->GetOffsetValueRandSeed()); 00629 } 00630 00631 // rotation 00632 double BlendedRotateAngle = BlendDouble(m_pProcessor->GetRotationAngle(), pOtherPPB->GetRotationAngle(), BlendRatio); 00633 pBlendedPPB->SetRotationAngle(BlendedRotateAngle); 00634 00635 // do all the flags at once 00636 if (BlendRatio <= 0.5) 00637 { 00638 pBlendedPPB->SetRotated(m_pProcessor->IsRotated()); 00639 pBlendedPPB->SetTiling(m_pProcessor->IsTiled()); 00640 pBlendedPPB->SetUseLocalFillColour(m_pProcessor->GetUseLocalFillColour()); 00641 pBlendedPPB->SetScaleToLineWidth(m_pProcessor->IsScalingToLineWidth()); 00642 pBlendedPPB->SetBrushDefinition(m_pProcessor->GetBrushDefinitionHandle()); 00643 } 00644 else 00645 { 00646 pBlendedPPB->SetRotated(pOtherPPB->IsRotated()); 00647 pBlendedPPB->SetTiling(pOtherPPB->IsTiled()); 00648 pBlendedPPB->SetUseLocalFillColour(pOtherPPB->GetUseLocalFillColour()); 00649 pBlendedPPB->SetScaleToLineWidth(pOtherPPB->IsScalingToLineWidth()); 00650 pBlendedPPB->SetBrushDefinition(pOtherPPB->GetBrushDefinitionHandle()); 00651 } 00652 */ 00653 // whew, think thats the lot, now attach the processor to the new attribute 00654 pNewAttr->SetPathProcessor(pBlendedPPB); 00655 00656 // and attach the attribute to the blend param 00657 pBlendParam->SetBlendedAttrVal(pNewAttr); 00658 00659 return TRUE; 00660 }
|
|
||||||||||||||||
|
to blend between two numbers and return the result
Definition at line 786 of file brshattr.cpp. 00787 { 00788 double InvRatio = 1 - BlendRatio; 00789 double BlendedVal = ((double)First * InvRatio) + ((double)Second*BlendRatio); 00790 00791 return BlendedVal; 00792 00793 }
|
|
||||||||||||||||
|
to blend between two numbers and return the result
Definition at line 761 of file brshattr.cpp. 00762 { 00763 double InvRatio = 1 - BlendRatio; 00764 double BlendedVal = ((double)First * InvRatio) + ((double)Second*BlendRatio); 00765 00766 return (INT32)BlendedVal; 00767 00768 }
|
|
||||||||||||||||
|
to blend between two numbers and return the result
Definition at line 737 of file brshattr.cpp. 00738 { 00739 double InvRatio = 1 - BlendRatio; 00740 double BlendedVal = ((double)First * InvRatio) + ((double)Second*BlendRatio); 00741 00742 return (UINT32)BlendedVal; 00743 }
|
|
|
Only use when we are utilising the path stamping cache. This fn. proceeds through the list and works out the proportional distance along the path for each object. See Also: TimeStampBrushPoint.
Definition at line 1028 of file brshattr.cpp. 01029 { 01030 if (m_pPressureVals == NULL || PathLength <= 0) 01031 { 01032 ERROR3("Error in calculating proportional distance"); 01033 return; 01034 } 01035 PressureItem Item; 01036 for (size_t i = 0; i < m_pPressureVals->size(); i++) 01037 { 01038 Item = (*m_pPressureVals)[i]; 01039 if (Item.m_Distance > PathLength) 01040 ERROR3("Item distance is greater than path length in BrushAttrValue::CalculatePressureArrayProportions"); 01041 Item.m_Proportion = Item.m_Distance / (double) PathLength; 01042 (*m_pPressureVals)[i] = Item; 01043 } 01044 }
|
|
|
Only use when we are utilising the path stamping cache. This fn. proceeds through the list and works out the proportional distance along the path for each object. See Also: TimeStampBrushPoint.
Definition at line 1383 of file brshattr.cpp. 01384 { 01385 if (m_pTimeStampList == NULL || PathLength <= 0) 01386 { 01387 ERROR3("Error in calculating proportional distance"); 01388 return; 01389 } 01390 01391 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01392 TimeStampList::iterator LastPos = ListPos; 01393 TimeStampBrushPoint TSBP; 01394 while( ListPos != m_pTimeStampList->end() ) 01395 { 01396 LastPos = ListPos; 01397 TSBP = *ListPos; ++ListPos; 01398 TSBP.WorkOutProportion( PathLength ); 01399 *LastPos = TSBP; 01400 } 01401 }
|
|
|
To make a carbon copy of our pressure cache and all the items in it. To be used as part of the operator= sequence.
Definition at line 1283 of file brshattr.cpp. 01284 { 01285 if (m_pPressureSampler == NULL) 01286 return NULL; 01287 01288 return m_pPressureSampler->MakeCopy(); 01289 }
|
|
|
Copy our timestamping list.
Definition at line 2081 of file brshattr.cpp. 02082 { 02083 if (m_pTimeStampList == NULL) 02084 return NULL; 02085 // allocate a new list of our own 02086 TimeStampList* pCopyList = new TimeStampList; 02087 if (pCopyList != NULL) 02088 { 02089 TimeStampBrushPoint TBSP; 02090 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 02091 // copy the points 02092 while( ListPos != m_pTimeStampList->end() ) 02093 { 02094 TBSP = *ListPos; ++ListPos; 02095 pCopyList->push_back(TBSP); 02096 } 02097 } 02098 return pCopyList; 02099 }
|
|
||||||||||||||||
|
removes points from the Pressure Sampler between the provided distances
Definition at line 1110 of file brshattr.cpp. 01112 { 01113 if (NumPoints < 1) 01114 { 01115 TRACEUSER( "Diccon", _T("Num points = %d in DeletePressurePoints\n"), NumPoints); 01116 return FALSE; 01117 } 01118 01119 if (m_pPressureSampler == NULL) 01120 return FALSE; 01121 01122 UINT32 EndIndex = StartIndex + NumPoints; 01123 01124 // check that this doesn't overrun the array 01125 if (EndIndex > m_pPressureSampler->GetNumItems()) 01126 { 01127 ERROR3("Attempting to remove over the end of the array"); 01128 return FALSE; 01129 } 01130 01131 // set the size of the sample array 01132 if (pRemovedPoints != NULL) 01133 pRemovedPoints->resize( NumPoints ); 01134 01135 // set the retrieval rate 01136 m_pPressureSampler->SetRetrievalSampleRate(1.0); 01137 01138 // ask the sampler to do its thing 01139 return m_pPressureSampler->RemoveData(StartIndex, EndIndex, pRemovedPoints); 01140 01141 }
|
|
||||||||||||||||
|
removes points from the Pressure Sampler list between the provided distances
Definition at line 1061 of file brshattr.cpp. 01063 { 01064 if (StartDistance <0 || EndDistance < 0 || EndDistance <= StartDistance) 01065 { 01066 ERROR3("Invalid inputs to BrushAttrValue::DeletePressureingPoints"); 01067 return FALSE; 01068 } 01069 01070 if (m_pPressureSampler == NULL) 01071 return FALSE; 01072 01073 // find out what indexes correspond to our distances 01074 INT32 StartIndex = m_pPressureSampler->GetInternalIndexFromDistance(StartDistance); 01075 INT32 EndIndex = m_pPressureSampler->GetInternalIndexFromDistance(EndDistance); 01076 01077 if (StartIndex == -1 || EndIndex == -1) 01078 { 01079 ERROR3("Attempting to remove from over the end of the array"); 01080 return FALSE; 01081 } 01082 INT32 NumPoints = EndIndex - StartIndex; 01083 if (NumPoints == 0) 01084 return TRUE; // ours not to reason why... 01085 01086 // set the size of the sample array 01087 if (pRemovedPoints != NULL) 01088 pRemovedPoints->resize( NumPoints ); 01089 01090 // ask the sampler to do its thing 01091 return m_pPressureSampler->RemoveData(StartIndex, EndIndex, pRemovedPoints); 01092 }
|
|
||||||||||||||||
|
removes points from the timestamping list between the provided distances
Definition at line 1535 of file brshattr.cpp. 01537 { 01538 if (StartDistance <0 || NumPoints < 1) 01539 { 01540 ERROR3("Invalid inputs to BrushAttrValue::DeleteTimeStampingPoints"); 01541 return FALSE; 01542 } 01543 01544 if (m_pTimeStampList == NULL) 01545 return FALSE; 01546 01547 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01548 TimeStampList::iterator LastPos = ListPos; 01549 TimeStampBrushPoint TSBP; 01550 MILLIPOINT Distance = 0; 01551 UINT32 count = 0; 01552 NumPoints --; 01553 while( ListPos != m_pTimeStampList->end() ) 01554 { 01555 LastPos = ListPos; 01556 TSBP = *ListPos; ++ListPos; 01557 Distance = TSBP.m_Distance; 01558 count++; 01559 if (Distance >= StartDistance) 01560 { 01561 01562 TimeStampList::iterator RemPos = LastPos; 01563 while( NumPoints && LastPos != m_pTimeStampList->end() ) 01564 { 01565 TRACEUSER("Diccon", _T("Removing point %d\n"), count); 01566 if (count == m_pTimeStampList->size()) 01567 { 01568 //INT32 i = 1; // why is this here AMB 2006-01-31 01569 } 01570 // if we're sending the removed points back, add this one to the list 01571 if (pRemovedPoints != NULL) 01572 pRemovedPoints->push_back(TSBP); 01573 RemPos = LastPos; 01574 TSBP = *LastPos; ++LastPos; 01575 TimeStampBrushPoint Test = *RemPos; 01576 // TRACEUSER("Diccon", _T("Removing point at %d\n"), Test.m_Distance); 01577 // remove it from the main list 01578 m_pTimeStampList->erase( RemPos ); 01579 NumPoints--; 01580 count++; 01581 } 01582 01583 } 01584 if (NumPoints <= 0 || LastPos == m_pTimeStampList->end()) 01585 break; 01586 } 01587 return TRUE; 01588 }
|
|
||||||||||||||||
|
removes points from the timestamping list between the provided distances
|