FillGeometryAttribute Class Reference

The base class for a fill geometry attribute, such as flat, linear, radial, conical, etc. This provides the basic interface for fill rendering. More...

#include <fillval.h>

Inheritance diagram for FillGeometryAttribute:

AttributeValue CCObject SimpleCCObject ColourFillAttribute TranspFillAttribute FlatFillAttribute GradFillAttribute StrokeColourAttribute FlatTranspFillAttribute GradTranspFillAttribute StrokeTranspAttribute BitmapFillAttribute ConicalFillAttribute LinearFillAttribute RadialFillAttribute SquareFillAttribute ThreeColFillAttribute BitmapTranspFillAttribute ConicalTranspFillAttribute LinearTranspFillAttribute RadialTranspFillAttribute SquareTranspFillAttribute ThreeColTranspFillAttribute List of all members.

Public Member Functions

 FillGeometryAttribute ()
 Default Constuctor for fill attribute values. Sets the default colours to Black and White. Sets the Control Points to DocCoord(0,0).
virtual void Restore (RenderRegion *, BOOL)=0
virtual void Render (RenderRegion *, BOOL Temp=FALSE)=0
virtual void SimpleCopy (AttributeValue *)
 See AttributeValue::SimpleCopy.
virtual BOOL IsDifferent (AttributeValue *)
 See base class version.
virtual FillGeometryAttributeoperator= (FillGeometryAttribute &Attrib)
 Make the Attribute the same as the other.
virtual INT32 operator== (const FillGeometryAttribute &Attrib)
 A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
virtual BOOL RenderFill (RenderRegion *, Path *)
virtual BOOL IsAspectLocked ()
virtual void SetAspectLock (BOOL)
virtual BOOL IsPerspective ()
virtual void MakePerspective ()
virtual void RemovePerspective ()
virtual DocCoordGetStartPoint ()
virtual DocCoordGetEndPoint ()
virtual DocCoordGetEndPoint2 ()
virtual DocCoordGetEndPoint3 ()
virtual void SetStartPoint (DocCoord *)
virtual void SetEndPoint (DocCoord *)
virtual void SetEndPoint2 (DocCoord *)
virtual void SetEndPoint3 (DocCoord *)
virtual DocColourGetStartColour ()
virtual DocColourGetEndColour ()
virtual DocColourGetEndColour2 ()
virtual DocColourGetEndColour3 ()
virtual void SetStartColour (DocColour *)
virtual void SetEndColour (DocColour *)
virtual void SetEndColour2 (DocColour *)
virtual void SetEndColour3 (DocColour *)
virtual UINT32GetStartTransp ()
virtual UINT32GetEndTransp ()
virtual UINT32GetEndTransp2 ()
virtual UINT32GetEndTransp3 ()
virtual void SetStartTransp (UINT32 *)
virtual void SetEndTransp (UINT32 *)
virtual void SetEndTransp2 (UINT32 *)
virtual void SetEndTransp3 (UINT32 *)
virtual UINT32 GetTranspType ()
virtual void SetTranspType (UINT32 NewType)
virtual UINT32 GetDPI ()
virtual BOOL SetDPI (UINT32 NewDpi)
virtual UINT32 GetFractalDPI ()
virtual BOOL SetFractalDPI (UINT32 NewDpi)
virtual UINT32 GetFractalDim ()
virtual void SetFractalDim (UINT32 NewDim)
virtual INT32 GetSeed ()
virtual FIXED16 GetGraininess ()
virtual FIXED16 GetGravity ()
virtual FIXED16 GetSquash ()
virtual BOOL GetTileable ()
virtual BOOL SetSeed (INT32 NewSeed)
virtual BOOL SetGraininess (FIXED16 NewGrain)
virtual BOOL SetGravity (FIXED16 NewGrav)
virtual BOOL SetSquash (FIXED16 NewSquash)
virtual BOOL SetTileable (BOOL NewTile)
virtual double GetNoiseScale ()
virtual BOOL SetNoiseScale (double)
virtual BOOL Randomise ()
virtual BOOL RecalcFractal ()
virtual BOOL AttachBitmap (KernelBitmap *pBitmap)
virtual BOOL DetachBitmap ()
virtual KernelBitmapGetBitmap ()
virtual BOOL CopyBitmap (KernelBitmap *pBitmap)
virtual KernelBitmapRefGetBitmapRef ()
virtual INT32 GetTesselation ()
virtual void SetTesselation (INT32)
virtual BOOL Blend (BlendAttrParam *pBlendParam)
 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.
