LinearFillAttribute Class Reference

Specifies a linear graduated fill for an object, including the start and end points. More...

#include <fillval.h>

Inheritance diagram for LinearFillAttribute:

GradFillAttribute ColourFillAttribute FillGeometryAttribute AttributeValue CCObject SimpleCCObject List of all members.

Public Member Functions

 LinearFillAttribute ()
 Default Constuctor for fill attribute values.
virtual NodeAttributeMakeNode ()
 Make a AttrLinearFill node from this graduated fill attribute.
virtual DocCoordGetEndPoint2 ()
virtual DocCoordGetEndPoint3 ()
virtual void SetEndPoint2 (DocCoord *Pos)
 Sets the End Point of this fill.
virtual void SetEndPoint3 (DocCoord *Pos)
 Sets the End Point of this fill.
virtual BOOL IsPerspective ()
virtual void MakePerspective ()
 Make the fill perspectived. This should be called just before it is transformed by the moulder, so it can validate the 4th control point.
virtual void RemovePerspective ()
 Removes perspective from this fill.
virtual BOOL IsALinearFill ()
virtual INT32 GetGeometryShape ()
virtual AttributeValueMouldIntoStroke (PathStrokerVector *pMoulder, double TransScale=1.0)
 Helper function for the PathStrokerVector class, which "moulds" clipart subtrees to lie along an arbitrary path.

Public Attributes

DocCoord EndPoint2
DocCoord EndPoint3
BOOL IsPersp

Detailed Description

Specifies a linear graduated fill for an object, including the start and end points.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/07/94
See also:
GradFillAttribute

Definition at line 503 of file fillval.h.


Constructor & Destructor Documentation

LinearFillAttribute::LinearFillAttribute  ) 
 

Default Constuctor for fill attribute values.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/94
See also:
AttrFillGeometry::AttrFillGeometry

Definition at line 1441 of file fillval.cpp.

01442 {
01443     IsPersp = FALSE;
01444 }


Member Function Documentation

virtual DocCoord* LinearFillAttribute::GetEndPoint2  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 511 of file fillval.h.

00511 { return &EndPoint2; }

virtual DocCoord* LinearFillAttribute::GetEndPoint3  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 512 of file fillval.h.

00512 { return &EndPoint3; }

virtual INT32 LinearFillAttribute::GetGeometryShape  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 521 of file fillval.h.

00521 { return(FILLSHAPE_LINEAR); }

virtual BOOL LinearFillAttribute::IsALinearFill  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 520 of file fillval.h.

00520 { return TRUE; }

virtual BOOL LinearFillAttribute::IsPerspective  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 516 of file fillval.h.

00516 { return IsPersp; }

NodeAttribute * LinearFillAttribute::MakeNode  )  [virtual]
 

Make a AttrLinearFill node from this graduated fill attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Returns:
Pointer to the new node, or NULL if out of memory.

Errors: Out of memory

See also:
AttributeValue::MakeNode

Reimplemented from AttributeValue.

Definition at line 1459 of file fillval.cpp.

01460 {
01461     // Create new attribute node
01462     AttrLinearFill *pAttr = new AttrLinearColourFill;
01463     if (pAttr==NULL)
01464         // error message has already been set by new
01465         return NULL;
01466 
01467     // Copy attribute value into the new node.
01468     pAttr->GetAttributeValue()->SimpleCopy(this);
01469 
01470     // Return the new node
01471     return pAttr;
01472 }

void LinearFillAttribute::MakePerspective  )  [virtual]
 

Make the fill perspectived. This should be called just before it is transformed by the moulder, so it can validate the 4th control point.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/4/95
Parameters:
- [INPUTS]

Reimplemented from FillGeometryAttribute.

Definition at line 1532 of file fillval.cpp.

01533 {
01534     IsPersp = TRUE;
01535 
01536     INT32 dx1 = EndPoint.x - StartPoint.x;
01537     INT32 dx2 = EndPoint2.x - StartPoint.x;
01538 
01539     INT32 dy1 = EndPoint.y - StartPoint.y;
01540     INT32 dy2 = EndPoint2.y - StartPoint.y;
01541 
01542     DocCoord Pos3(StartPoint.x + dx1 + dx2, StartPoint.y + dy1 + dy2);
01543     SetEndPoint3(&Pos3);
01544 }

