#include <pathtrap.h>
Inheritance diagram for TrapsList:
Public Member Functions | |
TrapsList (INT32 Repeat=0) | |
Constructor. | |
~TrapsList () | |
Destructor. | |
UINT32 | GetNumTraps (void) |
TrapEdgeList * | GetTrapEdgeList (UINT32 index) |
TrapEdgeList * | GetLastTrapEdgeList (void) |
TrapEdgeList * | AddEdgeList (void) |
Add a new TrapEdgeList object to this list. | |
BOOL | PostProcessLists (ProcessPathToTrapezoids *pProcessor, TrapTravelType TravelType) |
Scans the recorded list of TrapEdgeLists and fills in the remaining information (normals and position values) for all trapezoids therein. | |
INT32 | GetRepeatLength (void) |
Protected Member Functions | |
BOOL | ExpandArray (void) |
(Internal method) Expands the storage structure of the list to allow more entries to be used. Called automatically by AddEdgeList if it needs more edges. | |
Protected Attributes | |
UINT32 | Used |
UINT32 | CurrentSize |
TrapEdgeList ** | pTraps |
INT32 | RepeatLength |
Definition at line 369 of file pathtrap.h.
|
Constructor.
Definition at line 683 of file pathtrap.cpp. 00684 { 00685 Used = 0; 00686 CurrentSize = 0; 00687 pTraps = NULL; 00688 RepeatLength = Repeat; 00689 }
|
|
Destructor.
Definition at line 704 of file pathtrap.cpp. 00705 { 00706 if (pTraps != NULL) 00707 { 00708 for (UINT32 Index = 0; Index < Used; Index++) 00709 delete pTraps[Index]; 00710 00711 CCFree(pTraps); 00712 } 00713 }
|
|
Add a new TrapEdgeList object to this list.
Definition at line 731 of file pathtrap.cpp. 00732 { 00733 if (Used >= CurrentSize) // If we've run out of room in the array 00734 { 00735 if (!ExpandArray()) // Try to allocate more 00736 return(NULL); // And return NULl if we failed 00737 } 00738 00739 TrapEdgeList *pObject = new TrapEdgeList(this); 00740 if (pObject == NULL) 00741 return(NULL); 00742 00743 pTraps[Used] = pObject; 00744 Used++; 00745 00746 return(pObject); 00747 }
|
|
(Internal method) Expands the storage structure of the list to allow more entries to be used. Called automatically by AddEdgeList if it needs more edges.
Definition at line 770 of file pathtrap.cpp. 00771 { 00772 // Work out how many entries to allocate. 00773 // Each item is small, so we allocate a reasonably large number 00774 // Note that potential implementation of dashed lines could create a lot of 00775 // TrapEdgeLists (one per dash), so we need lots of spare capacity to cope 00776 // with this situation. I've therefore erred on the generous side. 00777 const INT32 AllocSize = CurrentSize + 64; 00778 00779 if (pTraps == NULL) 00780 { 00781 // We have no array yet, so allocate one 00782 pTraps = (TrapEdgeList **) CCMalloc(AllocSize * sizeof(TrapEdgeList *)); 00783 if (pTraps == NULL) 00784 return(FALSE); 00785 } 00786 else 00787 { 00788 // We have an array - we must make it larger 00789 TrapEdgeList **pNewBuf = (TrapEdgeList **) CCRealloc(pTraps, AllocSize * sizeof(TrapEdgeList *)); 00790 if (pNewBuf == NULL) 00791 return(FALSE); 00792 00793 pTraps = pNewBuf; 00794 } 00795 00796 // Success. Update the current size value 00797 CurrentSize = AllocSize; 00798 00799 // Initialise the pointers to safe values 00800 for (UINT32 Index = Used; Index < CurrentSize; Index++) 00801 pTraps[Index] = NULL; 00802 00803 return(TRUE); 00804 }
|
|
Definition at line 384 of file pathtrap.h.
|
|
Definition at line 377 of file pathtrap.h. 00377 { return(Used); };
|
|
Definition at line 394 of file pathtrap.h. 00394 { return(RepeatLength); };
|
|
Definition at line 380 of file pathtrap.h.
|
|
Scans the recorded list of TrapEdgeLists and fills in the remaining information (normals and position values) for all trapezoids therein.
Notes: TrapTravel_None will leave edge "Position" values TOTALLY UNINITIALISED Definition at line 838 of file pathtrap.cpp. 00840 { 00841 // There is a problem with fixed repeating vector brushes sometimes doing a bit 00842 // more than they should, in other words, a 6 repeat brush starting on the 7th 00843 // repeat, or at least adding 1 trap to the list for it... 00844 // The commented out stuff below was the last ever bit of code written by Jason. 00845 // It was intended as a fix, but I (Richard) never got round to getting it compiling 00846 // let alone testing it. Since the stroking job is now no more, and also since this 00847 // comment is still here, I suspect the problem still remains. To see it in action 00848 // you need to draw a wibbly filled freehand shape and pop the gallery up. The 00849 // symptoms are a bizarre line to the right of the preview. It's tricky to get a 00850 // repeating case... 00851 // Jason, if you decided to come back, good on you mate... If not, may I wish 00852 // whoever is reading this all the best with the stroking system - blimmin 00853 // fabby, innit ? 00854 /* BOOL DiscardPartialRepeats = TRUE; 00855 00856 if (RepeatDist > 0 && DiscardPartialRepeats && Used > 1) 00857 { 00858 TrapEdge *pEdge = pTraps[Used-1]->GetLastTrapEdge(); 00859 if (pEdge != NULL && pEdge->Position < RepeatDist/2) 00860 { 00861 delete pTraps[Used-1]; 00862 pTraps[Used-1] = NULL; 00863 Used--; 00864 } 00865 }*/ 00866 00867 for (UINT32 Index = 0; Index < Used; Index++) 00868 { 00869 if (pTraps[Index] != NULL) 00870 { 00871 if (!pTraps[Index]->ProcessEdgeNormals(pProcessor)) 00872 return(FALSE); 00873 00874 if (!pTraps[Index]->ProcessEdgePositions(TravelType)) 00875 return(FALSE); 00876 } 00877 } 00878 00879 return(TRUE); 00880 }
|
|
Definition at line 403 of file pathtrap.h. |
|
Definition at line 404 of file pathtrap.h. |
|
Definition at line 406 of file pathtrap.h. |
|
Definition at line 402 of file pathtrap.h. |