virtual BOOL BlendFillColours (DocColour *Start, DocColour *End, DocColour *Blend, double &Ratio, BlendAttrParam *pBlendParam)
virtual BOOL BlendFillTransp (UINT32 *Start, UINT32 *End, UINT32 *Blend, double &Ratio, BlendAttrParam *pBlendParam)
virtual BOOL BlendControlPoints (DocCoord *Start, DocCoord *End, DocCoord *Blend, double &Ratio, BlendAttrParam *pBlendParam, BOOL swapOrder=FALSE)
virtual BOOL CheckForGreyscaleBitmapBlend (KernelBitmap *pBitmap, DocColour *StartCol, DocColour *EndCol)
 Checks for a blend using a Greyscale bitmap, and set the Start and End Cols provided to suitable default Black and White colours.
virtual INT32 Mould (MouldAttribute *, DocCoord *, INT32, DocCoord *)
 Moulds a Fill attribute.
virtual BOOL IsAColourFill ()
virtual BOOL IsATranspFill ()
virtual BOOL IsAFlatFill ()
virtual BOOL IsAGradFill ()
virtual BOOL IsALinearFill ()
virtual BOOL IsARadialFill ()
virtual BOOL IsAConicalFill ()
virtual BOOL IsABitmapFill ()
virtual BOOL IsAKindOfBitmapFill ()
virtual BOOL IsASquareFill ()
virtual BOOL IsAThreeColFill ()
virtual BOOL IsAFourColFill ()
virtual BOOL IsATextureFill ()
virtual BOOL IsAFractalFill ()
virtual BOOL IsANoiseFill ()
virtual void CacheFractalData (FillGeometryAttribute *pCachedFractal)
 Copies any data from this FractalFillAttribute into the cached fractal pointed to on entry. This data is then checked via IsSameAsCachedFractal.
virtual BOOL IsSameAsCachedFractal (FillGeometryAttribute *pCachedFractal)
 A virtual comparison operator used by the fractal cache to check for a matching fractal.
virtual BOOL SupportsFillRamps ()
virtual ColourRampGetColourRamp ()
virtual TransparencyRampGetTranspRamp ()
virtual BOOL SetColourRamp (ColourRamp *pRamp)
virtual BOOL SetTranspRamp (TransparencyRamp *pRamp)
virtual DocCoord GetGeometryCoord (float pos) const
virtual float GetGeometryParam (const DocCoord &c) const
virtual INT32 GetGeometryShape ()
void SetProfile (CProfileBiasGain &SetWith)
CProfileBiasGainGetProfile ()
CProfileBiasGainGetProfilePtr ()
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

CProfileBiasGain DiagramMapper

Protected Member Functions

virtual void TidyMouldPoints (DocCoord *, DocCoord *, BOOL *, INT32)
KernelBitmapGenerateFractalBitmap (INT32, double, double, double, UINT32)
KernelBitmapGenerateNoiseBitmap (FIXED16 grain, INT32 seed)
 Recalculates the Fractal at a new Dpi.

Detailed Description

The base class for a fill geometry attribute, such as flat, linear, radial, conical, etc. This provides the basic interface for fill rendering.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/07/94
See also:
FlatFillAttribute; LinearFillAttribute; RadialFillAttribute; ConicalFillAttribute; BitmapFillAttribute

Definition at line 193 of file fillval.h.


Constructor & Destructor Documentation

FillGeometryAttribute::FillGeometryAttribute  ) 
 

Default Constuctor for fill attribute values. Sets the default colours to Black and White. Sets the Control Points to DocCoord(0,0).

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

Definition at line 270 of file fillval.cpp.

00271 {
00272 }


Member Function Documentation

virtual BOOL FillGeometryAttribute::AttachBitmap KernelBitmap pBitmap  )  [inline, virtual]
 

Reimplemented in BitmapFillAttribute, NoiseFillAttribute, FractalFillAttribute, BitmapTranspFillAttribute, NoiseTranspFillAttribute, and FractalTranspFillAttribute.

Definition at line 276 of file fillval.h.

00276 { return FALSE; }

BOOL FillGeometryAttribute::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 AttributeValue.

Reimplemented in FlatFillAttribute, GradFillAttribute, FlatTranspFillAttribute, GradTranspFillAttribute, and StrokeTranspAttribute.

Definition at line 9351 of file fillval.cpp.

