AttrLinearFill Class Reference

Linear Graduated Fill Attribute class. More...

#include <fillattr2.h>

Inheritance diagram for AttrLinearFill:

AttrFillGeometry NodeAttribute NodeRenderable Node CCObject SimpleCCObject AttrLinearColourFill AttrLinearTranspFill List of all members.

Public Member Functions

 AttrLinearFill ()
 AttrLinearFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
virtual void Transform (TransformBase &)
 Transform a grad fill attribute by moving the start and end points.
virtual BOOL CanTransform ()
 Indicate that this attribute can be transformed.
virtual void RenderFillBlobs (RenderRegion *pRender)
virtual void RenderFillMesh (RenderRegion *, DocCoord *, BOOL *, INT32 NumControlPoints=0)
virtual AttributeValueGetAttributeValue ()=0
virtual FillControl TestColourDrop (AttrColourDrop *)
 Check to see which colour will be changed if dropped at this point.
virtual AttrFillGeometryDoColourDrop (AttrColourDrop *ColDrop)
 Changes the colour of a fill + does the colour ramps too.
virtual BOOL IsAGradFill () const
 Virtual function for determining if the node is an attribute.
virtual FillControl CheckForControlHit (DocCoord &ClickPos)
 Check to see if a click was on a Fill Control Point.
virtual BOOL ChangeControlColour (DocColour &Col, FillControl Cntrl, AttrColourDrop *pColDrop=NULL)
 Applies a colour to a specific Fill Control Point.
virtual BOOL NeedsToRenderAtEachBrushStroke () const
 So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.
virtual INT32 GetNumberOfControlPoints ()
virtual void TransformTranslateObject (const ExtendParams &ExtParams)
 Override of AttrFillGeometry::TransformTranslateObject(). See that method for more info.

Protected Member Functions

virtual void ValidateAttributeValue ()
 Makes sure the Coords of the Fill are sensible.

Detailed Description

Linear Graduated Fill Attribute class.

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

Definition at line 693 of file fillattr2.h.


Constructor & Destructor Documentation

AttrLinearFill::AttrLinearFill  )  [inline]
 

Definition at line 698 of file fillattr2.h.

00698 : AttrFillGeometry() {}

AttrLinearFill::AttrLinearFill Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
[inline]
 

Definition at line 699 of file fillattr2.h.

00704                                      : 
00705         AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}


Member Function Documentation

BOOL AttrLinearFill::CanTransform  )  [virtual]
 

Indicate that this attribute can be transformed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Returns:
TRUE => transform this attribute.
See also:
NodeRenderable::CanTransform

Reimplemented from NodeRenderable.

Definition at line 6250 of file fillattr.cpp.

06251 {
06252     return TRUE;
06253 }

BOOL AttrLinearFill::ChangeControlColour DocColour Col,
FillControl  Cntrl,
AttrColourDrop pColDrop = NULL
[virtual]
 

Applies a colour to a specific Fill Control Point.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/2/95

Reimplemented from AttrFillGeometry.

Definition at line 6302 of file fillattr.cpp.

06304 {
06305     return AttrFillGeometry::ChangeControlColour(Col, Cntrl, pColDrop);
06306     
06307 }

FillControl AttrLinearFill::CheckForControlHit DocCoord ClickPos  )  [virtual]
 

Check to see if a click was on a Fill Control Point.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/99
Parameters:
ClickPos,The DocCoord position to check. [INPUTS]
Returns:
A FillControl, indicating the Fill Control Point Hit, or FILLCONTROL_NULL, if no points hit.
See also:
FillControl

Reimplemented from AttrFillGeometry.

Definition at line 6269 of file fillattr.cpp.

06270 {
06271     return AttrFillGeometry::CheckForControlHit(ClickPos);
06272     
06273 }

AttrFillGeometry * AttrLinearFill::DoColourDrop AttrColourDrop ColDrop  )  [virtual]
 

Changes the colour of a fill + does the colour ramps too.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/94
Parameters:
The fill that is to be changed. [INPUTS]

Reimplemented from AttrFillGeometry.

