LinearTranspFillAttribute Class Reference

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

#include <fillval.h>

Inheritance diagram for LinearTranspFillAttribute:

GradTranspFillAttribute TranspFillAttribute FillGeometryAttribute AttributeValue CCObject SimpleCCObject List of all members.

Public Member Functions

 LinearTranspFillAttribute ()
 Default Constuctor for fill attribute values.
virtual NodeAttributeMakeNode ()
 Make a AttrLinearFill node from this graduated fill attribute.
virtual DocCoordGetEndPoint2 ()
virtual void SetEndPoint2 (DocCoord *Pos)
 Sets the End Point of this fill.
virtual DocCoordGetEndPoint3 ()
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 ColourFillAttributeMakeSimilarNonTranspFillGeometry (double TransparencyScale)
 Creates a non-transparent version of this transparent fill attribute. (The original use of this was so airbrushes could maintain their fill's transparency geometry).
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:
23/8/94
See also:
GradFillAttribute

Definition at line 1132 of file fillval.h.


Constructor & Destructor Documentation

LinearTranspFillAttribute::LinearTranspFillAttribute  ) 
 

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 4824 of file fillval.cpp.

04825 {
04826     IsPersp = FALSE;
04827 }


Member Function Documentation

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

Reimplemented from FillGeometryAttribute.

Definition at line 1139 of file fillval.h.