09352 {
09353     // First make a new object of the same type as this one
09354     CCRuntimeClass* ObjectType = GetRuntimeClass();
09355     FillGeometryAttribute* pNewAttr = (FillGeometryAttribute*)ObjectType->CreateObject();
09356 
09357     if (pNewAttr == NULL)
09358     {
09359         // Fail if we couldn't create the new fill
09360         pBlendParam->SetBlendedAttrVal(NULL);
09361         return FALSE;
09362     }
09363 
09364     // Make the new fill an exact copy of this one
09365     pNewAttr->SimpleCopy(this);
09366 
09367     // Now get the fill that we are blending to
09368     FillGeometryAttribute* OtherFill = 
09369                 (FillGeometryAttribute*)pBlendParam->GetOtherAttrVal();
09370 
09371     // and what point along the blend we are at
09372     double Ratio = pBlendParam->GetBlendRatio();
09373     double objectRatio = pBlendParam->GetObjectRatio();
09374 
09375     // Blend the profiles (if there are any ....)
09376 
09377     CProfileBiasGain Default;
09378     
09379     CProfileBiasGain BiasGain = DiagramMapper;                      // the first fills profile
09380     CProfileBiasGain OtherBiasGain = OtherFill->DiagramMapper;      // the other fills profile
09381 
09382     // only blend profiles if we need to ....
09383 
09384     if (!((BiasGain == Default) && (OtherBiasGain == Default)))
09385     {
09386         // then we need to blend the profiles ....
09387 
09388         CProfileBiasGain BlendedProfile;                            // test for now ....
09389 
09390         double InvRatio = 1 - Ratio;
09391         double BlendedBias = (BiasGain.GetBias () * InvRatio) + (OtherBiasGain.GetBias () * Ratio);
09392         double BlendedGain = (BiasGain.GetGain () * InvRatio) + (OtherBiasGain.GetGain () * Ratio);
09393 
09394         BlendedProfile.SetBias (BlendedBias);
09395         BlendedProfile.SetGain (BlendedGain);
09396 
09397         pNewAttr->SetProfile (BlendedProfile);
09398     }
09399 
09400     // CGS:  don't worry if pNewAttr->GetColourRamp () is NULL, this is handled internally by pNewAttr->GetColourRamp ()->Blend ()
09401     // (even if it is NULL, this code is still perfectly valid:  it means blend a no0n-multi-stage fill to something ....)
09402     pNewAttr->GetColourRamp ()->Blend (pNewAttr, pBlendParam, OtherFill/*->GetColourRamp ()*/);
09403 
09404     // Blend the Start and End Colours
09405     DocColour BlendColour;
09406 
09407     DocColour* StartCol         = GetStartColour();
09408     DocColour* OtherStartCol    = OtherFill->GetStartColour();
09409     DocColour* EndCol           = GetEndColour();
09410     DocColour* OtherEndCol      = OtherFill->GetEndColour();
09411     DocColour* EndCol2          = GetEndColour2();
09412     DocColour* OtherEndCol2     = OtherFill->GetEndColour2();
09413     DocColour* EndCol3          = GetEndColour3();
09414     DocColour* OtherEndCol3     = OtherFill->GetEndColour3();
09415     DocColour* NonNullCol       = NULL;
09416     DocColour* OtherNonNullCol  = NULL;
09417 
09418     DocColour TempStartCol;
09419     DocColour TempEndCol;
09420     DocColour TempOtherStartCol;
09421     DocColour TempOtherEndCol;
09422 
09423     // Check for a Greyscale Bitmap fill with no start or end colours
09424     // and use Black and White instead of 'No Colour'
09425     if (IsABitmapFill() && StartCol == NULL && EndCol == NULL)
09426     {
09427         if (GetBitmapRef() != NULL)
09428         {
09429             if (CheckForGreyscaleBitmapBlend(GetBitmapRef()->GetBitmap(), &TempStartCol, &TempEndCol))
09430             {
09431                 StartCol    = &TempStartCol;
09432                 EndCol      = &TempEndCol;
09433             }
09434         }
09435     }
09436 
09437     // Same as above, but for the 'Other Fill'
09438     if (OtherFill->IsABitmapFill() && OtherStartCol == NULL && OtherEndCol == NULL)
09439     {
09440         if (OtherFill->GetBitmapRef() != NULL)
09441         {
09442             if (CheckForGreyscaleBitmapBlend(OtherFill->GetBitmapRef()->GetBitmap(), &TempOtherStartCol, &TempOtherEndCol))
09443             {
09444                 OtherStartCol   = &TempOtherStartCol;
09445                 OtherEndCol     = &TempOtherEndCol;
09446             }
09447         }
09448     }
09449 
09450     // Handle blending of non bitmap fill colours
09451     if (BlendFillColours(StartCol, OtherStartCol, &BlendColour, Ratio, pBlendParam))
09452         pNewAttr->SetStartColour(&BlendColour);
09453 
09454     if (EndCol == NULL)
09455         NonNullCol = StartCol;
09456     else
09457         NonNullCol = EndCol;
09458     
09459     if (OtherEndCol == NULL)
09460     {
09461         OtherNonNullCol = OtherStartCol;
09462 
09463         if (BlendFillColours(EndCol, OtherStartCol, &BlendColour, Ratio, pBlendParam))
09464             pNewAttr->SetEndColour(&BlendColour);
09465     }
09466     else 
09467     {
09468         OtherNonNullCol = OtherEndCol;
09469 
09470         if (BlendFillColours(EndCol, OtherEndCol, &BlendColour, Ratio, pBlendParam))
09471             pNewAttr->SetEndColour(&BlendColour);
09472     }
09473 
09474     if ((EndCol2 != NULL) || (OtherEndCol2 != NULL) || (EndCol3 != NULL) || (OtherEndCol3 != NULL))
09475     {
09476         if (EndCol2 == NULL)
09477             EndCol2 = NonNullCol;
09478         if (OtherEndCol2 == NULL)
09479             OtherEndCol2 = OtherNonNullCol;
09480         if (EndCol3 == NULL)
09481             EndCol3 = NonNullCol;
09482         if (OtherEndCol3 == NULL)
09483             OtherEndCol3 = OtherNonNullCol;
09484     
09485         if (BlendFillColours(EndCol2, OtherEndCol2, &BlendColour, Ratio, pBlendParam))
09486                 pNewAttr->SetEndColour2(&BlendColour);
09487 
09488         if (BlendFillColours(EndCol3, OtherEndCol3, &BlendColour, Ratio, pBlendParam))
09489                 pNewAttr->SetEndColour3(&BlendColour);
09490     }
09491 
09492     // Blend the Start and End Transparencies
09493     UINT32 BlendTransp;
09494 
09495     if (BlendFillTransp(GetStartTransp(), OtherFill->GetStartTransp(), &BlendTransp, Ratio, pBlendParam))
09496         pNewAttr->SetStartTransp(&BlendTransp);
09497 
09498     if (BlendFillTransp(GetEndTransp(), OtherFill->GetEndTransp(), &BlendTransp, Ratio, pBlendParam))
09499         pNewAttr->SetEndTransp(&BlendTransp);
09500 
09501     if (BlendFillTransp(GetEndTransp2(), OtherFill->GetEndTransp2(), &BlendTransp, Ratio, pBlendParam))
09502         pNewAttr->SetEndTransp2(&BlendTransp);
09503 
09504     if (BlendFillTransp(GetEndTransp3(), OtherFill->GetEndTransp3(), &BlendTransp, Ratio, pBlendParam))
09505         pNewAttr->SetEndTransp3(&BlendTransp);
09506 
09507     // Blend the Control Points
09508     DocCoord BlendPoint;
09509 
09510     if (!pBlendParam->GetObjectProfileProcessing ())
09511     {
09512         // were not doing object processing - fill positions are affected by attribute ratio ....
09513         if (BlendControlPoints(GetStartPoint(), OtherFill->GetStartPoint(), &BlendPoint, Ratio, pBlendParam))
09514             pNewAttr->SetStartPoint(&BlendPoint);
09515 
09516         if (BlendControlPoints(GetEndPoint(), OtherFill->GetEndPoint(), &BlendPoint, Ratio, pBlendParam))
09517             pNewAttr->SetEndPoint(&BlendPoint);
09518 
09519         if (BlendControlPoints(GetEndPoint2(), OtherFill->GetEndPoint2(), &BlendPoint, Ratio, pBlendParam))
09520             pNewAttr->SetEndPoint2(&BlendPoint);
09521     }
09522     else
09523     {
09524         // were are doing object processing - fill positions are affected by object ratio ....
09525         if (BlendControlPoints(GetStartPoint(), OtherFill->GetStartPoint(), &BlendPoint, objectRatio, pBlendParam))
09526             pNewAttr->SetStartPoint(&BlendPoint);
09527 
09528         if (BlendControlPoints(GetEndPoint(), OtherFill->GetEndPoint(), &BlendPoint, objectRatio, pBlendParam))
09529             pNewAttr->SetEndPoint(&BlendPoint);
09530 
09531         if (BlendControlPoints(GetEndPoint2(), OtherFill->GetEndPoint2(), &BlendPoint, objectRatio, pBlendParam))
09532             pNewAttr->SetEndPoint2(&BlendPoint);
09533     }
09534 
09535     // Make sure that any BitmapRefs in the Blended attributes,
09536     // are Tempory ones, so we don't try to detach the bitmap
09537     // when the Blend Attrs are destroyed.
09538 
09539 // ****************************************************
09540 //
09541 // Temporarily removed to fix problem with saving Blended bitmaps.
09542 // May re-intruduce problems with deleting bitmaps within blends,
09543 // but the saving problem is more important at the moment ....
09544 // .... Will, 15/12/95
09545 
09546 //  if (GetBitmapRef() != NULL)
09547 //      GetBitmapRef()->TempRef = TRUE;
09548 
09549 //  if (OtherFill->GetBitmapRef() != NULL)
09550 //      OtherFill->GetBitmapRef()->TempRef = TRUE;
09551 
09552 // ****************************************************
09553 
09554 //  if (pNewAttr->GetBitmapRef() != NULL)
09555 //      pNewAttr->GetBitmapRef()->TempRef = TRUE;
09556 
09557     // Set the new fill as the blended attribute
09558     pBlendParam->SetBlendedAttrVal(pNewAttr);
09559 
09560     return TRUE;
09561 }