Definition at line 6286 of file fillattr.cpp.

06287 { 
06288     return AttrFillGeometry::DoColourDrop(ColDrop);
06289 }

virtual AttributeValue* AttrLinearFill::GetAttributeValue  )  [pure virtual]
 

Implements AttrFillGeometry.

Implemented in AttrLinearColourFill, and AttrLinearTranspFill.

virtual INT32 AttrLinearFill::GetNumberOfControlPoints  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 729 of file fillattr2.h.

00729 { return 2; }

virtual BOOL AttrLinearFill::IsAGradFill  )  const [inline, virtual]
 

Virtual function for determining if the node is an attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/2/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node is a NodeAttribute, will return TRUE

Errors:

Reimplemented from NodeAttribute.

Definition at line 719 of file fillattr2.h.

00719 { return TRUE; } 

virtual BOOL AttrLinearFill::NeedsToRenderAtEachBrushStroke  )  const [inline, virtual]
 

So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this attribute should be rendered at every step of a brush stroke

Errors: See Also; Brush code (ndbrshmk.cpp)

Reimplemented from NodeAttribute.

Definition at line 725 of file fillattr2.h.

00725 { return TRUE;}

virtual void AttrLinearFill::RenderFillBlobs RenderRegion pRender  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Reimplemented in AttrLinearColourFill, and AttrLinearTranspFill.

Definition at line 711 of file fillattr2.h.

00711 {}

void AttrLinearFill::RenderFillMesh RenderRegion ,
DocCoord ,
BOOL *  ,
INT32  NumControlPoints = 0
[virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 6329 of file fillattr.cpp.

06332 {
06333 #if !defined(EXCLUDE_FROM_RALPH)
06334     if (AllowRampRedraw == FALSE)
06335     {
06336         FillRamp *pRamp = GetFillRamp();
06337         if (pRamp)
06338         {
06339             pRamp->RenderSelectedBlob (ATTRVALUE(), pRender);
06340         }
06341         
06342         return;
06343     }
06344     
06345     DocCoord Start = ControlPoints[FILLCONTROL_STARTPOINT];
06346     DocCoord End   = ControlPoints[FILLCONTROL_ENDPOINT];
06347 
06348     if (Start == End)
06349         return;
06350 
06351     if (SelState == NULL)
06352     {
06353         // If no selection state passed in, then assume
06354         // all the points are deselected
06355         BOOL Selected[NUMCONTROLPOINTS];
06356         for (INT32 i=0; i< NumControlPoints; i++)
06357         {
06358             Selected[i] = FALSE;
06359         }
06360         SelState = Selected;
06361     }
06362 
06363     // Remember what attributes were here before
06364     pRender->SaveContext();
06365 
06366     // Get the current blob size in Doc Units
06367     INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
06368 
06369     // Calculate the Arrow on the End of the Line
06370     Path ArrowPath;
06371     ArrowPath.Initialise();
06372     DocCoord LineEnd;
06373     MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
06374     // This will have also calculated a point for us to draw
06375     // the line to, so we don't try and draw though the arrow head.
06376 
06377     // Set the line colours etc as we need them
06378     pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
06379     pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
06380 
06381     // First Draw a Line from the Start Point to the End point,
06382     // minus a bit to allow for the Arrow head on the end.
06383     pRender->SetLineWidth(BlobSize/4);
06384     pRender->DrawLine(Start, LineEnd);
06385 
06386     // Render an Arrow at the end of the line
06387     pRender->SetLineWidth(0);
06388     pRender->SetLineColour(COLOUR_NONE);
06389     pRender->DrawPath(&ArrowPath);
06390 
06391     // Now Render the blobs on the path
06392 
06393     // Draw a blob at the start point
06394     if (SelState[FILLCONTROL_STARTPOINT])
06395     {
06396         // Draw Selected Blob
06397 //      pRender->SetLineColour(COLOUR_SELECTEDBLOB);
06398         pRender->SetLineColour(COLOUR_NONE);
06399         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
06400         pRender->DrawBlob(Start, BT_SELECTED);
06401     }
06402     else
06403     {
06404         // Draw Unselected Blob
06405 //      pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
06406         pRender->SetLineColour(COLOUR_NONE);
06407         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
06408         pRender->DrawBlob(Start, BT_UNSELECTED);
06409     }
06410 
06411     // Draw a blob at the end point
06412     if (SelState[FILLCONTROL_ENDPOINT])
06413     {
06414         // Draw Selected Blob
06415         pRender->SetLineColour(COLOUR_SELECTEDBLOB);
06416         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
06417         pRender->DrawBlob(End, BT_SELECTED);
06418     }
06419     else
06420     {
06421         // Draw Unselected Blob
06422 //      pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
06423         pRender->SetLineColour(COLOUR_NONE);
06424         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
06425         pRender->DrawBlob(End, BT_UNSELECTED);
06426     }
06427 
06428     // now render any ramp blobs
06429     FillRamp *pRamp = GetFillRamp();
06430     if (pRamp)
06431     {
06432         pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL);
06433     }
06434 
06435     // Put all the old attributes back
06436     pRender->RestoreContext();
06437 #endif
06438 }

