StrokeTranspAttribute Class Reference

Represent the transparency of a stroke, as opposed to a fill. Implementation is very similar (identical!) to the FillTranspAttribute class. More...

#include <fillval.h>

Inheritance diagram for StrokeTranspAttribute:

TranspFillAttribute FillGeometryAttribute AttributeValue CCObject SimpleCCObject List of all members.

Public Member Functions

 StrokeTranspAttribute ()
 StrokeTranspAttribute (UINT32 NewTransp)
 Sets the line transparency for this attribute.
virtual NodeAttributeMakeNode ()
 Make a AttrStrokeTransp node from this fill colour attribute.
virtual void Restore (RenderRegion *, BOOL)
 Restores the line colour attribute for the given render region. i.e. all lines drawn will now be drawn in this colour.
virtual void Render (RenderRegion *, BOOL Temp=FALSE)
 Sets the line colour attribute for the given render region. i.e. all lines drawn will now be drawn in this colour.
virtual void SimpleCopy (AttributeValue *)
 See AttributeValue::SimpleCopy.
BOOL Blend (BlendAttrParam *)
 Blends between two fill attributes. This is a general blend function for all fill attributes. It will blend between any types of fill, but will always use the 'type' of the first fill, taking control points, colours, and transparency from the end fill if it can.

Static Public Member Functions

static BOOL Init ()
 Registers line colour attribute, and provides a default attribute to give black lines.

Detailed Description

Represent the transparency of a stroke, as opposed to a fill. Implementation is very similar (identical!) to the FillTranspAttribute class.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/94
See also:
AttributeValue

Definition at line 1888 of file fillval.h.


Constructor & Destructor Documentation

StrokeTranspAttribute::StrokeTranspAttribute  )  [inline]
 

Definition at line 1892 of file fillval.h.

01892 {}

StrokeTranspAttribute::StrokeTranspAttribute UINT32  NewTransp  ) 
 

Sets the line transparency for this attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/02/94
Parameters:
NewTransp - the new stroke transparency [INPUTS]

Definition at line 8724 of file fillval.cpp.

08725 {
08726     SetStartTransp(&NewTransp);
08727 }


Member Function Documentation

BOOL StrokeTranspAttribute::Blend BlendAttrParam pBlendParam  )  [virtual]
 

Blends between two fill attributes. This is a general blend function for all fill attributes. It will blend between any types of fill, but will always use the 'type' of the first fill, taking control points, colours, and transparency from the end fill if it can.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/94
Returns:
TRUE - Blend went ok, the blended attr val is valid; FALSE if not.

Errors: Out of memory.

See also:
FillGeometryAttribute::BlendFillColours; FillGeometryAttribute::BlendFillTransp; FillGeometryAttribute::BlendControlPoints; FlatFillAttribute::Blend; GradFillAttribute::Blend

Reimplemented from FillGeometryAttribute.

Definition at line 9841 of file fillval.cpp.

09842 {
09843     // First make a new object of the same type as this one
09844     CCRuntimeClass* ObjectType = GetRuntimeClass();
09845     FillGeometryAttribute* pNewAttr = (FillGeometryAttribute*)ObjectType->CreateObject();
09846 
09847     if (pNewAttr == NULL)
09848     {
09849         // Fail if we couldn't create the new fill
09850         pBlendParam->SetBlendedAttrVal(NULL);
09851         return FALSE;
09852     }
09853 
09854     // Make the new fill an exact copy of this one
09855     pNewAttr->SimpleCopy(this);
09856 
09857     // Now get the fill that we are blending to
09858     FillGeometryAttribute* OtherFill = 
09859                 (FillGeometryAttribute*)pBlendParam->GetOtherAttrVal();
09860 
09861     // and what point along the blend we are at
09862     double Ratio = pBlendParam->GetBlendRatio();
09863 
09864     // Look at the Start and Attribute maps to see if either end
09865     // is no colour
09866     CCAttrMap* pAttrMapStart = pBlendParam->GetStartAttrMap();
09867     CCAttrMap* pAttrMapEnd = pBlendParam->GetEndAttrMap();
09868 
09869     CCRuntimeClass     *pType;
09870     void               *pVal = NULL;
09871 
09872     // We're looking for Stroke Colour Attributes
09873     pType = CC_RUNTIME_CLASS(AttrStrokeColour);
09874 
09875     // Lookup the Start Line Colour
09876     pAttrMapStart->Lookup( pType, pVal );
09877     if (pVal == NULL)
09878         return FALSE;
09879 
09880     AttrStrokeColour * pStartColour = (AttrStrokeColour *)pVal;
09881     StrokeColourAttribute * pColourAttr = &(pStartColour->Value);
09882 
09883     BOOL StartIsNoColour = pColourAttr->Colour.IsTransparent();
09884 
09885     pVal = NULL;
09886 
09887     // Lookup the End Line Colour
09888     pAttrMapEnd->Lookup(pType,pVal);
09889     if (pVal == NULL)
09890         return FALSE;
09891 
09892     AttrStrokeColour * pEndColour = (AttrStrokeColour *)pVal;
09893     pColourAttr = &(pEndColour->Value);
09894 
09895     BOOL EndIsNoColour = pColourAttr->Colour.IsTransparent();
09896 
09897     // Blend the Start and End Transparencies
09898     UINT32 BlendTransp, BlendStartTransp, BlendEndTransp;
09899 
09900     // If either end if 'No Colour' then treat it as 100% transparent
09901     BlendStartTransp    = (StartIsNoColour && !EndIsNoColour) ? 255 : *GetStartTransp();
09902     BlendEndTransp      = (EndIsNoColour && !StartIsNoColour) ? 255 : *OtherFill->GetStartTransp();
09903 
09904     if (BlendFillTransp(&BlendStartTransp, &BlendEndTransp, &BlendTransp, Ratio, pBlendParam))
09905         pNewAttr->SetStartTransp(&BlendTransp);
09906 
09907     // Set the new fill as the blended attribute
09908     pBlendParam->SetBlendedAttrVal(pNewAttr);
09909     
09910     return TRUE;
09911 }