BOOL FillGeometryAttribute::BlendControlPoints DocCoord Start,
DocCoord End,
DocCoord Blend,
double &  Ratio,
BlendAttrParam pBlendParam,
BOOL  swapOrder = FALSE
[virtual]
 

Definition at line 10031 of file fillval.cpp.

10033 {
10034     if (Start == NULL)
10035     {   
10036         return FALSE;
10037     }
10038 
10039     if (End == NULL)
10040     {
10041         NodeRenderableBounded* pStartNode = NULL;
10042         NodeRenderableBounded* pEndNode = NULL;
10043 
10044         double origRatio = Ratio;
10045 
10046         if (!swapOrder)
10047         {
10048             if ((NodeRenderableBounded*) pBlendParam->GetStartAttrMap ())
10049             {
10050                 pStartNode = (NodeRenderableBounded*) pBlendParam->GetStartAttrMap ()->attrMapCreator;
10051             }
10052 
10053             if ((NodeRenderableBounded*) pBlendParam->GetEndAttrMap ())
10054             {
10055                 pEndNode = (NodeRenderableBounded*) pBlendParam->GetEndAttrMap ()->attrMapCreator;
10056             }
10057         }
10058         else
10059         {
10060             Ratio = 1 - Ratio;
10061             
10062             if ((NodeRenderableBounded*) pBlendParam->GetEndAttrMap ())
10063             {
10064                 pStartNode = (NodeRenderableBounded*) pBlendParam->GetEndAttrMap ()->attrMapCreator;
10065             }
10066  
10067             if ((NodeRenderableBounded*) pBlendParam->GetStartAttrMap ())
10068             {
10069                 pEndNode = (NodeRenderableBounded*) pBlendParam->GetStartAttrMap ()->attrMapCreator;
10070             }
10071         }
10072 
10073 //      ERROR3IF (((pStartNode == NULL) && (pEndNode == NULL)), "Somethings wrong!");   // this should NOT be so
10074         
10075         if (!pEndNode)
10076         {
10077             *Blend = *Start;
10078             if (swapOrder)
10079             {
10080                 Ratio = origRatio;
10081             }
10082             return TRUE;
10083         }
10084         else
10085         {
10086             // we are blending from something to nothing
10087             // previously will just made *Blend equal to *start and returned TRUE.
10088             // this causes problems when blending (e.g.) a linear transparency to a flat fill
10089             // (i.e.  all intermediate blend steps have EXACTLY the same fill geometry as the start)
10090             // this has now been changed.  In a case such as this, we create a temporary estimated 'fill
10091             // handle' point - and blend to that ....  This solution is NOT rotation independant (owing to
10092             // limitations of bounding boxs, but at least what we render on-screen is of a higher quality.
10093 
10094             if (pStartNode)
10095             {
10096                 DocRect rectStart (pStartNode->GetBoundingRect (TRUE));
10097                 DocRect rectEnd (pEndNode->GetBoundingRect (TRUE));
10098 
10099                 INT32 dx = static_cast<INT32> ( (rectEnd.Centre ().x - rectStart.Centre ().x) * Ratio );
10100                 INT32 dy = static_cast<INT32> ( (rectEnd.Centre ().y - rectStart.Centre ().y) * Ratio );
10101         
10102                 *Blend = DocCoord((*Start).x + dx, (*Start).y + dy);
10103 
10104                 if (swapOrder)
10105                 {
10106                     Ratio = origRatio;
10107                 }
10108 
10109                 return TRUE;
10110             }
10111             else
10112             {
10113                 if (swapOrder)
10114                 {
10115                     Ratio = origRatio;
10116                 }
10117                 return (FALSE);
10118             }
10119         }
10120     }
10121 
10122     // process as normal ....
10123 
10124     INT32 dx = INT32(double((*End).x - (*Start).x) * Ratio);
10125     INT32 dy = INT32(double((*End).y - (*Start).y) * Ratio);
10126     
10127     *Blend = DocCoord((*Start).x + dx, (*Start).y + dy);
10128 
10129     return TRUE;
10130 }

