fuzzclip.h File Reference

(r1785/r751)

Go to the source code of this file.

Functions

size_t FuzzyClip (PPOINT IPoints, PBYTE ITypes, size_t ILength, BOOL IsClosed, RECT *InnerRect, RECT *OuterRect, PPOINT pOPoints, PBYTE pOTypes, size_t pOMaxLength)
 Note that InnerRect should be slightly larger than the window for which the clipping is being performed. This ensures that any slight errors won't be visible at the window edges. Note also that OuterRect must be over 3 times the width of InnerRect, with InnerRect centred within it. No errors should occur as the path is expected to be in a legal state.


Function Documentation

size_t FuzzyClip PPOINT  IPoints,
PBYTE  ITypes,
size_t  ILength,
BOOL  IsClosed,
RECT InnerRect,
RECT OuterRect,
PPOINT  pOPoints,
PBYTE  pOTypes,
size_t  pOMaxLength
 

Note that InnerRect should be slightly larger than the window for which the clipping is being performed. This ensures that any slight errors won't be visible at the window edges. Note also that OuterRect must be over 3 times the width of InnerRect, with InnerRect centred within it. No errors should occur as the path is expected to be in a legal state.

Parameters:
IPoints,ITypes,ILength - Source path [INPUTS] IsClosed - Source path and output path should be closed. InnerRect - Inner rectangle to which to clip. OuterRect - Outer rectangle to which to clip.
pOPoints,pOTypes - Outut path. [OUTPUTS] pOMaxLength - Maximum length of output path.
Returns:
Returns the length of the path, or -1 if an error occurs. (ie output path not large enough).

Definition at line 450 of file fuzzclip.cpp.

00461 {
00462     IRect       = (GRECT*) InnerRect ;
00463     ORect       = (GRECT*) OuterRect ;
00464     OPoints     = pOPoints ;
00465     OTypes      = pOTypes ;
00466     OMaxLength  = pOMaxLength ;
00467     OLength     = 0 ;
00468 
00469     if ( ILength <= 0 )
00470         return 0 ;
00471 
00472     try {
00473 
00474         Index = 0 ;
00475         while ( Index<ILength )
00476         {
00477             OFirstPoint = TRUE ;
00478             POINT StartPoint = IPoints[Index++] ;
00479             LastSector = GetSector( StartPoint ) ;
00480             LastPoint = StartPoint ;
00481             while ( Index<ILength && (IsLine(ITypes[Index]) || IsCurve(ITypes[Index])) )
00482             {
00483                 if ( IsLine(ITypes[Index]) )
00484                 {
00485                     ClipLine( LastPoint,IPoints[Index] ) ;
00486                     LastPoint = IPoints[Index++] ;
00487                 }
00488                 else
00489                 {
00490                     ClipCurve( LastPoint,IPoints[Index],IPoints[Index+1],IPoints[Index+2] ) ;
00491                     LastPoint = IPoints[Index+2] ;
00492                     Index += 3 ;
00493                 }
00494             }
00495             if ( IsClosed || (ITypes[Index-1] & PT_CLOSEFIGURE) )
00496             {
00497                 ClipLine( LastPoint,StartPoint ) ;
00498                 if ( !OFirstPoint )
00499                     *(OTypes-1) |= PT_CLOSEFIGURE ;
00500             }
00501             if ( !OFirstPoint && IsMove(*(OTypes-1)) )
00502             {
00503                 OTypes-- ;
00504                 OPoints-- ;
00505                 OLength-- ;
00506             }
00507         }
00508 
00509     } catch ( INT32 ) {
00510         OLength = (size_t)-1 ;
00511     }
00512 
00513     return OLength ;
00514 }


Generated on Sat Nov 10 03:49:31 2007 for Camelot by  doxygen 1.4.4