01139 { return &EndPoint2; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 1141 of file fillval.h.

01141 { return &EndPoint3; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 1152 of file fillval.h.

01152 { return(FILLSHAPE_LINEAR); }

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

Reimplemented from FillGeometryAttribute.

Definition at line 1148 of file fillval.h.

01148 { return TRUE; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 1144 of file fillval.h.

01144 { return IsPersp; }

NodeAttribute * LinearTranspFillAttribute::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 4842 of file fillval.cpp.

04843 {
04844     // Create new attribute node
04845     AttrLinearTranspFill *pAttr = new AttrLinearTranspFill;
04846     if (pAttr==NULL)
04847         // error message has already been set by new
04848         return NULL;
04849 
04850     // Copy attribute value into the new node.
04851     pAttr->GetAttributeValue()->SimpleCopy(this);
04852 
04853     // Return the new node
04854     return pAttr;
04855 }

void LinearTranspFillAttribute::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 4912 of file fillval.cpp.

04913 {
04914     IsPersp = TRUE;
04915 
04916     INT32 dx1 = EndPoint.x - StartPoint.x;
04917     INT32 dx2 = EndPoint2.x - StartPoint.x;
04918 
04919     INT32 dy1 = EndPoint.y - StartPoint.y;
04920     INT32 dy2 = EndPoint2.y - StartPoint.y;
04921 
04922     DocCoord Pos3(StartPoint.x + dx1 + dx2, StartPoint.y + dy1 + dy2);
04923     SetEndPoint3(&Pos3);
04924 }

ColourFillAttribute * LinearTranspFillAttribute::MakeSimilarNonTranspFillGeometry double  TransparencyScale  )  [virtual]
 

Creates a non-transparent version of this transparent fill attribute. (The original use of this was so airbrushes could maintain their fill's transparency geometry).

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/02/97
Parameters:
TransparencyScale - Value between 0.0 and 1.0 which denotes by how much [INPUTS] the function will scale the transparency
Returns:
Pointer to the new attribute, or NULL if out of memory, problems, etc.
See also:
TranspFillAttribute::MakeSimilarNonTranspFillGeometry; AttrFlatFill FlatTranspFillAttribute::MakeSimilarNonTranspFillGeometry

Reimplemented from GradTranspFillAttribute.

Definition at line 4962 of file fillval.cpp.

04963 {
04964     UINT32 *pStartTransp = GetStartTransp();
04965     UINT32 *pEndTransp = GetEndTransp();
04966 
04967     if(pStartTransp == NULL || pEndTransp == NULL)
04968         return NULL;
04969     
04970     LinearFillAttribute *pNewAttr = new LinearFillAttribute;    
04971     if (pNewAttr != NULL)
04972     {
04973         pNewAttr->SetStartPoint(GetStartPoint());
04974         pNewAttr->SetEndPoint(GetEndPoint());
04975         pNewAttr->SetEndPoint2(GetEndPoint2());
04976         pNewAttr->SetEndPoint3(GetEndPoint3());
04977 
04978         if(IsPerspective())
04979             pNewAttr->MakePerspective();
04980 
04981         INT32 StartTransparency = 255 - (INT32)(((double)(255 - *pStartTransp)) * TransparencyScale);
04982         INT32 EndTransparency = 255 - (INT32)(((double)(255 - *pEndTransp)) * TransparencyScale);
04983 
04984         DocColour       colorStart(StartTransparency, StartTransparency, StartTransparency);
04985         DocColour       colorEnd1(EndTransparency, EndTransparency, EndTransparency);
04986         pNewAttr->SetStartColour(&colorStart);
04987         pNewAttr->SetEndColour(&colorEnd1);
04988     }
04989 
04990     return(pNewAttr);
04991 }

AttributeValue * LinearTranspFillAttribute::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 5025 of file fillval.cpp.

05026 {
05027 // Taken out of WEBSTER Neville 6/8/97
05028 // Taken out by vector stroking code Neville 2/10/97
05029 #ifdef VECTOR_STROKING
05030     if (pMoulder == NULL)
05031         return(NULL);
05032 
05033     FillGeometryAttribute *pCopy = (FillGeometryAttribute *) GetRuntimeClass()->CreateObject();
05034     if (pCopy != NULL)
05035     {
05036         // Copy this object's values across
05037         *pCopy = *this;
05038 
05039         // And mould all of the geometry points across
05040         JCW_MOULDPOINT(pCopy, StartPoint);
05041         JCW_MOULDPOINT(pCopy, EndPoint);
05042 
05043         if (IsPerspective())
05044         {
05045             // If it's perspectivised, just map all the points and hope for the best
05046             JCW_MOULDPOINT(pCopy, EndPoint2);
05047             JCW_MOULDPOINT(pCopy, EndPoint3);
05048         }
05049         else
05050         {
05051             // Otherwise, we have mapped the start/end points, and we pass NULL in for
05052             // the remaining points so that they are re-generated to get the fill going
05053             // in the start->end direction (because the fill direction is not controlled
05054             // by the start->end line, but by the end->end2 line)
05055             pCopy->SetEndPoint2(NULL);
05056             pCopy->SetEndPoint3(NULL);
05057         }
05058 
05059         ERROR3IF(TransScale < 0.0 || TransScale > 1.0, "Out of range TransScale parameter");
05060         if (TransScale >= 0.0 && TransScale < 1.0)
05061         {
05062             JCW_MOULDTRANS(pCopy, StartTransp);
05063             JCW_MOULDTRANS(pCopy, EndTransp);
05064         }
05065     }
05066     return(pCopy);
05067 
05068 #else
05069     return NULL;
05070 #endif // VECTOR_STROKING
05071 }

void LinearTranspFillAttribute::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 4937 of file fillval.cpp.

04938 {
04939     IsPersp = FALSE;
04940 }

void LinearTranspFillAttribute::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 4868 of file fillval.cpp.

04869 {
04870     if (Pos == NULL)
04871     {
04872         EndPoint2 = MakeLineAtAngle(StartPoint, EndPoint, 90);
04873     }
04874     else
04875         EndPoint2 = *Pos;
04876 }

void LinearTranspFillAttribute::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 4890 of file fillval.cpp.

04891 {
04892     if (Pos == NULL)
04893         EndPoint3 = MakeLineAtAngle(*GetEndPoint(), *GetEndPoint2(), 90);
04894     else
04895         EndPoint3 = *Pos;
04896 }


Member Data Documentation

DocCoord LinearTranspFillAttribute::EndPoint2
 

Definition at line 1160 of file fillval.h.

DocCoord LinearTranspFillAttribute::EndPoint3
 

Definition at line 1161 of file fillval.h.

BOOL LinearTranspFillAttribute::IsPersp
 

Definition at line 1163 of file fillval.h.


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