EnvelopeShapes Class Reference

The default envelope shapes class. This class provides a bunch of static functions to create some default shapes. All shapes are defined on a (0,0),(72000,72000) coordinate system. More...

#include <moldenv.h>

List of all members.

Static Public Member Functions

static BOOL Rectangular (Path *pPath)
 Creates a rectangular envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).
static BOOL Rectangular2x2 (Path *pPath)
 Creates a rectangular envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).
static BOOL Circular (Path *pPath)
 Creates a circular envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).
static BOOL Concave (Path *pPath)
 Creates a concave envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).
static BOOL Banner (Path *pPath)
 Creates a banner envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).

Static Private Member Functions

static BOOL MakeEllipse (DocRect *pRect, Path *pPath, PathFlags *pFlags)
 Create an elliptically shaped closed path which is the same size as and has the same position as the rectangle specified.


Detailed Description

The default envelope shapes class. This class provides a bunch of static functions to create some default shapes. All shapes are defined on a (0,0),(72000,72000) coordinate system.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/94

Definition at line 274 of file moldenv.h.


Member Function Documentation

BOOL EnvelopeShapes::Banner Path pPath  )  [static]
 

Creates a banner envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/01/94
Parameters:
pPath = a pointer to an empty path (should be initialised but empty) [INPUTS]
pPath = a unit banner envelope, ready to be scaled to fit the selection. [OUTPUTS]
Returns:
TRUE if the banner envelope manifold has been created FALSE if no memory to create the envelope.

Definition at line 2169 of file moldenv.cpp.

02170 {
02171     ERROR2IF(pPath==NULL,FALSE,"NULL path pointer passed to EnvelopeShapes::Banner()");
02172 
02173     PathFlags flags;
02174     flags.IsSelected = FALSE;
02175     BOOL ok;
02176 
02177     DocRect Rect(0,0,72000,72000);
02178     DocCoord p1,p2,p3;
02179 
02180     DocCoord point(0,0);
02181     ok = (pPath->AddMoveTo(point,&flags));
02182     if (!ok) return FALSE;
02183 
02184     point.y = 72000;
02185     ok = (pPath->AddLineTo(point,&flags));
02186     if (!ok) return FALSE;
02187 
02188     p1.x = (6*Rect.lo.x + 2*Rect.hi.x)/8;
02189     p1.y = (3*Rect.lo.y + 5*Rect.hi.y)/8;
02190     p2.x = (2*Rect.lo.x + 6*Rect.hi.x)/8;
02191     p2.y = p1.y;
02192     p3.x = Rect.hi.x;
02193     p3.y = Rect.hi.y;
02194 
02195     ok = (pPath->AddCurveTo(p1,p2,p3,&flags));
02196     if (!ok) return FALSE;
02197 
02198     point.x = 72000;
02199     point.y = 0;
02200     ok = (pPath->AddLineTo(point,&flags));
02201     if (!ok) return FALSE;
02202 
02203     p1.x = (2*Rect.lo.x + 6*Rect.hi.x)/8;
02204     p1.y = (5*Rect.lo.y + 3*Rect.hi.y)/8;
02205     p2.x = (6*Rect.lo.x + 2*Rect.hi.x)/8;
02206     p2.y = p1.y;
02207     p3.x = Rect.lo.x;
02208     p3.y = Rect.lo.y;
02209 
02210     ok = (pPath->AddCurveTo(p1,p2,p3,&flags));
02211     if (!ok) return FALSE;
02212     
02213     ok = (pPath->CloseSubPath());
02214 
02215     return ok;
02216 }

BOOL EnvelopeShapes::Circular Path pPath  )  [static]
 

Creates a circular envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/01/94
Parameters:
pPath = a pointer to an empty path (should be initialised but empty) [INPUTS]
pPath = a unit cicular envelope, ready to be scaled to fit the selection. [OUTPUTS]
Returns:
TRUE if the circular envelope manifold has been created FALSE if no memory to create the envelope.

Definition at line 2047 of file moldenv.cpp.

02048 {
02049     ERROR2IF(pPath==NULL,FALSE,"NULL path pointer passed to EnvelopeShapes::Circular()");
02050 
02051     PathFlags flags;
02052     flags.IsSelected = FALSE;
02053     DocRect Rect (0,0,72000,72000);
02054     BOOL ok = MakeEllipse(&Rect, pPath, &flags);
02055 
02056     DocCoord* pCoords = pPath->GetCoordArray();
02057     INT32 numcoords = pPath->GetNumCoords();
02058 
02059     if (ok)
02060     {
02061         Matrix Mat0(-36000,-36000);
02062         Trans2DMatrix Trans0(Mat0);
02063         Trans0.Transform( pCoords, numcoords );
02064 
02065         ANGLE Ang = (ANGLE)(45);
02066         Matrix Mat1(Ang);
02067         Trans2DMatrix Trans1(Mat1);
02068         Trans1.Transform( pCoords, numcoords );
02069 
02070         Matrix Mat2(36000,36000);
02071         Trans2DMatrix Trans2(Mat2);
02072         Trans2.Transform( pCoords, numcoords );
02073     }
02074     else
02075         pPath->ClearPath();
02076 
02077     return ok;
02078 }