FillControl AttrLinearFill::TestColourDrop AttrColourDrop ColDrop  )  [virtual]
 

Check to see which colour will be changed if dropped at this point.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/2/95

Reimplemented from AttrFillGeometry.

Definition at line 5336 of file fillattr.cpp.

05337 { 
05338 #if !defined(EXCLUDE_FROM_RALPH)
05339     // So, where was it dropped (or where will it be dropped)
05340     DocCoord DropPoint = ColDrop->GetDropPoint();
05341 
05342     // Look to see if the DropPoint is over any of the Fill Control Points
05343     FillControl ControlHit = CheckForControlHit(DropPoint);
05344     
05345     // If it hit one of our control points, then use that
05346     if (ControlHit != FILLCONTROL_NULL)
05347         return ControlHit;
05348 
05349     // It didn't hit any of our control points, so if the drop is over
05350     // the object then we'll make a guess as to which control point
05351     // the user would like to change, depending on which area of the
05352     // object the pointer is over.
05353 
05354     // First make sure we're actually over an object
05355     NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
05356     if (pParentObject == NULL)
05357         return FILLCONTROL_NULL;    // We're not over any object 
05358 
05359     // Make sure this fill type has some Control Points
05360     if (GetStartPoint() == NULL || GetEndPoint() == NULL)
05361         return FILLCONTROL_NULL;
05362 
05363     DocCoord StartPoint = *GetStartPoint();
05364     DocCoord EndPoint   = *GetEndPoint();
05365         
05366     // Find the MidPoint of the line joining the Start and End Points
05367     DocCoord MidPoint = DocCoord(StartPoint.x + (EndPoint.x - StartPoint.x)/2,
05368                                 StartPoint.y + (EndPoint.y - StartPoint.y)/2);
05369 
05370     TRACEUSER( "Mike", _T("DropPoint (before)   = %d,%d\n"),DropPoint.x, DropPoint.y);
05371 
05372     TRACEUSER( "Mike", _T("StartPoint           = %d,%d\n"),StartPoint.x, StartPoint.y);
05373     TRACEUSER( "Mike", _T("MidPoint             = %d,%d\n"),MidPoint.x, MidPoint.y);
05374     TRACEUSER( "Mike", _T("EndPoint             = %d,%d\n"),EndPoint.x, EndPoint.y);
05375 
05376     // Now find the angle of the line relative to the Horizontal
05377     ANGLE LineAngle = CalcLineAngle(MidPoint, EndPoint) - 90;
05378     Matrix Rotate   = Matrix(-LineAngle);
05379 
05380     // Rotate the Drop Point around the MidPoint of the line
05381     DropPoint.translate(-MidPoint.x, -MidPoint.y);
05382     Rotate.transform(&DropPoint);
05383     DropPoint.translate(MidPoint.x, MidPoint.y);
05384 
05385     TRACEUSER( "Mike", _T("DropPoint (after)    = %d,%d\n"),DropPoint.x, DropPoint.y);
05386 
05387     // Now the Coords have be transformed as if the Line was Horizontal,
05388     // so all we need to do is check to see if the Drop Point is to the
05389     // left or right of the MidPoint.
05390 
05391     if (DropPoint.x <= MidPoint.x)
05392         ControlHit = FILLCONTROL_STARTPOINT;        
05393     else
05394         ControlHit = FILLCONTROL_ENDPOINT;      
05395 
05396     return ControlHit;
05397 #else
05398     return FILLCONTROL_NULL;
05399 #endif
05400 }