BOOL StrokeTranspAttribute::Init void   )  [static]
 

Registers line colour attribute, and provides a default attribute to give black lines.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/04/94
Returns:
TRUE - initialised ok; FALSE if not.

Errors: Out of memory.

See also:
AttributeManager

Reimplemented from TranspFillAttribute.

Definition at line 8830 of file fillval.cpp.

08831 {
08832     // Default to black lines
08833     StrokeTranspAttribute *pAttr = new StrokeTranspAttribute;
08834     if (pAttr == NULL)
08835         return FALSE;
08836 
08837     pAttr->Transp = 0;
08838     UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(NodeRenderableInk), 
08839                                                          pAttr);
08840     ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising StrokeTranspAttribute");
08841     ERROR2IF(ID != ATTR_STROKETRANSP, FALSE, "Incorrect ID for StrokeTranspAttribute");
08842 
08843     return TRUE;
08844 }

NodeAttribute * StrokeTranspAttribute::MakeNode  )  [virtual]
 

Make a AttrStrokeTransp node from this fill colour attribute.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/04/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 8784 of file fillval.cpp.

08785 {
08786     // Create new attribute node
08787     AttrStrokeTransp *pAttr = new AttrStrokeTransp();
08788 
08789     // Copy attribute value into the new node.
08790     pAttr->Value.SimpleCopy(this);
08791 
08792     // Return the new node
08793     return pAttr;
08794 }

void StrokeTranspAttribute::Render RenderRegion pRegion,
BOOL  Temp = FALSE
[virtual]
 

Sets the line colour attribute for the given render region. i.e. all lines drawn will now be drawn in this colour.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/94
Parameters:
pRegion - the render region to render this attribute into. [INPUTS]
See also:
StrokeTranspAttribute; RenderStack; AttributeValue; NodeAttribute; StrokeTranspAttribute::Restore; StrokeTranspAttribute::SimpleCopy; AttributeValue::Render; AttributeValue::Restore; AttributeValue::SimpleCopy

Reimplemented from TranspFillAttribute.

Definition at line 8744 of file fillval.cpp.

08745 {
08746     pRegion->SetLineTransp(this, Temp);
08747 }

void StrokeTranspAttribute::Restore RenderRegion pRegion,
BOOL  Temp
[virtual]
 

Restores the line colour attribute for the given render region. i.e. all lines drawn will now be drawn in this colour.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/02/94
Parameters:
pRegion - the render region to restore the attribute into. [INPUTS] Temp - TRUE if this is a temporary attribute, FALSE if it is permanent (e.g. it's in a document tree).
See also:
StrokeTranspAttribute; RenderStack; AttributeValue; NodeAttribute; StrokeTranspAttribute::Render; StrokeTranspAttribute::SimpleCopy; AttributeValue::Render; AttributeValue::Restore; AttributeValue::SimpleCopy

Reimplemented from TranspFillAttribute.

Definition at line 8766 of file fillval.cpp.

08767 {
08768     pRegion->RestoreLineTransp(this, Temp);
08769 }

void StrokeTranspAttribute::SimpleCopy AttributeValue pValue  )  [virtual]
 

See AttributeValue::SimpleCopy.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/02/94
Parameters:
pAttr - pointer to the AttributeValue to copy. [INPUTS]
See also:
FillColourAttribute; RenderStack; AttributeValue; NodeAttribute; FillColourAttribute::Render; FillColourAttribute::Restore; AttributeValue::Render; AttributeValue::Restore; AttributeValue::SimpleCopy

Reimplemented from FillGeometryAttribute.

Definition at line 8810 of file fillval.cpp.

08811 {
08812     Transp = ((StrokeTranspAttribute *) pValue)->Transp;
08813     TranspType = ((StrokeTranspAttribute *) pValue)->TranspType;
08814 }


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