BOOL EnvelopeShapes::Concave Path pPath  )  [static]
 

Creates a concave envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/01/94
Parameters:
pPath = a pointer to an empty path (should be initialised but empty) [INPUTS]
pPath = a unit concave envelope, ready to be scaled to fit the selection. [OUTPUTS]
Returns:
TRUE if the concave envelope manifold has been created FALSE if no memory to create the envelope.

Definition at line 2100 of file moldenv.cpp.

02101 {
02102     ERROR2IF(pPath==NULL,FALSE,"NULL path pointer passed to EnvelopeShapes::Concave()");
02103 
02104     PathFlags flags;
02105     flags.IsSelected = FALSE;
02106     BOOL ok;
02107 
02108     DocRect Rect(0,0,72000,72000);
02109     DocCoord p1,p2,p3;
02110 
02111     DocCoord point(0,0);
02112     ok = (pPath->AddMoveTo(point,&flags));
02113     if (!ok) return FALSE;
02114 
02115     p1.x = (5 * Rect.lo.x + 3 * Rect.hi.x)/8;
02116     p1.y = (6 * Rect.lo.y + 2 * Rect.hi.y)/8;
02117     p2.x = p1.x;
02118     p2.y = (2 * Rect.lo.y + 6 * Rect.hi.y)/8;
02119     p3.x = Rect.lo.x;
02120     p3.y = Rect.hi.y;
02121 
02122     ok = (pPath->AddCurveTo(p1,p2,p3,&flags));
02123     if (!ok) return FALSE;
02124 
02125     point.x = 72000;
02126     point.y = 72000;
02127     ok = (pPath->AddLineTo(point,&flags));
02128     if (!ok) return FALSE;
02129 
02130     p1.x = (3*Rect.lo.x + 5*Rect.hi.x)/8;
02131     p1.y = (2*Rect.lo.y + 6*Rect.hi.y)/8;
02132     p2.x = p1.x;
02133     p2.y = (6*Rect.lo.y + 2*Rect.hi.y)/8;
02134     p3.x = Rect.hi.x;
02135     p3.y = Rect.lo.y;
02136 
02137     ok = (pPath->AddCurveTo(p1,p2,p3,&flags));
02138     if (!ok) return FALSE;
02139     
02140     point.x = 0;
02141     point.y = 0;
02142     ok = (pPath->AddLineTo(point,&flags));
02143     if (!ok) return FALSE;
02144 
02145     ok = (pPath->CloseSubPath());
02146 
02147     return ok;
02148 }

BOOL EnvelopeShapes::MakeEllipse DocRect pRect,
Path pPath,
PathFlags pFlags
[static, private]
 

Create an elliptically shaped closed path which is the same size as and has the same position as the rectangle specified.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/01/95
Parameters:
pRect = a pointer to a rectangle to fit the ellipse in [INPUTS] pPath = a pointer to an empty path (should be initialised but empty) pFlags = flags to use for each path control point
[OUTPUTS] 

Definition at line 2236 of file moldenv.cpp.

02237 {
02238     ERROR2IF(pRect==NULL,FALSE,"NULL rectangle pointer passed to EnvelopeShapes::MakeEllipse()");
02239     ERROR2IF(pPath==NULL,FALSE,"NULL path pointer passed to EnvelopeShapes::MakeEllipse()");
02240 
02241     DocCoord p0,p1,p2;
02242     INT32 dx,dy;
02243 
02244     dy = pRect->hi.y - pRect->lo.y;
02245     dx = pRect->hi.x - pRect->lo.x;
02246 
02247     double ratio = 1.0/4.4672;
02248 
02249     p0.x = pRect->lo.x;
02250     p0.y = pRect->lo.y + (INT32)(dy/2);
02251 
02252     BOOL ok = (pPath->AddMoveTo(p0,pFlags));
02253     if (!ok) return FALSE;
02254 
02255     p0.x = 0;
02256     p0.y = pRect->hi.y - (INT32)(dy*ratio);
02257     p1.x = pRect->lo.x + (INT32)(dx*ratio);
02258     p1.y = pRect->hi.y;
02259     p2.x = pRect->lo.x + (INT32)(dx/2);
02260     p2.y = pRect->hi.y;
02261 
02262     ok = (pPath->AddCurveTo(p0,p1,p2,pFlags));
02263     if (!ok) return FALSE;
02264 
02265     p0.x = pRect->hi.x - (INT32)(dx*ratio);
02266     p0.y = pRect->hi.y;
02267     p1.x = pRect->hi.x;
02268     p1.y = pRect->hi.y - (INT32)(dy*ratio);
02269     p2.x = pRect->hi.x;
02270     p2.y = pRect->lo.y + (INT32)(dy/2);
02271 
02272     ok = (pPath->AddCurveTo(p0,p1,p2,pFlags));
02273     if (!ok) return FALSE;
02274 
02275     p0.x = pRect->hi.x;
02276     p0.y = pRect->lo.y + (INT32)(dy*ratio);
02277     p1.x = pRect->hi.x - (INT32)(dx*ratio);
02278     p1.y = pRect->lo.y;
02279     p2.x = pRect->lo.x + (INT32)(dx/2);
02280     p2.y = pRect->lo.y;
02281 
02282     ok = (pPath->AddCurveTo(p0,p1,p2,pFlags));
02283     if (!ok) return FALSE;
02284 
02285     p0.x = pRect->lo.x + (INT32)(dx*ratio);
02286     p0.y = pRect->lo.y;
02287     p1.x = pRect->lo.x;
02288     p1.y = pRect->lo.y + (INT32)(dy*ratio);
02289     p2.x = pRect->lo.x; 
02290     p2.y = pRect->lo.y + (INT32)(dy/2);
02291 
02292     ok = (pPath->AddCurveTo(p0,p1,p2,pFlags));
02293     if (!ok) return FALSE;
02294 
02295     ok = (pPath->CloseSubPath());
02296 
02297     return ok;
02298 }

