#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
Definition at line 1475 of file brshattr.cpp. 01477 { 01478 if (StartDistance <0 || EndDistance < 0 || EndDistance <= StartDistance) 01479 { 01480 ERROR3("Invalid inputs to BrushAttrValue::DeleteTimeStampingPoints"); 01481 return FALSE; 01482 } 01483 01484 if (m_pTimeStampList == NULL) 01485 return FALSE; 01486 01487 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01488 TimeStampList::iterator LastPos = ListPos; 01489 TimeStampBrushPoint TSBP; 01490 MILLIPOINT Distance = 0; 01491 INT32 count = 0; 01492 INT32 removecount = 0; 01493 TRACEUSER( "Diccon", _T("Deleting from %d, to %d\n"), StartDistance, EndDistance ); 01494 TRACEUSER( "Diccon", _T("Num points pre-remove = %d\n"), m_pTimeStampList->size() ); 01495 while( ListPos != m_pTimeStampList->end() ) 01496 { 01497 LastPos = ListPos; 01498 TSBP = *ListPos; ++ListPos; 01499 Distance = TSBP.m_Distance; 01500 //TRACEUSER("Diccon", _T("Count %d, Distance = %d\n"), count, Distance); 01501 if (Distance >= StartDistance && Distance <= EndDistance) 01502 { 01503 // if we're sending the removed points back, add this one to the list 01504 if (pRemovedPoints != NULL) 01505 pRemovedPoints->push_back( TSBP ); 01506 01507 // remove it from the main list 01508 m_pTimeStampList->erase( LastPos ); 01509 removecount++; 01510 TRACEUSER("Diccon", _T("Removing point %d\n"), count); 01511 } 01512 count++; 01513 } 01514 TRACEUSER("Diccon", _T("Removed %d points\n"), removecount); 01515 01516 return TRUE; 01517 }
|
|
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.
Definition at line 680 of file brshattr.cpp. 00681 { 00682 ERROR2IF(pBecomeA == NULL, FALSE, "BecomeA pointer is NULL in BrushAttrValue::DoBecomeA"); 00683 ERROR2IF(pParent == NULL, FALSE, "Parent node is NULL in BrushAttrValue::DoBecomeA"); 00684 00685 if (m_pProcessor == NULL) 00686 return FALSE; 00687 00688 BOOL Success = FALSE; 00689 // UINT32 Dummy = 0; 00690 // if we have a nodepath then we can simply use its member path, otherwise we 00691 // have to ask it to become a nodepath 00692 if (pParent->IsNodePath()) 00693 { 00694 // we have a special calculation for nodepaths, because we can use their path 00695 Success = m_pProcessor->DoBecomeA(pBecomeA, &((NodePath*)pParent)->InkPath, pParent); 00696 } 00697 else 00698 { 00699 BecomeA TestBecomeAPath(BECOMEA_TEST, CC_RUNTIME_CLASS(NodePath)); 00700 if (pParent->CanBecomeA(&TestBecomeAPath)) 00701 { 00702 // we must be applied to some arbitrary shape. The thing is that we need to have 00703 // a path to pass to the PPB, so want to get a passback of all the paths in 00704 // the node 00705 00706 // we need to allocate a path 00707 Path* pPath = new Path; 00708 if (pPath != NULL && pPath->Initialise()) 00709 { 00710 PathBecomeA BecomeAPath(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), NULL, FALSE, pPath); 00711 if (pParent->DoBecomeA(&BecomeAPath)) 00712 { 00713 Success = m_pProcessor->DoBecomeA(pBecomeA, pPath, pParent); 00714 } 00715 delete pPath; 00716 } 00717 } 00718 } 00719 return Success; 00720 }
|
|
|
|
clears out the cached points
Definition at line 2631 of file brshattr.cpp. 02632 { 02633 #ifdef BRUSHPOINTSCACHE 02634 if (m_pCachedPoints != NULL) 02635 { 02636 m_pCachedPoints->clear(); 02637 delete m_pCachedPoints; 02638 m_pCachedPoints = NULL; 02639 } 02640 02641 #endif 02642 02643 }
|
|
clears out and deletes the cache of pressure values
Definition at line 882 of file brshattr.cpp. 00883 { 00884 if (m_pPressureSampler != NULL) 00885 { 00886 delete m_pPressureSampler; 00887 m_pPressureSampler = NULL; 00888 } 00889 }
|
|
deletes the timestamp cache if we have one
Definition at line 1415 of file brshattr.cpp. 01416 { 01417 if (m_pTimeStampList != NULL) 01418 { 01419 m_pTimeStampList->clear(); 01420 delete m_pTimeStampList; 01421 m_pTimeStampList = NULL; 01422 } 01423 }
|
|
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.
Definition at line 2424 of file brshattr.cpp. 02425 { 02426 BrushDefinition* pBrushDef = GetBrushDefinition(); 02427 if (pBrushDef == NULL) 02428 return DocRect(0, 0, 0, 0); 02429 02430 // get the biggest BBox of the brush objects 02431 DocRect BRect = pBrushDef->GetLargestBoundingBox(); 02432 DocRect ReturnRect(0,0,0,0); 02433 02434 // if (!m_CachedBRect.IsEmpty()) 02435 // return m_CachedBRect; 02436 02437 02438 // get our path processor 02439 PathProcessorBrush* pPPB = GetPathProcessor(); 02440 if (pPPB == NULL) 02441 return DocRect(0,0,0,0); 02442 02443 if (m_pTimeStampList != NULL) 02444 { 02445 ReturnRect = pPPB->TimeStampBoundingBox(); 02446 m_CachedBRect = ReturnRect; 02447 return ReturnRect; 02448 } 02449 02450 if (pParent->IsNodePath()) 02451 { 02452 #ifdef NEWFASTBRUSHES 02453 if (pCachedBitmap) 02454 { 02455 ReturnRect = pCachedBitmap->GetBoundingRect (); 02456 } 02457 else 02458 { 02459 #endif 02460 // we have a special calculation for nodepaths, because we can use their path 02461 ReturnRect = pPPB->CalculateBoundingBox(&((NodePath*)pParent)->InkPath, pParent); 02462 #ifdef NEWFASTBRUSHES 02463 } 02464 #endif 02465 m_CachedBRect = ReturnRect; 02466 return ReturnRect; 02467 } 02468 02469 BecomeA TestBecomeAPath(BECOMEA_TEST, CC_RUNTIME_CLASS(NodePath)); 02470 if (pParent->CanBecomeA(&TestBecomeAPath)) 02471 { 02472 // we must be applied to some arbitrary shape. The thing is that we need to have 02473 // a path to pass to the PPB, so want to get a passback of all the paths in 02474 // the node 02475 02476 // we need to allocate a path 02477 Path* pPath = new Path; 02478 if (pPath != NULL && pPath->Initialise()) 02479 { 02480 PathBecomeA BecomeAPath(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), NULL, FALSE, pPath); 02481 if (pParent->DoBecomeA(&BecomeAPath)) 02482 { 02483 ReturnRect = pPPB->CalculateBoundingBox(pPath, pParent); 02484 } 02485 delete pPath; 02486 } 02487 m_CachedBRect = ReturnRect; 02488 return ReturnRect; 02489 } 02490 02491 if (pParent->IsATextChar()) 02492 { 02493 // text always has to be different doesn't it.. 02494 02495 // create a format region to keep an attribute stack 02496 FormatRegion FRegion; 02497 FormatRegion* pFormatRegion=&FRegion; 02498 02499 if (!pFormatRegion->Init(pParent)) 02500 { 02501 ERROR3("Failed to init format region"); 02502 return ReturnRect; 02503 } 02504 02505 pFormatRegion->SaveContext(); 02506 02507 NodePath* pNodePath = NULL; 02508 TextChar* pTextChar = (TextChar*)pParent; 02509 pTextChar->RenderChildAttrs(pFormatRegion); 02510 02511 // create a nodepath that we can use to give the the PPB 02512 if (pTextChar->CreateNodePath(&pNodePath, pFormatRegion)) 02513 { 02514 if (pNodePath != NULL) 02515 { 02516 ReturnRect = pPPB->CalculateBoundingBox(&(pNodePath->InkPath), pParent); 02517 delete pNodePath; 02518 } 02519 } 02520 pFormatRegion->RestoreContext(); 02521 02522 m_CachedBRect = ReturnRect; 02523 return ReturnRect; 02524 } 02525 02526 // Still nothing? Last resort time. 02527 if (ReturnRect.IsEmpty()) 02528 { 02529 ReturnRect = pParent->GetBoundingRect(TRUE); 02530 02531 double Scaling = 1.0; 02532 PathProcessorBrush* pPathProc = GetPathProcessor(); 02533 02534 if (pPathProc != NULL) 02535 Scaling = pPathProc->GetBrushScaling(); 02536 // hack it a bit just to make sure 02537 if (!ReturnRect.IsEmpty()) 02538 ReturnRect.Inflate((MILLIPOINT)((BRect.Width() / 2) * Scaling) , (MILLIPOINT)((BRect.Height() / 2) * Scaling)); 02539 02540 if (pPathProc->GetPathOffsetType() != OFFSET_NONE) 02541 ReturnRect.Inflate(pPathProc->GetPathOffsetValue(), pPathProc->GetPathOffsetValue()); 02542 } 02543 02544 m_CachedBRect = ReturnRect; 02545 return ReturnRect; 02546 }
|
|
as above
Definition at line 2315 of file brshattr.cpp. 02316 { 02317 if (m_pProcessor != NULL) 02318 { 02319 return m_pProcessor->GetOurBrushDefinition(); 02320 } 02321 return NULL; 02322 }
|
|
interface to the pathprocessor
Definition at line 2338 of file brshattr.cpp. 02339 { 02340 if (m_pProcessor == NULL) 02341 return BrushHandle_NoBrush; 02342 return m_pProcessor->GetBrushDefinitionHandle(); 02343 }
|
|
Definition at line 195 of file brshattr.h. 00195 {return m_pCachedPoints;}
|
|
as above
Definition at line 2610 of file brshattr.cpp. 02611 { 02612 if (m_pProcessor == NULL) 02613 return - 1; 02614 02615 return m_pProcessor->GetBrushSize(IgnorePressure); 02616 }
|
|
Definition at line 186 of file brshattr.h. 00186 { return(m_pProcessor); };
|
|
as above
Definition at line 902 of file brshattr.cpp. 00903 { 00904 return m_pPressureSampler; 00905 }
|
|
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.
Definition at line 1310 of file brshattr.cpp. 01311 { 01312 // some safety checks 01313 if (m_pPressureSampler == NULL) 01314 return -1; 01315 01316 if (Distance < 0 ) 01317 return -1; 01318 01319 if (m_pProcessor == NULL) 01320 return -1; 01321 01322 INT32 Index = m_pPressureSampler->GetInternalIndexFromDistance(Distance); 01323 01324 return Index; 01325 }
|
|
As above.
Definition at line 1261 of file brshattr.cpp. 01262 { 01263 return m_PressureUpdateType; 01264 }
|
|
as above
Definition at line 920 of file brshattr.cpp. 00921 { 00922 if (m_pPressureVals == NULL) 00923 return PRESSURE_INVALID; 00924 if (Index >= (UINT32)m_pPressureVals->size()) 00925 return PRESSURE_INVALID; 00926 00927 PressureItem Item = (*m_pPressureVals)[Index]; 00928 return Item.m_Pressure; 00929 }
|
|
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.
Definition at line 1923 of file brshattr.cpp. 01924 { 01925 if (m_pTimeStampList == NULL || pPath == NULL) 01926 return FALSE; 01927 01928 TimeStampBrushPoint Point; 01929 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01930 TimeStampList::iterator LastPos = ListPos; 01931 MILLIPOINT Distance; 01932 01933 while( ListPos != m_pTimeStampList->end() ) 01934 { 01935 LastPos = ListPos; 01936 Point = *ListPos; ++ListPos; 01937 if (!pPath->GetDistanceToPoint(Point.m_Point, &Distance)) 01938 { 01939 m_pTimeStampList->erase( LastPos ); 01940 TRACEUSER("Diccon", _T("Removing point at %d\n"), Point.m_Distance); 01941 } 01942 } 01943 return TRUE; 01944 }
|
|
Definition at line 198 of file brshattr.h. 00198 { return m_pTimeStampList;}
|
|
As above.
Definition at line 2746 of file brshattr.cpp. 02747 { 02748 return m_TimeStampUpdateType; 02749 }
|
|
A sister function to Render().
It gives the attribute a chance to remove any PathProcessor(s) it added to the RenderRegion when it was Render()ed. Notes: This attribute makes sure it removes any PathProcessor it added to handle path stroking in BrushAttrValue::Render
Reimplemented from AttributeValue. Definition at line 397 of file brshattr.cpp. 00398 { 00399 if (m_pProcessor != NULL) 00400 { 00401 //TRACEUSER("Diccon", _T("Popping path processor\n") ); 00402 pRegion->PopPathProcessor(); 00403 } 00404 }
|
|
Registers a default attribute of this type with the attribute manager.
Reimplemented from SimpleCCObject. Definition at line 273 of file brshattr.cpp. 00274 { 00275 // The default attribute is one that has no effect (i.e. produces old-style "lines") 00276 BrushAttrValue *pAttr = new BrushAttrValue; 00277 if (pAttr == NULL) 00278 return FALSE; 00279 00280 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(AttrBrushType), 00281 pAttr); 00282 00283 if (ID == ATTR_BAD_ID) 00284 return FALSE; 00285 ENSURE(ID == ATTR_BRUSHTYPE, "Incorrect ID for attribute!"); 00286 00287 //ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising BrushAttrValue"); 00288 //ENSURE(ID == ATTR_BRUSHTYPE, "Incorrect Attribute ID"); 00289 return(TRUE); 00290 }
|
|
allocates the map to store cached points
Definition at line 809 of file brshattr.cpp. 00810 { 00811 00812 #ifdef BRUSHPOINTSCACHE 00813 // get rid of the existing one (if there is one) 00814 FlushCache(); 00815 //allocate a new map 00816 m_pCachedPoints = new PointsMap; 00817 PORTNOTE("other","Not use hash based map, InitHashTable makes no sense") 00818 #ifndef EXCLUDE_FROM_XARALX 00819 if (m_pCachedPoints != NULL) 00820 m_pCachedPoints->InitHashTable(1277); // Init hash table size to a suitably large prime number 00821 #endif 00822 #endif 00823 00824 }
|
|
Determines if this AttrValue is different from the given one.
Reimplemented from AttributeValue. Definition at line 2148 of file brshattr.cpp. 02149 { 02150 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(BrushAttrValue)), 02151 "Different attribute types in BrushAttrValue::IsDifferent()"); 02152 02153 // Check they are NOT the same using the == operator 02154 return ( !(*((BrushAttrValue *)pAttr) == *this) ); 02155 }
|
|
as above
Definition at line 1363 of file brshattr.cpp. 01364 { 01365 return (m_pTimeStampList != NULL); 01366 }
|
|
Make a new attribute node for this type of attr value - see base class.
Reimplemented from AttributeValue. Definition at line 2116 of file brshattr.cpp. 02117 { 02118 // Create new attribute node 02119 AttrBrushType *pAttr = new AttrBrushType; 02120 if (pAttr == NULL) 02121 return NULL; 02122 02123 // Copy attribute value (if any) into the new node. 02124 if (pAttr->GetAttributeValue() != NULL) 02125 pAttr->GetAttributeValue()->SimpleCopy(this); 02126 02127 02128 return(pAttr); 02129 }
|
|
Assignment operator.
Definition at line 2172 of file brshattr.cpp. 02173 { 02174 // Get rid of our old processor (if any) 02175 if (m_pProcessor != NULL) 02176 delete m_pProcessor; 02177 m_pProcessor = NULL; 02178 02179 // Copy the other attr's processor. If this fails, we'll get back a NULL pointer, 02180 // and will simply "convert" into a simple no-stroke attribute. 02181 if (Attrib.m_pProcessor != NULL) 02182 m_pProcessor = Attrib.m_pProcessor->Clone(); 02183 02184 // if we're timestamping then we need to clone the list of points 02185 if (Attrib.IsTimeStamping()) 02186 m_pTimeStampList = CopyTimeStampList(); 02187 02188 // if we have pressure data then we need to copy that also 02189 m_pPressureSampler = Attrib.CopyPressureCache(); 02190 02191 return(*this); 02192 }
|
|
Comparison operator.
Definition at line 2211 of file brshattr.cpp. 02212 { 02213 ERROR3IF(!Attrib.IsKindOf(CC_RUNTIME_CLASS(BrushAttrValue)), 02214 "Other attribute value isn't an BrushAttrValue"); 02215 02216 BrushAttrValue *Other = (BrushAttrValue *) &Attrib; 02217 02218 // two attributes can never have the same timestamp or pressure caches 02219 // If that is the case then why is it checking the points cache and 02220 // not the pressure cache!?? I'm changing this to check the "correct" cache 02221 // Gerry (21/11/05) 02222 02223 // The points cache doesn't get copied in the = operator so don't check it 02224 // if (GetCache() != NULL && GetCache()->GetCount() != 0) 02225 // return(FALSE); 02226 // if (Other->GetCache() != NULL && Other->GetCache()->GetCount != 0) 02227 // return(FALSE); 02228 02229 if (GetPressureCache() != NULL && GetPressureCache()->GetCount() != 0) 02230 return(FALSE); 02231 if (Other->GetPressureCache() != NULL && Other->GetPressureCache()->GetCount() != 0) 02232 return(FALSE); 02233 02234 if (m_pTimeStampList != NULL && m_pTimeStampList->size() != 0) 02235 return FALSE; 02236 if (Other->GetTimeStampList() != NULL && Other->GetTimeStampList()->size() != 0) 02237 return FALSE; 02238 02239 // Equal if they both have same processor (only applies if they are both NULL) 02240 if (m_pProcessor == Other->GetPathProcessor()) 02241 return(TRUE); 02242 02243 // Otherwise, if one of them is NULL, they can't be the same 02244 if (m_pProcessor == NULL || Other->GetPathProcessor() == NULL) 02245 return(FALSE); 02246 02247 // Finally, ask the processors if they are of the same type 02248 return(!m_pProcessor->IsDifferent(Other->GetPathProcessor())); 02249 }
|
|
|
|
for a timestamped brush, this fn. goes along the path and recalculates the distances of the coordinates along the line.
Definition at line 1769 of file brshattr.cpp. 01770 { 01771 if (pPath == NULL || m_pTimeStampList == NULL) 01772 { 01773 ERROR3("Input pointers are NULL"); 01774 return FALSE; 01775 } 01776 01777 double PathLength = (MILLIPOINT)pPath->GetPathLength(); 01778 MILLIPOINT Distance; 01779 01780 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01781 TimeStampList::iterator LastPos; 01782 TimeStampBrushPoint TSBPoint; 01783 01784 while( ListPos != m_pTimeStampList->end() ) 01785 { 01786 LastPos = ListPos; 01787 TSBPoint = *ListPos; ++ListPos; 01788 // get the distance along the path 01789 if (pPath->GetDistanceToPoint(TSBPoint.m_Point, &Distance)) 01790 { 01791 TSBPoint.m_Distance = Distance; 01792 TSBPoint.m_Proportion = (double)TSBPoint.m_Distance / PathLength; 01793 // TRACEUSER("Diccon", _T("New Prop: %f\n"), TSBPoint.m_Proportion); 01794 *LastPos = TSBPoint; 01795 } 01796 else 01797 TRACEUSER("Diccon", _T("Point %d, %d, not found in line\n"), TSBPoint.m_Point.x, TSBPoint.m_Point.y); 01798 } 01799 01800 return TRUE; 01801 }
|
|
for a timestamped brush, this fn. goes along the path and recalculates the tangents of the coordinates along the line.
Definition at line 1819 of file brshattr.cpp. 01820 { 01821 if (pPath == NULL || m_pTimeStampList == NULL) 01822 { 01823 ERROR3("Input pointers are NULL"); 01824 return FALSE; 01825 } 01826 01827 // double PathLength = (MILLIPOINT)pPath->GetPathLength(); 01828 01829 double Tangent; 01830 DocCoord DummyCoord; 01831 01832 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01833 TimeStampBrushPoint TSBPoint; 01834 01835 while( ListPos != m_pTimeStampList->end() ) 01836 { 01837 TSBPoint = *ListPos; ++ ListPos; 01838 // we need to use GetPointAtDistance to retrieve the tangent 01839 if (pPath->GetPointAtDistance(TSBPoint.m_Distance, &DummyCoord, &Tangent)) 01840 TSBPoint.m_Tangent = Tangent; 01841 01842 } 01843 return TRUE; 01844 }
|
|
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.
Definition at line 1686 of file brshattr.cpp. 01687 { 01688 if (m_pTimeStampList == NULL) 01689 return TRUE; 01690 if (pPath == NULL) 01691 return FALSE; 01692 BOOL Retval = TRUE; 01693 switch (m_TimeStampUpdateType) 01694 { 01695 case UPDATE_NONE: 01696 break; 01697 case UPDATE_PROPORTION: 01698 if (!RepositionPointsByProportion(pPath)) 01699 Retval = FALSE; 01700 break; 01701 case UPDATE_LIST: 01702 if (!RecalculateDistances(pPath)) 01703 { 01704 Retval = FALSE; 01705 break; 01706 } 01707 if (!SortTimeStampingList()) 01708 { 01709 Retval = FALSE; 01710 break; 01711 } 01712 // if (!RecalculateTangents(pPath)) 01713 // { 01714 // Retval = FALSE; 01715 // break; 01716 // } 01717 break; 01718 case UPDATE_POSITION: 01719 if (!RepositionPointsByPosition(pPath)) 01720 Retval = FALSE; 01721 break; 01722 case UPDATE_LISTANDPOSITION: 01723 if (!RepositionPointsByPosition(pPath)) 01724 { 01725 Retval = FALSE; 01726 break; 01727 } 01728 if (!RecalculateDistances(pPath)) 01729 { 01730 Retval = FALSE; 01731 break; 01732 } 01733 if (!SortTimeStampingList()) 01734 { 01735 Retval = FALSE; 01736 break; 01737 } 01738 // if (!RecalculateTangents(pPath)) 01739 // { 01740 // Retval = FALSE; 01741 // break; 01742 // } 01743 break; 01744 } 01745 01746 // if (!GetRidOfCrapFromList(pPath)) 01747 // return FALSE; 01748 return Retval; 01749 }
|
|
Sets the BrushAttrValue attribute for the given render region.
Implements AttributeValue. Definition at line 313 of file brshattr.cpp. 00314 { 00315 // Stack the current attribute and set ourselves up as the new one 00316 pRegion->SaveAttribute(ATTR_BRUSHTYPE, this, Temp); 00317 00318 #ifdef BRUSHPOINTSCACHE 00319 // if we don't yet have a cache then make one here 00320 if (m_pCachedPoints == NULL) 00321 InitialisePointsCache(); 00322 #endif 00323 00324 // Find if we have a path processor to do the stroking, and if we do, 00325 // stack a copy of it (a copy must be used to be thread-safe & bgrender-safe) 00326 if (m_pProcessor != NULL) 00327 { 00328 // TRACEUSER("Diccon", _T("Rendering brush attribute\n") ); 00329 00330 // make a clone and push it onto the stack 00331 PathProcessorBrush *pNewProcessor = m_pProcessor->Clone(); 00332 if (pNewProcessor != NULL) 00333 { 00334 //TRACEUSER("Diccon", _T("Pushing path processor\n") ); 00335 #ifdef NEWFASTBRUSHES 00336 pNewProcessor->SetLinkedAttribute (this); 00337 #endif 00338 pRegion->PushPathProcessor(pNewProcessor); 00339 } 00340 00341 } 00342 }
|
|
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.
Definition at line 2028 of file brshattr.cpp. 02029 { 02030 if (m_pTimeStampList == NULL || pPath == NULL) 02031 return FALSE; 02032 02033 TimeStampBrushPoint Point; 02034 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 02035 TimeStampList::iterator LastPos = ListPos; 02036 02037 double PathLength = pPath->GetPathLength(); 02038 MILLIPOINT PointDistance = 0; 02039 // double Tangent = 0; 02040 DocCoord NewPosition; 02041 UINT32 Counter = 0; 02042 02043 while( ListPos != m_pTimeStampList->end() ) 02044 { 02045 LastPos = ListPos; 02046 Point = *ListPos; ++ListPos; 02047 02048 if (pPath->GetDistanceToPoint(Point.m_Point, &PointDistance)) 02049 { 02050 Point.m_Distance = PointDistance; 02051 Point.m_Proportion = (double)PointDistance / PathLength; 02052 // put the point back in the list 02053 *LastPos = Point; 02054 } 02055 else 02056 { 02057 TRACEUSER("Diccon", _T("Failed to get distance to point at %d\n"), Counter); 02058 } 02059 Counter++; 02060 } 02061 return TRUE; 02062 }
|
|
This function moves all the points in the timestamping list to their proportional TimeStampList::iterator along pPath.
Definition at line 1962 of file brshattr.cpp. 01963 { 01964 if (m_pTimeStampList == NULL || pPath == NULL) 01965 return FALSE; 01966 01967 TimeStampBrushPoint Point; 01968 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01969 TimeStampList::iterator LastPos = ListPos; 01970 01971 double PathLength = pPath->GetPathLength(); 01972 MILLIPOINT PointDistance = 0; 01973 double Tangent = 0; 01974 DocCoord NewPosition; 01975 UINT32 Counter = 0; 01976 01977 while( ListPos != m_pTimeStampList->end() ) 01978 { 01979 LastPos = ListPos; 01980 Point = *ListPos; ++ListPos; 01981 // work out the new distance along the given path with the existing proportion 01982 PointDistance = (MILLIPOINT)(Point.m_Proportion * PathLength); 01983 if (PointDistance >= 0) 01984 { 01985 // get the coordinate and tangent for this distance 01986 if (pPath->GetPointAtDistance(PointDistance, &NewPosition, &Tangent)) 01987 { 01988 // assign the new data to the point 01989 Point.m_Point = NewPosition; 01990 Point.m_Tangent = Tangent; 01991 Point.m_Distance = PointDistance; 01992 // put the point back in the list 01993 *LastPos = Point; 01994 } 01995 else 01996 { 01997 TRACEUSER("Diccon", _T("Failed to find point on line with distance %d\n"), PointDistance); 01998 } 01999 } 02000 else 02001 { 02002 TRACEUSER("Diccon", _T("Negative path distance at point %d\n"), Counter); 02003 } 02004 Counter++; 02005 } 02006 return TRUE; 02007 }
|
|
|
|
Restores the BrushAttrValue attribute for the given render region.
Implements AttributeValue. Definition at line 364 of file brshattr.cpp. 00365 { 00366 pRegion->RestoreAttribute(ATTR_BRUSHTYPE, this, Temp); 00367 }
|
|
The bounds are updated to contain the rotated version.
Definition at line 2566 of file brshattr.cpp. 02567 { 02568 ERROR2IF(pBounds == NULL, FALSE, "DocRect is NULL"); 02569 // if (Angle != 0.0) 02570 { 02571 02572 DocCoord BBCentre; 02573 if (pCentre == NULL) 02574 BBCentre = pBounds->Centre(); 02575 else 02576 BBCentre = *pCentre; 02577 02578 DocCoord Coords[4]; 02579 Coords[0].x = pBounds->lo.x; Coords[0].y = pBounds->lo.y; 02580 Coords[1].x = pBounds->hi.x; Coords[1].y = pBounds->lo.y; 02581 Coords[2].x = pBounds->hi.x; Coords[2].y = pBounds->hi.y; 02582 Coords[3].x = pBounds->lo.x; Coords[3].y = pBounds->hi.y; 02583 02584 Trans2DMatrix Rotate(BBCentre,Angle); 02585 Rotate.Transform(Coords,4); 02586 02587 pBounds->lo.x = min(min(Coords[0].x,Coords[1].x), min(Coords[2].x,Coords[3].x)); 02588 pBounds->hi.x = max(max(Coords[0].x,Coords[1].x), max(Coords[2].x,Coords[3].x)); 02589 pBounds->lo.y = min(min(Coords[0].y,Coords[1].y), min(Coords[2].y,Coords[3].y)); 02590 pBounds->hi.y = max(max(Coords[0].y,Coords[1].y), max(Coords[2].y,Coords[3].y)); 02591 } 02592 return TRUE; 02593 }
|
|
asks the processor to scale to this line width. Note that the relevant flag must also be set
Definition at line 2291 of file brshattr.cpp. 02292 { 02293 if (m_pProcessor != NULL) 02294 { 02295 BOOL Pressure = m_pPressureSampler != NULL; 02296 m_pProcessor->ScaleToValue(Width, !Pressure); 02297 } 02298 }
|
|
sets the cache member variable
Definition at line 839 of file brshattr.cpp. 00840 { 00841 #ifdef BRUSHPOINTSCACHE 00842 FlushCache(); 00843 m_pCachedPoints = pMap; 00844 #endif 00845 }
|
|
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.
Definition at line 2360 of file brshattr.cpp. 02361 { 02362 m_CachedBRect = Rect; 02363 }
|
|
To set the path processor used by this object. The processor is now "owned" by this attribute, and will be auto-deleted upon destruction.
Definition at line 2268 of file brshattr.cpp. 02269 { 02270 if (m_pProcessor != NULL) 02271 delete m_pProcessor; 02272 m_pProcessor = pNewProcessor; 02273 02274 }
|
|
sets the pressure array memeber variable
Definition at line 860 of file brshattr.cpp. 00861 { 00862 // Do we want to delete any existing cache? 00863 if (m_pPressureSampler != NULL) 00864 { 00865 delete m_pPressureSampler; 00866 } 00867 m_pPressureSampler = pSampler; 00868 }
|
|
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.
Definition at line 1242 of file brshattr.cpp. 01243 { 01244 m_PressureUpdateType = Update; 01245 }
|
|
as above
Definition at line 945 of file brshattr.cpp. 00946 { 00947 if (m_pPressureVals == NULL) 00948 return FALSE; 00949 00950 size_t NumValues = m_pPressureVals->size(); 00951 if (Index > NumValues) 00952 return FALSE; 00953 00954 // if index is one greater than our current size then we can expanf 00955 if (Index == NumValues) 00956 m_pPressureVals->push_back( Value ); 00957 else 00958 (*m_pPressureVals)[Index] = Value; 00959 00960 return FALSE; 00961 }
|
|
sets the timestamp cache member variable
Definition at line 1345 of file brshattr.cpp. 01346 { 01347 m_pTimeStampList = pList; 01348 }
|
|
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.
Definition at line 2727 of file brshattr.cpp. 02728 { 02729 m_TimeStampUpdateType = Update; 02730 }
|
|
|
|
shuffles each element in the array up by one, assumes that there is already a spare element at the top of the array.
Definition at line 981 of file brshattr.cpp. 00982 { 00983 if (pPressure == NULL) 00984 { 00985 ERROR3("Pressure array is NULL"); 00986 return; 00987 } 00988 00989 size_t NumValues = pPressure->size(); 00990 if (StartIndex >= NumValues) 00991 { 00992 ERROR3("Start index is greater than size of array"); 00993 return; 00994 } 00995 00996 // we count down from the top value and move 00997 // each one up, recall that the extra array element has already been allocated 00998 PressureItem Item; 00999 for( size_t i = NumValues - 2; i >= StartIndex; i-- ) 01000 { 01001 Item = (*pPressure)[i]; 01002 // if (i+1 >= NumValues) 01003 // { 01004 // TRACEUSER("Diccon", _T("Adding array element at %d\n"), i+1); 01005 // pPressure->SetAtGrow(i+1, Item); 01006 // } 01007 // else 01008 (*pPressure)[i] = Item; 01009 } 01010 }
|
|
See AttributeValue::SimpleCopy.
Implements AttributeValue. Definition at line 421 of file brshattr.cpp. 00422 { 00423 ERROR3IF(!IS_A(pValue, BrushAttrValue), 00424 "Invalid Attribute value passed to BrushAttrValue::SimpleCopy"); 00425 00426 // Just uses the assignment operator 00427 *this = *((BrushAttrValue *) pValue); 00428 00429 00430 00431 }
|
|
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.
Definition at line 1862 of file brshattr.cpp. 01863 { 01864 if (m_pTimeStampList == NULL) 01865 return FALSE; 01866 01867 // first we need to copy the elements out of the list into an array 01868 size_t NumElements = m_pTimeStampList->size(); 01869 01870 // make the array 01871 TimeStampBrushPoint* pPointArray = new TimeStampBrushPoint[NumElements]; 01872 if (pPointArray == NULL) 01873 return FALSE; 01874 01875 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01876 01877 TimeStampBrushPoint PointInfo; 01878 UINT32 Counter = 0; 01879 01880 // copy the points into the array 01881 while( ListPos != m_pTimeStampList->end() ) 01882 { 01883 PointInfo = *ListPos; ++ListPos; 01884 01885 pPointArray[Counter++] = PointInfo; 01886 } 01887 01888 // quick sort 'em 01889 qsort((void*)pPointArray, NumElements, sizeof(TimeStampBrushPoint), TimeStampBrushPoint::ComparePointInfo); 01890 01891 01892 // now put 'em back in the list 01893 m_pTimeStampList->clear(); 01894 01895 for (unsigned i = 0; i < NumElements; i++) 01896 { 01897 m_pTimeStampList->push_back(pPointArray[i]); 01898 01899 // TRACEUSER("Diccon", _T("Sorted distance = %d\n"), pPointArray[i].m_Distance); 01900 } 01901 01902 delete pPointArray; 01903 return TRUE; 01904 }
|
|
transforms the cached path. Attempts to optimise straight transform case.
Definition at line 2658 of file brshattr.cpp. 02659 { 02660 if (m_pCachedPoints) 02661 { 02662 BrushPointInfo PointInfo; 02663 PointsMap::iterator pos = m_pCachedPoints->begin(); 02664 02665 TransformBase *pBase = &Trans; 02666 if (pBase->IS_KIND_OF(Trans2DMatrix)) 02667 { 02668 Trans2DMatrix* transMatrix = (Trans2DMatrix*) pBase; 02669 // check for a change in aspect 02670 if (transMatrix->GetMatrix().IsTranslation()) 02671 { 02672 // optimise translate .... 02673 02674 DocCoord trans = transMatrix->GetTranslation (); 02675 02676 while( pos != m_pCachedPoints->end() ) 02677 { 02678 pos->second.m_Point.x += trans.x; 02679 pos->second.m_Point.y += trans.y; 02680 02681 ++pos; 02682 } 02683 } 02684 else 02685 { 02686 while( pos != m_pCachedPoints->end() ) 02687 { 02688 Trans.Transform( &pos->second.m_Point, 1 ); 02689 02690 ++pos; 02691 } 02692 } 02693 } 02694 else 02695 { 02696 while( pos != m_pCachedPoints->end() ) 02697 { 02698 Trans.Transform( &pos->second.m_Point, 1 ); 02699 02700 ++pos; 02701 } 02702 } 02703 } 02704 }
|
|
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.
Definition at line 2379 of file brshattr.cpp. 02380 { 02381 02382 02383 // if we have offsets from the path then simply transforming it doesn't work, 02384 // better to recalculate it 02385 if (m_pProcessor != NULL) 02386 { 02387 if (m_pProcessor->GetPathOffsetType() != OFFSET_NONE) 02388 m_CachedBRect.MakeEmpty(); 02389 } 02390 02391 if (!m_CachedBRect.IsEmpty()) 02392 { 02393 DocCoord Coords[4]; 02394 Coords[0].x = m_CachedBRect.lo.x; Coords[0].y = m_CachedBRect.lo.y; 02395 Coords[1].x = m_CachedBRect.hi.x; Coords[1].y = m_CachedBRect.lo.y; 02396 Coords[2].x = m_CachedBRect.hi.x; Coords[2].y = m_CachedBRect.hi.y; 02397 Coords[3].x = m_CachedBRect.lo.x; Coords[3].y = m_CachedBRect.hi.y; 02398 02399 Trans.Transform(Coords,4); 02400 02401 m_CachedBRect.lo.x = min(min(Coords[0].x,Coords[1].x), min(Coords[2].x,Coords[3].x)); 02402 m_CachedBRect.hi.x = max(max(Coords[0].x,Coords[1].x), max(Coords[2].x,Coords[3].x)); 02403 m_CachedBRect.lo.y = min(min(Coords[0].y,Coords[1].y), min(Coords[2].y,Coords[3].y)); 02404 m_CachedBRect.hi.y = max(max(Coords[0].y,Coords[1].y), max(Coords[2].y,Coords[3].y)); 02405 } 02406 02407 }
|
|
transforms all the points in the timestamping cache
Definition at line 1439 of file brshattr.cpp. 01440 { 01441 if (m_pTimeStampList == NULL) 01442 return; 01443 01444 // pretty straightforward, just get the points out of the list and transform them 01445 TimeStampBrushPoint TSBP; 01446 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 01447 01448 while( ListPos != m_pTimeStampList->end() ) 01449 { 01450 TimeStampList::iterator OldPos = ListPos; 01451 TSBP = *ListPos; ++ListPos; 01452 Trans.Transform(&TSBP.m_Point, 1); 01453 *OldPos = TSBP; 01454 } 01455 01456 01457 01458 }
|
|
If this attribute contains pressure data then it will write out that data to the filter provided.
Definition at line 2815 of file brshattr.cpp. 02816 { 02817 ERROR2IF(pFilter == NULL, FALSE, "Filter is NULL in BrushAttrValue::WriteTimeStampList"); 02818 02819 if (m_pPressureSampler == NULL) 02820 return TRUE; // return TRUE else we'll spring an error 02821 02822 // make ourselves a record 02823 CXaraFileRecord Record ( static_cast<INT32> ( TAG_BRUSHPRESSURESAMPLEDATA ), 02824 static_cast<INT32> ( TAG_BRUSHSAMPLEDATA_SIZE ) ); 02825 BOOL ok = Record.Init(); 02826 02827 if (ok) ok = m_pPressureSampler->WriteNative(&Record); 02828 02829 if (ok) ok = pFilter->Write(&Record); 02830 02831 return ok; 02832 02833 }
|
|
If this brush uses timestamping then this function writes the timestamped list to the filter provided.
Definition at line 2768 of file brshattr.cpp. 02769 { 02770 ERROR2IF(pFilter == NULL, FALSE, "Filter is NULL in BrushAttrValue::WriteTimeStampList"); 02771 02772 if (m_pTimeStampList == NULL) 02773 return TRUE; // return TRUE else we'll spring an error 02774 02775 INT32 NumObjects = (INT32)m_pTimeStampList->size(); 02776 // make ourselves a record 02777 CXaraFileRecord Record ( static_cast<INT32> ( TAG_TIMESTAMPBRUSHDATA ), 02778 static_cast<INT32> ( TAG_TIMESTAMPBRUSHDATA_SIZE ) ); 02779 BOOL ok = Record.Init(); 02780 02781 // the first entry in the record is how many objects there are 02782 if (ok) ok = Record.WriteINT32(NumObjects); 02783 02784 // now write the data 02785 TimeStampBrushPoint ListItem; 02786 TimeStampList::iterator ListPos = m_pTimeStampList->begin(); 02787 while( ok && ListPos != m_pTimeStampList->end() ) 02788 { 02789 ListItem = *ListPos; ++ListPos; 02790 ok = ListItem.WriteNative(&Record); 02791 } 02792 02793 if (ok) ok = pFilter->Write(&Record); 02794 02795 return ok; 02796 }
|
|
Definition at line 296 of file brshattr.h. |
|
Definition at line 288 of file brshattr.h. |
|
Definition at line 295 of file brshattr.h. |
|
Definition at line 293 of file brshattr.h. |
|
Definition at line 284 of file brshattr.h. |
|
Definition at line 300 of file brshattr.h. |
|
Definition at line 291 of file brshattr.h. |
|
Definition at line 298 of file brshattr.h. |