BOOL FillGeometryAttribute::BlendFillColours DocColour Start,
DocColour End,
DocColour Blend,
double &  Ratio,
BlendAttrParam pBlendParam
[virtual]
 

Definition at line 9929 of file fillval.cpp.

09931 {
09932     ERROR3IF(Blend == NULL || pBlendParam == NULL, "Illegal NULL param");
09933 
09934     if (Start == NULL)
09935         return FALSE;
09936 
09937     if (End == NULL)
09938     {
09939         *Blend = *Start;
09940         return TRUE;
09941     }
09942 
09943     ColourContext *BlendContext;
09944     ColourContext *OutputContext = NULL;
09945 
09946     // Find the ouptut ColourContext, if there is one available to us
09947     // This allows the blend to take advantage of the output context to do the best 
09948     // job it can of colour-separating tints
09949     if (pBlendParam->GetRenderRegion() != NULL)
09950     {
09951         ERROR3IF(pBlendParam->GetRenderRegion()->GetRenderView() == NULL, "No render view");
09952         if (pBlendParam->GetRenderRegion()->GetRenderView() != NULL)
09953             OutputContext = pBlendParam->GetRenderRegion()->GetRenderView()->GetColourContext(COLOURMODEL_RGBT);
09954     }
09955 
09956     switch (pBlendParam->GetColourBlend())
09957     {
09958         case COLOURBLEND_FADE:
09959             BlendContext = ColourManager::GetColourContext(COLOURMODEL_RGBT);
09960             Blend->Mix(Start, End, Ratio, BlendContext, FALSE, OutputContext);
09961             break;
09962 
09963         case COLOURBLEND_RAINBOW:
09964             BlendContext = ColourManager::GetColourContext(COLOURMODEL_HSVT);
09965             Blend->Mix(Start, End, Ratio, BlendContext, FALSE, OutputContext);
09966             break;
09967 
09968         case COLOURBLEND_ALTRAINBOW:
09969             BlendContext = ColourManager::GetColourContext(COLOURMODEL_HSVT);
09970             Blend->Mix(Start, End, Ratio, BlendContext, TRUE, OutputContext);
09971             break;
09972 
09973         default:
09974             ERROR3("Unknown colour blend type");
09975             return(FALSE);
09976     }
09977 
09978     return TRUE;
09979 }