BOOL EnvelopeShapes::Rectangular Path pPath  )  [static]
 

Creates a rectangular envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/94
Parameters:
pPath = a pointer to an empty path (should be initialised but empty) [INPUTS]
pPath = a unit rectangular envelope, ready to be scaled to fit the selection. [OUTPUTS]
Returns:
TRUE if the rectangular envelope manifold has been created FALSE if no memory to create the envelope.

Definition at line 1927 of file moldenv.cpp.

01928 {
01929     ERROR2IF(pPath==NULL,FALSE,"NULL path pointer passed to EnvelopeShapes::Rectangular()");
01930 
01931     PathFlags flags;
01932     flags.IsSelected = FALSE;
01933 
01934     // Build a default rectangular manifold
01935     DocCoord point(0,0);
01936     BOOL ok = (pPath->AddMoveTo(point,&flags));
01937     if (!ok) return FALSE;
01938 
01939     point.y = 72000;
01940     ok = (pPath->AddCurveTo(point,&flags));
01941     if (!ok) return FALSE;
01942 
01943     point.x = 72000;
01944     ok = (pPath->AddCurveTo(point,&flags));
01945     if (!ok) return FALSE;
01946 
01947     point.y = 0;
01948     ok = (pPath->AddCurveTo(point,&flags));
01949     if (!ok) return FALSE;
01950 
01951     point.x = 0;
01952     ok = (pPath->AddCurveTo(point,&flags));
01953     if (!ok) return FALSE;
01954 
01955     ok = (pPath->CloseSubPath());
01956 
01957     return (ok);
01958 }

BOOL EnvelopeShapes::Rectangular2x2 Path pPath  )  [static]
 

Creates a rectangular envelope. The envelope manifold is defined on a millipoint square coordinate system. ie its outer coorinates are (0,0), (72000,72000). So to scale the envelope perform Coord = (ScaleFactor * Coord / 72000).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/94
Parameters:
pPath = a pointer to an empty path (should be initialised but empty) [INPUTS]
pPath = a unit rectangular envelope, ready to be scaled to fit the selection. [OUTPUTS]
Returns:
TRUE if the rectangular envelope manifold has been created FALSE if no memory to create the envelope.

Definition at line 1979 of file moldenv.cpp.

01980 {
01981     ERROR2IF(pPath==NULL,FALSE,"NULL path pointer passed to EnvelopeShapes::Rectangular()");
01982 
01983     PathFlags flags;
01984     flags.IsSelected = FALSE;
01985 
01986     // Build a default rectangular manifold
01987     DocCoord point(0,0);
01988     BOOL ok = (pPath->AddMoveTo(point,&flags));
01989     if (!ok) return FALSE;
01990 
01991     point.y = 72000/2;
01992     ok = (pPath->AddCurveTo(point,&flags));
01993     if (!ok) return FALSE;
01994 
01995     point.y = 72000;
01996     ok = (pPath->AddCurveTo(point,&flags));
01997     if (!ok) return FALSE;
01998 
01999     point.x = 72000/2;
02000     ok = (pPath->AddCurveTo(point,&flags));
02001     if (!ok) return FALSE;
02002 
02003     point.x = 72000;
02004     ok = (pPath->AddCurveTo(point,&flags));
02005     if (!ok) return FALSE;
02006 
02007     point.y = 72000/2;
02008     ok = (pPath->AddCurveTo(point,&flags));
02009     if (!ok) return FALSE;
02010 
02011     point.y = 0;
02012     ok = (pPath->AddCurveTo(point,&flags));
02013     if (!ok) return FALSE;
02014 
02015     point.x = 72000/2;
02016     ok = (pPath->AddCurveTo(point,&flags));
02017     if (!ok) return FALSE;
02018 
02019     point.x = 0;
02020     ok = (pPath->AddCurveTo(point,&flags));
02021     if (!ok) return FALSE;
02022 
02023     ok = (pPath->CloseSubPath());
02024 
02025     return (ok);
02026 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:58 2007 for Camelot by  doxygen 1.4.4