AttributeValue * LinearFillAttribute::MouldIntoStroke PathStrokerVector pMoulder,
double  TransScale = 1.0
[virtual]
 

Helper function for the PathStrokerVector class, which "moulds" clipart subtrees to lie along an arbitrary path.

Parameters:
pMoulder - A PathStrokerVector which knows how to translate points to "mould" them [INPUTS] (May be NULL, in which case moulding of points does not occur)
TransScale - A fraction between 0.0 and 1.0, by which any transparency values in this geometry will be scaled, allowing the caller to effectively apply a flat transparency level to everything that is moulded. Use 1.0 to leave transparency unaltered.

Returns:
NULL if the original attribute can be used, else A pointer to a copy of this object, suitably moulded and adjusted for the transparency scaling. The caller must delete the copy when finished with it.
This function is called to mould fill geometries, so that fill endpoints are translated to appropriate positions in the destination envelope, and allows the caller to effectively apply a flat transparency by scaling any transparency values in this geometry by the given fraction.

Reimplemented from FillGeometryAttribute.

Definition at line 1594 of file fillval.cpp.

01595 {
01596 // Taken out of WEBSTER Neville 6/8/97
01597 // Taken out by vector stroking code Neville 2/10/97
01598 #ifdef VECTOR_STROKING
01599     if (pMoulder == NULL)
01600         return(NULL);
01601 
01602     FillGeometryAttribute *pCopy = (FillGeometryAttribute *) GetRuntimeClass()->CreateObject();
01603     if (pCopy != NULL)
01604     {
01605         // Copy this object's values across
01606         *pCopy = *this;
01607 
01608         // And mould all of the geometry points across
01609         JCW_MOULDPOINT(pCopy, StartPoint);
01610         JCW_MOULDPOINT(pCopy, EndPoint);
01611 
01612         if (IsPerspective())
01613         {
01614             // If it's perspectivised, just map all the points and hope for the best
01615             JCW_MOULDPOINT(pCopy, EndPoint2);
01616             JCW_MOULDPOINT(pCopy, EndPoint3);
01617         }
01618         else
01619         {
01620             // Otherwise, we have mapped the start/end points, and we pass NULL in for
01621             // the remaining points so that they are re-generated to get the fill going
01622             // in the start->end direction (because the fill direction is not controlled
01623             // by the start->end line, but by the end->end2 line)
01624             pCopy->SetEndPoint2(NULL);
01625             pCopy->SetEndPoint3(NULL);
01626         }
01627     }
01628     return(pCopy);
01629 #else
01630     return NULL;
01631 #endif // VECTOR_STROKING
01632 }

void LinearFillAttribute::RemovePerspective  )  [virtual]
 

Removes perspective from this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/4/95
Parameters:
- [INPUTS]

Reimplemented from FillGeometryAttribute.

Definition at line 1557 of file fillval.cpp.

01558 {
01559     IsPersp = FALSE;
01560 }

void LinearFillAttribute::SetEndPoint2 DocCoord Pos  )  [virtual]
 

Sets the End Point of this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/94
Parameters:
- [INPUTS]

Reimplemented from FillGeometryAttribute.

Definition at line 1486 of file fillval.cpp.

01487 {
01488     if (Pos == NULL)
01489     {
01490         EndPoint2 = MakeLineAtAngle(StartPoint, EndPoint, 90);
01491     }
01492     else
01493     {
01494         EndPoint2 = *Pos;
01495     }
01496 }

void LinearFillAttribute::SetEndPoint3 DocCoord Pos  )  [virtual]
 

Sets the End Point of this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/94
Parameters:
- [INPUTS]

Reimplemented from FillGeometryAttribute.

Definition at line 1510 of file fillval.cpp.

01511 {
01512     if (Pos == NULL)
01513         EndPoint3 = MakeLineAtAngle(*GetEndPoint(), *GetEndPoint2(), 90);
01514     else
01515         EndPoint3 = *Pos;
01516 }


Member Data Documentation

DocCoord LinearFillAttribute::EndPoint2
 

Definition at line 529 of file fillval.h.

DocCoord LinearFillAttribute::EndPoint3
 

Definition at line 530 of file fillval.h.

BOOL LinearFillAttribute::IsPersp
 

Definition at line 532 of file fillval.h.


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