paths.h

Go to the documentation of this file.
00001 // $Id: paths.h 942 2006-05-03 08:23:54Z gerry $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // Header file for the Path Classes
00099 
00100 
00101 #ifndef INC_PATHS
00102 #define INC_PATHS
00103 
00104 #include "doccoord.h"
00105 #include "docrect.h"
00106 #include "handles.h"
00107 #include "pathtype.h"
00108 #include "attr.h"
00109 #include "gconsts.h"
00110 
00111 class RenderRegion;
00112 class NodePath;
00113 class Operation;
00114 class ProcessFlags;
00115 class CCAttrMap;
00116 
00117 // The path can store a number of channels of extra information, eg Pressure.
00118 // These extra channels are defined here ...
00119 const INT32 NUMEXTRACHANNELS = 1;   // Number of Extra Channels Possible
00120 
00121 // Possibly temporary constant, the max differencing rate when walking a curve
00122 const UINT32 MAXPATHDIFFRATE = 64;
00123 
00124 
00125 typedef enum
00126 {
00127     CI_PRESSURE
00128 } ChannelIndex;
00129 
00130 typedef UINT32 PathExtraElement;
00131 typedef UINT32 PathWidth;
00132 
00133 const PathExtraElement EXTRAVALUEMAX = 65535;
00134 
00135 /********************************************************************************************
00136 
00137 >   class PathExtraInfo
00138 
00139     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00140     Created:    21/06/94
00141     Purpose:    Creation, manipulation and use of extra information on paths, eg. Pressure.
00142                 A path will have a pointer to an instance of this class if it has some extra
00143                 information associated with it.
00144                 The extra info is stored as a number of channels, each of which is an array
00145                 of 'PathExtraElements' (currently UINTs).  These channels can then be mapped
00146                 to one of the known 'provider data' types, eg, Line Width, Colour etc.
00147 
00148 ********************************************************************************************/
00149 
00150 class PathExtraInfo
00151 {
00152 friend class Path;
00153 public:
00154     // construction etc
00155     PathExtraInfo();
00156     ~PathExtraInfo();
00157 
00158     // Functions to add and access Extra Info
00159     BOOL Init(ChannelIndex, INT32);
00160     BOOL Add(ChannelIndex, INT32);
00161     void Sync(INT32);
00162     void Next() { CurrentExtraPos++; }
00163 
00164     // Functions to determine what extra info is availble
00165     BOOL HasWidthInfo();
00166 
00167     // Functions to alter the mapping of extra info
00168     void MapWidthInfo(ChannelIndex);
00169 
00170     // Functions to access the mapped path data
00171     PathWidth GetWidthInfo();
00172     PathWidth* GetWidthArray();
00173 
00174 private:
00175     // Functions for messing about with the Extra Info Blocks
00176     BOOL IncreaseExtraBlocks(INT32);
00177     BOOL DecreaseExtraBlocks(INT32);
00178     void ShiftUpExtraInfo(INT32, INT32, INT32);
00179     void ShiftDownExtraInfo(INT32, INT32, INT32);
00180     void CopyExtraInfo(PathExtraInfo*);
00181 
00182 private:
00183     // If the path has Extra Info in it then the Memory handle will be
00184     // in the ExtraInfoHandles array.  See ChannelIndex definition above.
00185     MHANDLE ExtraInfoHandles[NUMEXTRACHANNELS];
00186 
00187     FIXED16 Scaling[NUMEXTRACHANNELS];
00188 
00189     INT32 CurrentExtraPos;
00190 
00191     // Here we define the Variables used to map the channels
00192     ChannelIndex WidthChannel;      // The channel to use for Width Information
00193 };
00194     
00195 typedef enum
00196 {
00197     JOIN_START,     // The Join is at the Start of the path
00198     JOIN_END,       // The Join is at the End of the path
00199     JOIN_MIDDLE,    // The Join is at the Start or End of an internal Sub Path
00200     JOIN_NONE       // There is no Join
00201 } JoinType;
00202 
00203 
00204 struct JoinInfo
00205 {
00206     JoinType    JoinedAt;       // Where the join is
00207     INT32           JoinPos;        // The coord number of the join this is only really useful
00208                                 // when JoinedAt is JOIN_MIDDLE
00209 };
00210 
00211 
00212 
00213 enum PathTypeEnum {PATHTYPE_NONE, PATHTYPE_SHAPE, PATHTYPE_LINE };
00214 
00215 /********************************************************************************************
00216 
00217 <   POINTFLAG
00218 <   POINTFLAG_ENDPOINTS
00219 <   POINTFLAG_CONTROLPOINTS
00220 <   POINTFLAG_ENDSFIRST
00221 
00222 These are the flags that get passed to the routine FindNearestPoint to allow me to filter out
00223 control points and that sort of thing. They can be ORed together.
00224 
00225 POINTFLAG_ENDPOINTS is set if the caller wants endpoints returned (in this context, an endpoint
00226 is any of a moveto, lineto or the third point on a curveto. Sometimes referred to as Anchor points)
00227 
00228 POINTFLAG_CONTROLPOINTS is set if the routine should return bezier curve control points.
00229 
00230 POINTFLAG_ENDSFIRST is set if the routine should look at all endpoints first, before it
00231 looks at control points. If clear, all points in the path are checked in order.
00232 
00233 *********************************************************************************************/
00234 
00235 #define POINTFLAG_ENDPOINTS     0x0001  // return endpoints
00236 #define POINTFLAG_CONTROLPOINTS 0x0002  // return control points
00237 #define POINTFLAG_ENDSFIRST     0x0004  // look at endpoints first
00238 
00239 
00240 /********************************************************************************************
00241 
00242 >   class Path
00243 
00244     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00245     Created:    28/01/94
00246     Purpose:    Creation, manipulation and use of Paths. A path is an arbitary collection of
00247                 MoveTo, LineTo and CurveTo segments
00248                 Public Member variables :-
00249                 BOOL IsFilled - TRUE if this path if filled, FALSE otherwise
00250 
00251 ********************************************************************************************/
00252 
00253 class Path
00254 {
00255 public:
00256     // construction etc
00257     Path();
00258     ~Path();
00259     
00260     // copy functions
00261     BOOL CopyPathDataFrom( Path* SrcPath );
00262     BOOL CopyPathDataFrom( DocCoord* Coords, PathVerb* Verbs, INT32 NumCoords, 
00263                            BOOL Filled = FALSE, BOOL Stroked = TRUE);
00264 
00265     // Create from DocRect function
00266     BOOL CreatePathFromDocRect(DocRect* pRect);
00267 
00268     // initialisation
00269     BOOL Initialise(INT32 InitialSize=24, INT32 BlockSize=12);
00270 
00271     // Searching Functions
00272     BOOL FindStartOfPath();
00273     void FindStartOfSubPath();
00274     void FindStartOfSubPath(INT32* Index) const;
00275     void FindEndOfSubPath();
00276     void FindEndOfSubPath(INT32* Index) const;
00277     void FindEndElOfSubPath(INT32* Index) const;
00278     void ExpandRange(INT32* start, INT32* end, INT32 num);
00279 
00280     BOOL FindNext();
00281     BOOL FindNext(INT32* Index) const;
00282     BOOL FindPrev();
00283     BOOL FindPrev(INT32* Index) const;
00284     BOOL FindPrevEndPoint(INT32* index) const;
00285     BOOL FindNextEndPoint(INT32* index) const;
00286     BOOL GetSubPathEnds(DocCoord* start, DocCoord* end);
00287     BOOL FindNearestPoint(DocCoord pos, UINT32 flags, INT32* position);
00288     BOOL PointCloseToLine(DocCoord pos, INT32* position);
00289     BOOL ClosestSelectedEndpoint(DocCoord pos, INT32* position, double* distance);
00290     BOOL FindNextSelected(INT32* Index);
00291     BOOL FindSelectionLimits(INT32 index, INT32* p, INT32* q);
00292     INT32 FindOppositeControlPoint(INT32 ThisIndex);
00293     INT32 FindPrevControlPoint(INT32 position);
00294     INT32 FindNextControlPoint(INT32 position);
00295     
00296     double SqrDistanceToPoint(const DocCoord pt, INT32* NearEl, double* mu);
00297     DocCoord ClosestPointTo(const double t, const INT32 index);
00298     BOOL IsPointCloseTo(const DocCoord ICoord, INT32 range, INT32* NearElement, double* mu );
00299     double SqrLength();
00300     double GetPathLength(double dFlatness = 64.0);
00301     double DistReparameterise(const double sqrdist, INT32* Element);
00302     DocCoord ConvSqrDistToCoord(const double sqrdist);
00303     INT32 BreakInTwo(Path* pChildPath);
00304     INT32 NumSplinters();
00305 
00306     BOOL DistanceTo(INT32 index, double t, double* distance, double dFlatness=64.0);
00307     BOOL DistanceTo(DocCoord Coord, double* dist, double dFlatness=64.0);
00308     BOOL SplitAtPoint(const DocCoord& SplitPoint, INT32* SplitAt, INT32* NewElements);
00309     BOOL GetPointAtDistance(MILLIPOINT Distance, DocCoord* pPoint,double* pTangent=NULL, UINT32* pPressure = NULL);
00310     BOOL GetDistanceToPoint(DocCoord Point, MILLIPOINT* Distance);
00311 
00312     void Scale(const DocCoord dcOrigin, const double dDPI=96.0);
00313 
00314 
00315     INT32 GetPathPosition();
00316     void SetPathPosition( INT32);
00317 
00318     // Function to check if we are still in the path
00319     BOOL IsInPath();
00320 
00321     // Information functions
00322     PathVerb GetVerb() const;
00323     DocCoord GetCoord() const;
00324     PathFlags GetFlags() const;
00325     PathWidth GetWidth() const;
00326     PathTypeEnum GetPathType() const;
00327     
00328     INT32 GetPathByteLength() const;
00329     INT32 GetNumElements() const;
00330     INT32 GetNumCoords() const;
00331     INT32 GetNumEndPoints() const;
00332     INT32 GetAllOpenEnds(INT32 MaxElements, DocCoord* EndCoords) const;
00333     INT32 GetNumSelEndPoints() const;
00334     INT32 GetNumSubpaths() const;
00335 
00336     
00337     DocRect GetBoundingRect() const;
00338 #if !defined(EXCLUDE_FROM_XARLIB)
00339     DocRect GetBlobRect() const;
00340     BOOL GetTrueBoundingRect(   DocRect* pRect, MILLIPOINT LineWidth = 0,
00341                                                 CCAttrMap* pAttrMap = NULL );
00342 #endif
00343 
00344     DocCoord GetEndPoint();
00345     DocCoord GetControl1();
00346     DocCoord GetControl2();
00347 
00348     DocCoord*  GetCoordArray() const;
00349     PathVerb*  GetVerbArray()  const;
00350     PathFlags* GetFlagArray()  const;
00351     PathWidth* GetWidthArray();
00352     void GetPathArrays(PathVerb** pV, DocCoord** pC = NULL, PathFlags** pF = NULL);
00353 
00354     void GetFlags( PathFlags* NewFlags);
00355     void SetFlags( const PathFlags& NewFlags);
00356     void InitialiseFlags();
00357     void InitialiseFlags( const INT32 Startindex, const INT32 Len);
00358     void InitialiseFlags( PathVerb* pVerbs, PathFlags* pFlags, const INT32 Len);
00359 
00360     // Insertion Functions
00361     BOOL InsertMoveTo(DocCoord p1, PathFlags* NewFlags = NULL);
00362     BOOL InsertLineTo(DocCoord p1, PathFlags* NewFlags = NULL);
00363     BOOL InsertCurveTo(DocCoord p1, DocCoord p2, DocCoord p3, PathFlags* NewFlags = NULL);
00364     BOOL CloseSubPath();
00365     BOOL InsertSection(INT32 StartSlot, INT32 NumSlots);
00366     BOOL AddMoveTo(DocCoord p1, PathFlags* NewFlags = NULL);
00367     BOOL AddLineTo(DocCoord p1, PathFlags* NewFlags = NULL);
00368     BOOL AddCurveTo(DocCoord p1, DocCoord p2, DocCoord p3, PathFlags* NewFlags = NULL);
00369     BOOL AddCurveTo(DocCoord p1, PathFlags* NewFlags = NULL);
00370 
00371     // Deletion functions
00372     BOOL DeleteSection(INT32 StartSlot, INT32 NumSlots);
00373     BOOL DeleteElement();
00374     BOOL DeleteFromElement(INT32 ElementNum);
00375     BOOL ClearPath();
00376     BOOL ClearPath(BOOL compress);
00377     BOOL Compact();
00378 
00379     // Getting stuff from the flags
00380     BOOL IsSelected();
00381     BOOL IsSmooth();
00382     BOOL IsRotate();
00383     BOOL IsEndPoint();
00384     BOOL IsSubSelection();
00385 
00386     // Other Query functions
00387     BOOL IsNearOpenEnd(const DocRect& BlobRect, INT32* SlotNum);
00388     BOOL IsOpenEnd(const INT32 index);
00389     BOOL IsComplexPath();
00390     BOOL IsIsometric(const Path& OtherPath, Matrix* pTransform, const double& Tolerance = 1.0) const;
00391     INT32   CalcCRC();
00392     INT32 CalcRegionCRC(const INT32 StartIndex, const INT32 EndIndex);
00393     INT32 CalcSelectedCRC();
00394     INT32 CalcSelPointsCRC(const INT32 StartIndex, const INT32 EndIndex);
00395     XLONG CalcArea();
00396 
00397     // New Compare Function
00398     INT32 ComparePathToPath(Path* pComparePath, BOOL QuickCheck = TRUE);
00399 
00400     // Debug Functions
00401     void DumpPath();
00402     void GetDebugDetails(StringBase* Str);
00403 
00404 #if !defined(EXCLUDE_FROM_XARLIB)
00405     // Rendering Functions (Blobs)
00406     void RenderPathBlobs(Spread* pSpread);
00407     void RenderPathBlobs(RenderRegion* pRender);
00408     void RenderPathControlBlobs(Spread* Spread, INT32 EndPtIndex);
00409     void RenderPathControlBlobs(RenderRegion* pRender,INT32 EndPtIndex);
00410     void RenderPathSelectedControlBlobs(Spread* pSpread, BOOL Removing = TRUE);
00411     void RenderPathSelectedControlBlobs(Spread* pSpread, RenderRegion* pRender);
00412     void RenderSelectedControlBlobsToPendingRegions(Spread* pSpread);
00413     void RenderPathPenBlobs(Spread* pSpread);
00414     void RenderPathPenBlobs(RenderRegion* pRegion);
00415 
00416     // Functions to draw components of the selection blobs
00417     void DrawBlob(RenderRegion*, const DocCoord&, BOOL);
00418     void DrawControlBlob(RenderRegion*, const DocCoord&);
00419     void DrawControlLine(RenderRegion*, const DocCoord&, const DocCoord&);
00420 #endif
00421 
00422     // Functions to help with sub-selections
00423     void ClearSubSelection();
00424     void SetAllSubSelection();
00425     void EnsureSelection(BOOL UseStarts);
00426 
00427     // Path Smoothing functions
00428     void SmoothCurve(BOOL SetRenderFlags = FALSE, BOOL SnapEnds = FALSE, INT32 SnapIndex = 0);
00429     void CalcDoubleCurve( DocCoord&, DocCoord&, DocCoord&, DocCoord*, DocCoord*);
00430     void CalcPointCurve( DocCoord&, DocCoord&, DocCoord&, DocCoord*);
00431     void CalcPointLine( DocCoord&, DocCoord&, DocCoord&, DocCoord*);
00432     void CalcPointEnd( DocCoord&, DocCoord&, DocCoord*);
00433     void CalcRotate( DocCoord&, DocCoord*, DocCoord*, DocCoord&);
00434 
00435     // Manipulation functions
00436     void Reverse();
00437     void ReverseSection(INT32 StartSlot, INT32 SubPathLen);
00438     void TryToClose();
00439     void RotateElementsLeft(const INT32 Start, const INT32 End, INT32 Rotate);
00440     BOOL MergeTwoPaths(const Path& Other);
00441     BOOL MergeTwoPaths(DocCoord* OtherCoords,PathVerb* OtherVerbs,PathFlags* OtherFlags,INT32 Length,BOOL Filled);
00442     BOOL SplitAtPoint(const DocCoord SplitPt, INT32* SplitElement, UINT32* NumElements, PathVerb* Verbs, DocCoord* Coords);
00443     BOOL ChangeStartElement(INT32 StartIndex);
00444     void Translate(const INT32 x, const INT32 y);
00445     void Translate(const DocCoord& coord);
00446 
00447 #if !defined(EXCLUDE_FROM_XARLIB)
00448     INT32 ClipPathToPath(const Path& Src,Path* const pDest,UINT32 Flags,
00449                         UINT32 Tolerance = 100,double SrcFlatness = 750.0,double ClipFlatness = 750.0);
00450     
00451     BOOL StrokePathToPath(  MILLIPOINT  LineWidth   = 250, 
00452                             LineCapType LineCap     = LineCapButt,
00453                             JointType   JoinStyle   = MitreJoin, 
00454                             DashType*   pDash       = NULL,
00455                             Path*       pDest       = NULL,
00456                             double      Flatness    = 200.0,
00457                             BOOL        Close       = FALSE);
00458 
00459     // MRH 25/10/00 -   New Helper function which returns a suitable flatness value that
00460     //                  can be used in conjunction with clipping, stroking and contouring!
00461     double CalculateFlatnessValueFromPath(double DividerValue = 375.0, double LowerLimit = 1.0, double UpperLimit = 375.0);
00462 
00463     // Contour Functions - MRH 23/05/00
00464     // The following functions are to do with contouring paths using Gavins new Contouring code!
00465     INT32 InitializeContourValues(UINT32 Width, JoinStyles JoinS = JOIN_ROUND, BOOL IsAnOuterContour = TRUE,
00466                                  double Flatness = 200.0, BOOL ClosePath = TRUE, BOOL UseContourMode = TRUE,
00467                                  CapStyles CapS = CAPS_ROUND, UINT32 MitreLimit = 751941);
00468     
00469     INT32 GetContourForStep(Path* pDest, double StepValue = 1.0);
00470 
00471 #endif
00472 
00473     // functions for working with NeedToRender flags
00474     void ClearNeedToRender();
00475 
00476     // Copy functions
00477     BOOL CopySectionFrom(const Path& Other, INT32 StartIndex, INT32 NumToCopy);
00478     BOOL CopySectionTo(Path* Dest, INT32 StartIndex, INT32 NumToCopy);
00479     BOOL MergeSectionFrom(INT32 DestinPos, const Path& Source, INT32 SourcePos, INT32 Length);
00480     BOOL MergeSectionTo(INT32 SourcePos, INT32 Length, Path* Destin, INT32 DestinPos);
00481     BOOL MakePathFromSection(const INT32 Start, const INT32 Length, Path* pDestin);
00482     BOOL MakePathFromSubPath(const INT32 lSubpathIndex, Path* pDestin);
00483     BOOL CloneFrom(const Path& Other);
00484 
00485     // Joining Functions
00486     BOOL SimpleJoin(Path* Other, INT32*, BOOL*, BOOL *Reversed = NULL);
00487     BOOL ComplexJoin(Path* Other, INT32*, BOOL*);
00488     BOOL ComplexToSameComplexJoin(Path* Other, INT32*, BOOL*);
00489     BOOL FindJoinedSubPathInfo(const DocCoord& JoinCoord, INT32* Start, INT32* Length, BOOL* JoinAtStart);
00490     BOOL JoinToAnother(Path* OtherPath, INT32 MainIndex, INT32 OtherIndex);
00491 
00492     // Merging and replacement functions
00493     BOOL RetroReplaceSection(INT32 StartSlot, INT32 NumSlots, Path* NewPath, BOOL KeepStart);
00494 
00495     // smoothing and flattening functions
00496     BOOL SmoothRegions(const double error, BOOL smoothall, BOOL reselect);
00497     BOOL SmoothSection(INT32 index1, INT32* index2, const double error, INT32 selection);
00498     BOOL Smooth(const double error);
00499     BOOL Quantise(const double threshold, Path* pOutput);
00500     BOOL Flatten(const double flatness, Path* pOutput);
00501     BOOL CreateFlatPath(const ProcessFlags& PFlags, const double flatness, Path* pOutput);
00502 
00503     // Making room in a path for more points
00504     BOOL MakeSpaceInPath(INT32 NumSlots);
00505     BOOL MakeSpaceInPath(INT32 NumSlots, INT32 Position);
00506     BOOL MakeSpaceAtEnd(INT32 NumSlots);
00507     BOOL OpenGap(INT32 NumSlots);
00508     BOOL OpenGap(INT32 NumSlots, INT32 Position);
00509     BOOL EnsureVolume(INT32 NumSlots);
00510 
00511     // Functions for external array manipulation
00512     BOOL ExternalArraysAdded(const INT32 Added);
00513     BOOL ExternalArraysReplaced(const INT32 Size);
00514 
00515     // Functions to determine what extra info is available
00516     BOOL HasWidth();
00517 
00518     // Functions to alter the mapping of extra info
00519     void MapWidth(ChannelIndex);
00520 
00521     // Functions to add Extra Info
00522     BOOL InitExtraInfo(ChannelIndex);
00523     BOOL AddExtraInfo(ChannelIndex, INT32);
00524     void SyncExtraInfo();
00525     void NextExtraInfo() { ExtraInfo->Next(); }
00526 
00527     DocCoord SmoothControlPoint(INT32 Index,
00528                                 BOOL StartAndEndSnapped = FALSE,
00529                                 BOOL JoinedToAnother = FALSE,
00530                                 BOOL OtherIsCurve = TRUE,
00531                                 const DocCoord& OtherCoord = DocCoord(0,0) );
00532 
00533 //  void Path::SmartSmoothCurve(BOOL StartAndEndSnapped = FALSE,
00534 //                              BOOL JoinedToAnother = FALSE,
00535 //                              Path* OtherPath = NULL,
00536 //                              BOOL JoinStartOfThis = FALSE,
00537 //                              BOOL JoinStartOfOther = FALSE,
00538 //                              BOOL RecordUndo = FALSE,
00539 //                              NodePath* UndoPath = NULL,
00540 //                              Operation* UndoOperation = NULL);
00541 
00542     BOOL    IsSubPathClosed(INT32 Index);
00543     BOOL    IsClosed();
00544 
00545 #ifdef _DEBUG
00546     // Validation functions
00547     BOOL CheckPathValid();
00548 #endif
00549     BOOL EnsureValid(BOOL* ChangesMade = NULL);
00550 
00551 private:
00552     // Helper functions
00553     BOOL InsertSectionAtEnd(const Path* Other, INT32 StartPos, INT32 NumSlots);
00554 
00555 #if !defined(EXCLUDE_FROM_XARLIB)
00556     // Contour Variables - MRH 23/05/00
00557     INT32 m_ContourWidth;
00558     JoinStyles m_ContourJoinS;
00559     CapStyles m_ContourCapS;
00560     double m_ContourFlatness;
00561     UINT32 m_ContourMitreLimit;
00562     UINT32 m_ContourLength;
00563     BOOL m_IsAnOuterContour;
00564     BOOL m_DoClosePath;
00565     BOOL m_UseContourMode;
00566 #endif
00567 
00568 public:
00569     // Flags that effect the entire path
00570     BOOL IsFilled;
00571     BOOL IsStroked;
00572 
00573     INT32 GetUsedSlots () { return (UsedSlots); }
00574 
00575 private:
00576     // Memory Handles for the paths actual data
00577     MHANDLE VerbHandle;
00578     MHANDLE CoordHandle;
00579     MHANDLE FlagsHandle;
00580 
00581     // The path may have other information, eg. Pressure
00582     PathExtraInfo* ExtraInfo;
00583 
00584     // Keep track of the available memory
00585     INT32 UnUsedSlots;
00586     INT32 UsedSlots;
00587     INT32 SlotAllocSize;
00588     INT32 SlotInitSize;
00589 
00590     // Keep track of the current path position
00591     INT32 CurrentPos;
00592 };
00593 
00594 
00595 #endif  // INC_PATH
00596 

Generated on Sat Nov 10 03:46:29 2007 for Camelot by  doxygen 1.4.4