void AttrLinearFill::Transform TransformBase Trans  )  [virtual]
 

Transform a grad fill attribute by moving the start and end points.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Parameters:
Trans - the transform object to apply to this attribute. [INPUTS]
See also:
NodeRenderable::Transform

Reimplemented from NodeRenderable.

Definition at line 6225 of file fillattr.cpp.

06226 {
06227     if ( Trans.TransFills )
06228     {
06229         Trans.Transform( GetStartPoint(), 1);
06230         Trans.Transform( GetEndPoint(), 1);
06231         Trans.Transform( GetEndPoint2(), 1);
06232 
06233         if (IsPerspective())
06234             Trans.Transform( GetEndPoint3(), 1);
06235     }
06236 }

void AttrLinearFill::TransformTranslateObject const ExtendParams ExtParams  )  [virtual]
 

Override of AttrFillGeometry::TransformTranslateObject(). See that method for more info.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/11/2000
See also: AttrFillGeometry::TransformTranslateObject()

Reimplemented from AttrFillGeometry.

Definition at line 20037 of file fillattr.cpp.

20038 {
20039     // call our base class to do the major extending stuff.
20040     AttrFillGeometry::TransformTranslateObject(ExtParams);
20041 
20042     // ok, after the extend, our third control point is a bit skew-wiff,
20043     // so we need to wack it back in line - done by this (deceptively) simple call.
20044     SetEndPoint2(NULL);
20045 }

void AttrLinearFill::ValidateAttributeValue  )  [protected, virtual]
 

Makes sure the Coords of the Fill are sensible.

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

Reimplemented from AttrFillGeometry.

Definition at line 6545 of file fillattr.cpp.

06546 {
06547 #if !defined(EXCLUDE_FROM_RALPH)
06548     if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
06549         return;
06550 
06551     // Make some defaults
06552     DocRect AttrBounds = DocRect(0,0,0,0);
06553 
06554     INT32 Width  = DEFAULT_FILLWIDTH;
06555     INT32 Height = DEFAULT_FILLHEIGHT;
06556 
06557     // Are we an Orphan ?
06558     if (FindParent() != NULL)
06559     {
06560         // Nope, so we can use Daddies Bounding Box
06561         SelRange* Selected = GetApplication()->FindSelection();
06562                  
06563         if (Selected == NULL || Selected->Count() <= 1)
06564             AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
06565         else
06566             AttrBounds = Selected->GetBoundingRect();
06567 
06568         Width  = AttrBounds.Width();
06569         Height = AttrBounds.Height();
06570     }
06571 
06572     // If the StartPoint is 'NULL' then make all points sensible
06573     if ((*GetStartPoint()) == DocCoord(0,0))
06574     {
06575         // Start in the middle
06576         DocCoord temp = CentreOf(AttrBounds); 
06577         SetStartPoint(&temp);
06578 
06579         // End on the Middle Right
06580         temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
06581         SetEndPoint(&temp);
06582     }
06583 
06584     // If the EndPoint is 'NULL' then make end points sensible
06585     if ((*GetEndPoint()) == DocCoord(0,0))
06586     {
06587         DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
06588         SetEndPoint(&temp);
06589     }
06590 
06591     if ((*GetEndPoint2()) == DocCoord(0,0))
06592     {
06593         DocCoord temp = MakeLineAtAngle(*GetStartPoint(), *GetEndPoint(), 90);
06594         SetEndPoint2(&temp);
06595     }
06596 #endif
06597 }


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