BOOL FillGeometryAttribute::BlendFillTransp UINT32 Start,
UINT32 End,
UINT32 Blend,
double &  Ratio,
BlendAttrParam pBlendParam
[virtual]
 

Definition at line 9997 of file fillval.cpp.

09999 {
10000     if (Start == NULL)
10001         return FALSE;
10002 
10003     if (End == NULL)
10004     {
10005         *Blend = *Start;
10006         return TRUE;
10007     }
10008 
10009     INT32 dt = *End - *Start;
10010     *Blend = UINT32(double(*Start) + (double(dt) * Ratio));
10011     
10012     return TRUE;
10013 }

void FillGeometryAttribute::CacheFractalData FillGeometryAttribute pCachedFractal  )  [virtual]
 

Copies any data from this FractalFillAttribute into the cached fractal pointed to on entry. This data is then checked via IsSameAsCachedFractal.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/97
Parameters:
pCachedFractal = A pointer to the fractal in the cache [INPUTS]
Returns:
-

Reimplemented in NoiseFillAttribute, FractalFillAttribute, NoiseTranspFillAttribute, and FractalTranspFillAttribute.

Definition at line 633 of file fillval.cpp.

00634 {   
00635     ERROR3("FillGeometryAttribute::CacheFractalData() should not have been called");
00636 }

BOOL FillGeometryAttribute::CheckForGreyscaleBitmapBlend KernelBitmap pBitmap,
DocColour StartCol,
DocColour EndCol
[virtual]
 

Checks for a blend using a Greyscale bitmap, and set the Start and End Cols provided to suitable default Black and White colours.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/1/95
Returns:
TRUE if colours where set.

Definition at line 10146 of file fillval.cpp.

10148 {
10149     PORTNOTETRACE("other","FillGeometryAttribute::CheckForGreyscaleBitmapBlend - do nothing");
10150 #ifndef EXCLUDE_FROM_XARALX
10151 #ifndef WEBSTER
10152     if (pBitmap != NULL)
10153     {
10154         if (BfxALU::IsGreyscaleBitmap(pBitmap)) // WEBSTER-Martin-14/01/97 we prob do need this
10155         {
10156             // The bitmap is Greyscale, with NULL start and end colours,
10157             // so we will use Black and White colours in the blend
10158         
10159             AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
10160                                                 _R(IDS_BLACKNAME), StartCol);
10161 
10162             AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
10163                                                 _R(IDS_WHITENAME), EndCol);
10164 
10165             return TRUE;
10166         }
10167     }
10168 #endif //WEBSTER */
10169 #endif
10170     return FALSE;
10171 }

virtual BOOL FillGeometryAttribute::CopyBitmap KernelBitmap pBitmap  )  [inline, virtual]
 

Reimplemented in BitmapFillAttribute, NoiseFillAttribute, FractalFillAttribute, BitmapTranspFillAttribute, NoiseTranspFillAttribute, and FractalTranspFillAttribute.

Definition at line 279 of file fillval.h.

00279 { return FALSE; }

virtual BOOL FillGeometryAttribute::DetachBitmap  )  [inline, virtual]
 

Reimplemented in BitmapFillAttribute, NoiseFillAttribute, FractalFillAttribute, BitmapTranspFillAttribute, NoiseTranspFillAttribute, and FractalTranspFillAttribute.

Definition at line 277 of file fillval.h.

00277 { return FALSE; }

KernelBitmap * FillGeometryAttribute::GenerateFractalBitmap INT32  ,
double  ,
double  ,
double  ,
UINT32 
[protected]
 

Definition at line 389 of file fillval.cpp.

00392 {
00393     BOOL Tile = GetTileable();
00394 
00395 /*
00396     switch (GetTesselation())
00397     {
00398         case RT_Simple:
00399             Tile = FALSE;
00400             break;
00401 
00402         case RT_Repeating:
00403             Tile = TRUE;
00404             break;
00405 
00406         case RT_RepeatInverted:
00407             Tile = FALSE;
00408             break;
00409 
00410         default:
00411             Tile = TRUE;
00412             break;
00413     }
00414 
00415     SetTileable(Tile);
00416 */
00417 
00418     TRACEUSER( "Mike", _T("Seed          = %d\n"),Seed);
00419     TRACEUSER( "Mike", _T("Graininess    = %f\n"),Graininess);
00420     TRACEUSER( "Mike", _T("Gravity       = %f\n"),Gravity);
00421     TRACEUSER( "Mike", _T("Squash        = %f\n"),Squash);
00422     TRACEUSER( "Mike", _T("Dpi           = %d\n"),Dpi);
00423 
00424     // First make a fractal from the variables stored in the fill.
00425     PlasmaFractalFill TheFractal(Seed, Tile, Squash, Graininess, Gravity);
00426 
00427     // Get the fill control points
00428     DocCoord Start = *GetStartPoint();
00429     DocCoord End   = *GetEndPoint();
00430     DocCoord End2  = *GetEndPoint2();
00431 
00432     if (Dpi == 0)
00433         Dpi = AttrFillGeometry::FractalDPI;
00434 
00435     if (Dpi > 72000)
00436         Dpi = 72000;
00437 
00438     // Find the size of a pixel.  Note: This assumes pixels are square at the moment.
00439     MILLIPOINT PixelWidth = 72000/Dpi;
00440 
00441     INT32 FracWidth  = INT32(Start.Distance(End));
00442     INT32 FracHeight = INT32(Start.Distance(End2));
00443 
00444     TRACEUSER( "Mike", _T("PixelWidth   = %d\n"),PixelWidth);
00445     TRACEUSER( "Mike", _T("Frac Width   = %d\n"),FracWidth);
00446     TRACEUSER( "Mike", _T("Frac Height  = %d\n"),FracHeight);
00447 
00448     // Calculate the size of the fractal (in Pixels) from the control points
00449     INT32 FracPixWidth  = FracWidth / PixelWidth;
00450     INT32 FracPixHeight     = FracHeight/ PixelWidth;
00451 
00452     TRACEUSER( "Mike", _T("Pix Width    = %d\n"),FracPixWidth);
00453     TRACEUSER( "Mike", _T("Pix Height   = %d\n"),FracPixHeight);
00454 
00455     if (FracPixWidth == 0)
00456         FracPixWidth = 2;
00457 
00458     if (FracPixHeight == 0)
00459         FracPixHeight = 2;
00460 
00461     // The 'actual' dimensions of a fractal must be square and a power of 2.
00462     // 'GetDimension' finds an appropriate value for this dimension.
00463     // It will be the next power of 2 higher than Width or Height (whichever is biggest).
00464     INT32 FracPixDim    = TheFractal.GetDimension(FracPixWidth, FracPixHeight);
00465 
00466     if (FracPixDim > AttrFillGeometry::MaxFractalSize)
00467         FracPixDim = AttrFillGeometry::MaxFractalSize;
00468 
00469     // Set the fractal dimensions so we can see if a match is available
00470     // in the fractal cache
00471     SetFractalDim(FracPixDim);
00472 
00473     TRACEUSER( "Mike", _T("Fractal Dim  = %d\n"),FracPixDim);
00474 
00475     CachedFractal* ExistingFrac = 
00476             GetApplication()->GetGlobalFractalList()->CheckFractalBitmap(this);
00477 
00478     if (ExistingFrac != NULL)
00479     {
00480         // This fractal already exist, so lets re-use it
00481         OILBitmap* ExistingBmp = ExistingFrac->GetCachedFractal()->GetBitmap()->ActualBitmap;
00482         KernelBitmap* ExistingFractal = new KernelBitmap(ExistingBmp, TRUE);
00483         return ExistingFractal;
00484     }
00485 
00486     String_64 FracText(_R(IDS_K_FILLVAL_GENFRACT));
00487     BeginSlowJob(-1, FALSE, &FracText);
00488 
00489     Dpi = (FracPixDim * 72000)/(FracWidth >= FracHeight ? FracWidth : FracHeight);
00490 
00491     // Create the Bitmap !!
00492     KernelBitmap* Bitmap = new KernelBitmap(FracPixDim, FracPixDim, 8, Dpi, TRUE);
00493 
00494     if (Bitmap == NULL)
00495     {
00496         EndSlowJob();
00497         ERROR1(NULL, _R(IDE_FRACTMEM));
00498     }
00499 
00500     // Make this into a fractal bitmap
00501     Bitmap->SetAsFractal();
00502 
00503     // Render the Fractal into the bitmap
00504     BOOL ok = TheFractal.DoFill(Bitmap, FracPixDim, 0, 0);
00505 
00506     EndSlowJob();
00507 
00508     if (!ok) TRACEUSER( "Mike", _T("DoFill Failed\n"));
00509     ERROR1IF(!ok, Bitmap, _R(IDE_FRACTFAILED));
00510 
00511     return Bitmap;
00512 }

KernelBitmap * FillGeometryAttribute::GenerateNoiseBitmap FIXED16  grain,
INT32  seed
[protected]
 

Recalculates the Fractal at a new Dpi.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/01/97
Parameters:
Parameters for a new noisy fractal [INPUTS]
See also:

Definition at line 539 of file fillval.cpp.

00540 {
00541     NoiseFractalFill TheFractal;
00542 
00543     // Get the fill control points
00544     DocCoord Start = *GetStartPoint();
00545     DocCoord End   = *GetEndPoint();
00546     DocCoord End2  = *GetEndPoint2();
00547 
00548     INT32 UAxisLength = INT32(Start.Distance(End));
00549     INT32 VAxisLength = INT32(Start.Distance(End2));
00550 
00551     INT32 Dpi = 0;
00552     if (Dpi == 0)
00553         Dpi = AttrFillGeometry::FractalDPI;
00554 
00555 /*
00556     // Find the size of a pixel.  Note: This assumes pixels are square at the moment.
00557     MILLIPOINT SizeOfPixel = 72000/Dpi;
00558 
00559     // Calculate the size of the fractal (in Pixels) from the control points
00560     INT32 NumPixelsX = UAxisLength / SizeOfPixel;
00561     INT32 NumPixelsY = VAxisLength / SizeOfPixel;
00562 
00563     if (NumPixelsX <= 0) NumPixelsX = 2;
00564     if (NumPixelsY <= 0) NumPixelsY = 2;
00565 
00566     // Make this a square
00567     INT32 FracPixDim = LMax(NumPixelsX, NumPixelsY);
00568 
00569     if (FracPixDim > AttrFillGeometry::MaxFractalSize)
00570         FracPixDim = AttrFillGeometry::MaxFractalSize;
00571 */
00572     INT32 FracPixDim = 256;
00573 
00574     // save this size, we'll use it for caching!
00575     SetFractalDim(FracPixDim);
00576 
00577     // try to find a cached fractal
00578     CachedFractal* ExistingFrac = 
00579         GetApplication()->GetGlobalFractalList()->CheckFractalBitmap(this);
00580 
00581     if (ExistingFrac != NULL)
00582     {
00583         // This fractal already exist, so lets re-use it
00584         OILBitmap* ExistingBmp = ExistingFrac->GetCachedFractal()->GetBitmap()->ActualBitmap;
00585         KernelBitmap* ExistingFractal = new KernelBitmap(ExistingBmp, TRUE);
00586         return ExistingFractal;
00587     }
00588 
00589     String_64 FracText(_R(IDS_K_FILLVAL_GENFRACT));
00590     BeginSlowJob(-1, FALSE, &FracText);
00591 
00592     // calc the dpi of the image
00593     Dpi = (FracPixDim * 72000) / ( LMax( UAxisLength , VAxisLength) );
00594 
00595     // Create the Bitmap
00596     KernelBitmap* Bitmap = new KernelBitmap(FracPixDim, FracPixDim, 8, Dpi, TRUE);
00597 
00598     if (Bitmap == NULL)
00599     {
00600         EndSlowJob();
00601         ERROR1(NULL, _R(IDE_FRACTMEM));
00602     }
00603 
00604     // Make this into a fractal bitmap
00605     Bitmap->SetAsFractal();
00606 
00607     // Render the Fractal into the bitmap
00608     double scale = grain.MakeDouble();
00609     BOOL ok = TheFractal.DoFill(scale, seed, Bitmap);
00610 
00611     EndSlowJob();
00612 
00613     if (!ok) TRACEUSER( "Mike", _T("DoFill Failed\n"));
00614 //  ERROR1IF(!ok, Bitmap, _R(IDE_FRACTFAILED));
00615 
00616     return Bitmap;
00617 }

virtual KernelBitmap* FillGeometryAttribute::GetBitmap void   )  [inline, virtual]
 

Reimplemented in BitmapFillAttribute, and BitmapTranspFillAttribute.

Definition at line 278 of file fillval.h.

00278 { return NULL; }

virtual KernelBitmapRef* FillGeometryAttribute::GetBitmapRef  )  [inline, virtual]
 

Reimplemented in BitmapFillAttribute, and BitmapTranspFillAttribute.

Definition at line 281 of file fillval.h.

00281 { return NULL; }

virtual ColourRamp* FillGeometryAttribute::GetColourRamp  )  [inline, virtual]
 

Reimplemented in GradFillAttribute.

Definition at line 321 of file fillval.h.

00321 { return NULL; }

virtual UINT32 FillGeometryAttribute::GetDPI  )