NoiseTranspFillAttribute Class Reference

Specifies a noise fill attribute for an object. More...

#include <fillval.h>

Inheritance diagram for NoiseTranspFillAttribute:

BitmapTranspFillAttribute GradTranspFillAttribute TranspFillAttribute FillGeometryAttribute AttributeValue CCObject SimpleCCObject List of all members.

Public Member Functions

 NoiseTranspFillAttribute ()
 Implementation of NoiseTranspFillAttribute.
 ~NoiseTranspFillAttribute ()
 Destructor for NoiseTranspFillAttribute attribute values.
virtual NodeAttributeMakeNode ()
 Make a AttrNoiseTranspFill node from this flat fill colour attribute.
virtual void SimpleCopy (AttributeValue *)
 See AttributeValue::SimpleCopy.
virtual FillGeometryAttributeoperator= (FillGeometryAttribute &Attrib)
 Make this Attribute the same as FillAttrib.
virtual INT32 operator== (const FillGeometryAttribute &Attrib)
 A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
virtual BOOL AttachBitmap (KernelBitmap *pBitmap)
 Attaches a bitmap to this fill.
virtual BOOL DetachBitmap ()
 Detaches a bitmap from this fill.
virtual BOOL CopyBitmap (KernelBitmap *)
 Used to copy a bitmap from one fill to another.
virtual BOOL RecalcFractal ()
 Recalculates the Fractal.
virtual UINT32 GetFractalDim ()
virtual BOOL GetTileable ()
virtual UINT32 GetFractalDPI ()
virtual INT32 GetSeed ()
virtual FIXED16 GetGraininess ()
virtual void SetTesselation (INT32 NewTess)
virtual void SetFractalDim (UINT32 NewDim)
virtual BOOL SetTileable (BOOL NewTile)
virtual BOOL SetFractalDPI (UINT32 NewDpi)
virtual BOOL SetSeed (INT32 NewSeed)
virtual BOOL SetGraininess (FIXED16 NewGrain)
virtual BOOL IsAKindOfBitmapFill ()
virtual BOOL IsABitmapFill ()
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 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 ()

Private Attributes

UINT32 dpi
UINT32 dim
BOOL tileable
INT32 seed
FIXED16 grain

Detailed Description

Specifies a noise fill attribute for an object.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/01/97
See also:
FillGeometryAttribute

Definition at line 1391 of file fillval.h.


Constructor & Destructor Documentation

NoiseTranspFillAttribute::NoiseTranspFillAttribute  ) 
 

Implementation of NoiseTranspFillAttribute.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/01/97
Parameters:
- [INPUTS]

Definition at line 6323 of file fillval.cpp.

06324 {
06325     MonotonicTime time;
06326     seed = time.Sample();
06327 
06328     dpi          = AttrFillGeometry::FractalDPI;
06329     dim          = 0;
06330     tileable     = TRUE;
06331 
06332     grain        = FIXED16(30);
06333 }

NoiseTranspFillAttribute::~NoiseTranspFillAttribute  ) 
 

Destructor for NoiseTranspFillAttribute attribute values.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/97
See also:
AttrFillGeometry::AttrFillGeometry

Definition at line 6347 of file fillval.cpp.

06348 {
06349     DetachBitmap();
06350 }


Member Function Documentation

BOOL NoiseTranspFillAttribute::AttachBitmap KernelBitmap NewBitmap  )  [virtual]
 

Attaches a bitmap to this fill.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
See also:
NoiseTranspFillAttribute::DetachBitmap()

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6536 of file fillval.cpp.

06537 {
06538     DetachBitmap();
06539 
06540     if (NewBitmap == NULL)
06541         return FALSE;
06542 
06543     OILBitmap* Bmp = NewBitmap->ActualBitmap;
06544     if (Bmp == NULL || !Bmp->IsTemp())
06545         return FALSE;
06546 
06547     NewBitmap = new KernelBitmap(Bmp, TRUE);
06548     BitmapRef.SetBitmap(NewBitmap);
06549     GetApplication()->GetGlobalFractalList()->AddFractal(this);
06550 
06551     return TRUE;
06552 }

void NoiseTranspFillAttribute::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:
-
See also:
CachedFractal, FracList.h / .cpp

Reimplemented from FillGeometryAttribute.

Definition at line 6481 of file fillval.cpp.

06482 {
06483     ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to NoiseTranspFillAttribute::CacheFractalData");
06484     ERROR3IF(!IS_A(pCachedFractal,NoiseTranspFillAttribute), "Not a NoiseTranspFillAttribute during NoiseTranspFillAttribute::CacheFractalData");
06485 
06486     pCachedFractal->SetStartPoint(GetStartPoint());
06487     pCachedFractal->SetEndPoint(GetEndPoint());
06488     pCachedFractal->SetEndPoint2(GetEndPoint2());
06489 
06490     pCachedFractal->SetFractalDPI(GetFractalDPI());
06491     pCachedFractal->SetFractalDim(GetFractalDim());
06492     pCachedFractal->SetTileable(GetTileable());
06493     pCachedFractal->SetSeed(GetSeed());
06494 
06495     pCachedFractal->SetGraininess(GetGraininess());
06496 }

BOOL NoiseTranspFillAttribute::CopyBitmap KernelBitmap BmpToCopy  )  [virtual]
 

Used to copy a bitmap from one fill to another.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
See also:
NoiseTranspFillAttribute::AttachBitmap()

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6593 of file fillval.cpp.

06594 {
06595     if (BmpToCopy != NULL)  // Is there a bitmap to copy ?
06596     {
06597         DetachBitmap();
06598 
06599         return AttachBitmap(BmpToCopy);
06600     }
06601 
06602     return TRUE;
06603 }

BOOL NoiseTranspFillAttribute::DetachBitmap  )  [virtual]
 

Detaches a bitmap from this fill.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
See also:
BitmapFillAttribute::AttachBitmap()

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6565 of file fillval.cpp.

06566 {
06567     if (GetBitmap() == NULL)
06568         return FALSE;
06569 
06570     if (GetApplication()->GetGlobalFractalList()->RemoveFractal(this) && BitmapRef.GetBitmap())
06571     {
06572         // The fractal was deleted, so make sure we NULL our pointer
06573         BitmapRef.GetBitmap()->ActualBitmap = NULL;
06574     }
06575 
06576     // now make sure the kernelbitmap is dead too
06577     BitmapRef.DeleteBmp();
06578 
06579     return TRUE;
06580 }

virtual UINT32 NoiseTranspFillAttribute::GetFractalDim  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 1411 of file fillval.h.

01411 { return dim; }

virtual UINT32 NoiseTranspFillAttribute::GetFractalDPI  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 1413 of file fillval.h.

01413 { return dpi; }

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

Reimplemented from BitmapTranspFillAttribute.

Definition at line 1433 of file fillval.h.

01433 { return(FILLSHAPE_PLASMA); }

virtual FIXED16 NoiseTranspFillAttribute::GetGraininess  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 1415 of file fillval.h.

01415 { return grain; }

virtual INT32 NoiseTranspFillAttribute::GetSeed  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 1414 of file fillval.h.

01414 { return seed; }

virtual BOOL NoiseTranspFillAttribute::GetTileable  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 1412 of file fillval.h.

01412 { return tileable; }

virtual BOOL NoiseTranspFillAttribute::IsABitmapFill  )  [inline, virtual]
 

Reimplemented from BitmapTranspFillAttribute.

Definition at line 1426 of file fillval.h.

01426 { return FALSE; }

virtual BOOL NoiseTranspFillAttribute::IsAKindOfBitmapFill  )  [inline, virtual]
 

Reimplemented from BitmapTranspFillAttribute.

Definition at line 1425 of file fillval.h.

01425 { return TRUE; }

BOOL NoiseTranspFillAttribute::IsSameAsCachedFractal FillGeometryAttribute pCachedFractal  )  [virtual]
 

A virtual comparison operator used by the fractal cache to check for a matching fractal.

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:
TRUE if this fractal matches the cached fractal FALSE if not

Reimplemented from FillGeometryAttribute.

Definition at line 6512 of file fillval.cpp.

06513 {
06514     ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to NoiseTranspFillAttribute::IsSameAsCachedFractal");
06515     ERROR3IF(!IS_A(pCachedFractal,NoiseTranspFillAttribute), "Not a NoiseTranspFillAttribute during NoiseTranspFillAttribute::IsSameAsCachedFractal");
06516 
06517     BOOL ok =  (dim          == pCachedFractal->GetFractalDim());
06518     ok = ok && (tileable     == pCachedFractal->GetTileable());
06519     ok = ok && (seed         == pCachedFractal->GetSeed());
06520     ok = ok && (grain        == pCachedFractal->GetGraininess());
06521     
06522     return ok;  
06523 }

NodeAttribute * NoiseTranspFillAttribute::MakeNode  )  [virtual]
 

Make a AttrNoiseTranspFill node from this flat fill colour attribute.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/97
Returns:
Pointer to the new node, or NULL if out of memory.

Errors: Out of memory

See also:
AttributeValue::MakeNode; AttrFlatColourFill

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6366 of file fillval.cpp.

06367 {
06368     // Create new attribute node
06369     AttrNoiseTranspFill *pAttr = new AttrNoiseTranspFill;
06370     if (pAttr==NULL)
06371         // error message has already been set by new
06372         return NULL;
06373 
06374     // Copy attribute value into the new node.
06375     pAttr->GetAttributeValue()->SimpleCopy(this);
06376 
06377     // Return the new node
06378     return pAttr;
06379 }

ColourFillAttribute * NoiseTranspFillAttribute::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 BitmapTranspFillAttribute.

Definition at line 6722 of file fillval.cpp.

06723 {
06724     UINT32 *pStartTransp = GetStartTransp();
06725     UINT32 *pEndTransp = GetEndTransp();
06726 
06727     if(pStartTransp == NULL || pEndTransp == NULL)
06728         return NULL;
06729     
06730     NoiseFillAttribute *pNewAttr = new NoiseFillAttribute;  
06731     if (pNewAttr != NULL)
06732     {
06733         pNewAttr->SetStartPoint(GetStartPoint());
06734         pNewAttr->SetEndPoint(GetEndPoint());
06735         pNewAttr->SetEndPoint2(GetEndPoint2());
06736         pNewAttr->SetEndPoint3(GetEndPoint3());
06737 
06738         pNewAttr->SetTesselation(GetTesselation());
06739         pNewAttr->SetDPI(GetDPI());
06740         if(IsPerspective())
06741             pNewAttr->MakePerspective();
06742 
06743         pNewAttr->AttachBitmap(GetBitmap());
06744         pNewAttr->SetFractalDim(GetFractalDim());
06745         pNewAttr->SetTileable(GetTileable());
06746         pNewAttr->SetFractalDPI(GetFractalDPI());
06747         pNewAttr->SetSeed(GetSeed());
06748         pNewAttr->SetNoiseScale(GetNoiseScale());
06749 
06750         INT32 StartTransparency = 255 - (INT32)(((double)(255 - *pStartTransp)) * TransparencyScale);
06751         INT32 EndTransparency = 255 - (INT32)(((double)(255 - *pEndTransp)) * TransparencyScale);
06752 
06753         DocColour       colorStart(StartTransparency, StartTransparency, StartTransparency);
06754         DocColour       colorEnd1(EndTransparency, EndTransparency, EndTransparency);
06755         pNewAttr->SetStartColour(&colorStart);
06756         pNewAttr->SetEndColour(&colorEnd1);
06757 
06758         pNewAttr->RecalcFractal();
06759     }
06760 
06761     return(pNewAttr);
06762 }

FillGeometryAttribute & NoiseTranspFillAttribute::operator= FillGeometryAttribute FillAttrib  )  [virtual]
 

Make this Attribute the same as FillAttrib.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/97
Parameters:
FillAttrib - the attribute to copy, which must be an AttrFillGeometry [INPUTS]
Returns:
Usual semantics for equality.

Errors: No copy is made if the attributes are different runtime classes

See also:
TranspFillAttribute::operator=;

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6395 of file fillval.cpp.

06396 {
06397     if (FillAttrib.IsKindOf(CC_RUNTIME_CLASS(NoiseTranspFillAttribute)))
06398     {
06399         dpi         = ((NoiseTranspFillAttribute*)&FillAttrib)->dpi;
06400         dim         = ((NoiseTranspFillAttribute*)&FillAttrib)->dim;
06401         tileable    = ((NoiseTranspFillAttribute*)&FillAttrib)->tileable;
06402         seed        = ((NoiseTranspFillAttribute*)&FillAttrib)->seed;
06403         grain       = ((NoiseTranspFillAttribute*)&FillAttrib)->grain;
06404     }
06405     
06406     return TranspFillAttribute::operator=(FillAttrib);
06407 }

INT32 NoiseTranspFillAttribute::operator== const FillGeometryAttribute Attrib  )  [virtual]
 

A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Parameters:
Attrib - the attribute to compare, which must be an AttrFillGeometry [INPUTS]
Returns:
Usual semantics for equality.

Errors: An ENSURE failure will occur if Attrib does not have a AttrFlatGeometry runtime class.

See also:
NodeAttribute::operator==

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6426 of file fillval.cpp.

06427 {
06428     // is this the same class of object?
06429     if (GetRuntimeClass() != Attrib.GetRuntimeClass())
06430         return FALSE;
06431 
06432     NoiseTranspFillAttribute* pAttrib = (NoiseTranspFillAttribute*)&Attrib;
06433 
06434     if (IsPerspective())
06435     { 
06436         if (!pAttrib->IsPerspective())
06437             return FALSE;
06438 
06439         if (*GetEndPoint3() != *pAttrib->GetEndPoint3())
06440             return FALSE;
06441     }
06442 
06443     // check the transparency ramp matches
06444     if (!SameTransparencyRampAs(pAttrib->GetTranspRamp()))
06445         return FALSE;
06446 
06447     return 
06448     (
06449         *GetStartTransp()   == *pAttrib->GetStartTransp()   &&  
06450         *GetEndTransp()     == *pAttrib->GetEndTransp()     &&
06451     
06452         *GetStartPoint()    == *pAttrib->GetStartPoint()    &&
06453         *GetEndPoint()      == *pAttrib->GetEndPoint()      &&
06454         *GetEndPoint2()     == *pAttrib->GetEndPoint2()     &&
06455         
06456         GetTranspType()     == pAttrib->GetTranspType()     &&
06457 
06458         dpi                 == pAttrib->dpi                 &&  
06459         dim                 == pAttrib->dim                 &&
06460         tileable            == pAttrib->tileable            &&
06461         seed                == pAttrib->seed                &&
06462         
06463         grain               == pAttrib->grain
06464     ); 
06465 }

BOOL NoiseTranspFillAttribute::RecalcFractal  )  [virtual]
 

Recalculates the Fractal.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/94
See also:
NoiseTranspFillAttribute::SetDPI

Reimplemented from FillGeometryAttribute.

Definition at line 6637 of file fillval.cpp.

06638 {
06639     if (*GetStartPoint() == *GetEndPoint() ||
06640         *GetStartPoint() == *GetEndPoint2())
06641     {
06642         return FALSE;
06643     }
06644 
06645     KernelBitmap* pBitmap = GenerateNoiseBitmap(grain,seed);
06646     if (pBitmap == NULL)
06647     {
06648         TRACEUSER( "Mike", _T("Noisy fractal Failed !!!\n"));
06649         return FALSE;   // Error set by GenerateFractalBitmap
06650     }
06651 
06652     AttachBitmap(pBitmap);
06653     delete pBitmap;
06654 
06655     return TRUE;
06656 }

void NoiseTranspFillAttribute::SetFractalDim UINT32  NewDim  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 6668 of file fillval.cpp.

06669 {
06670     dim = NewDim;
06671 }

BOOL NoiseTranspFillAttribute::SetFractalDPI UINT32  NewDpi  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 6682 of file fillval.cpp.

06683 {
06684     dpi = NewDpi;
06685 
06686     return TRUE;
06687 }

BOOL NoiseTranspFillAttribute::SetGraininess FIXED16  NewGrain  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 6691 of file fillval.cpp.

06692 {
06693     DetachBitmap();     // Ensure the current fractal is removed from cache
06694 
06695     if (NewGrain<0) NewGrain=0;
06696     if (NewGrain>100) NewGrain=100;
06697     grain = NewGrain;
06698 
06699     return TRUE;
06700 }

BOOL NoiseTranspFillAttribute::SetSeed INT32  NewSeed  )  [virtual]
 

Values local to this fractal type

Reimplemented from FillGeometryAttribute.

Definition at line 6768 of file fillval.cpp.

06769 {
06770     DetachBitmap();     // Ensure the current fractal is removed from cache
06771 
06772     seed = NewSeed;
06773 
06774     return TRUE;
06775 }

void NoiseTranspFillAttribute::SetTesselation INT32  NewTess  )  [virtual]
 

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6660 of file fillval.cpp.

06661 {
06662     if (NewTess == RT_NoRepeatType)
06663         NewTess = RT_Repeating;
06664 
06665     Tesselation = NewTess;
06666 }

BOOL NoiseTranspFillAttribute::SetTileable BOOL  NewTile  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 6673 of file fillval.cpp.

06674 {
06675     DetachBitmap();     // Ensure the current fractal is removed from cache
06676 
06677     tileable = NewTile;
06678 
06679     return TRUE;
06680 }

void NoiseTranspFillAttribute::SimpleCopy AttributeValue pValue  )  [virtual]
 

See AttributeValue::SimpleCopy.

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

Reimplemented from BitmapTranspFillAttribute.

Definition at line 6619 of file fillval.cpp.

06620 {
06621     // Just use the assignment operator
06622     *this = *(FillGeometryAttribute*)pValue;
06623 }


Member Data Documentation

UINT32 NoiseTranspFillAttribute::dim [private]
 

Definition at line 1437 of file fillval.h.

UINT32 NoiseTranspFillAttribute::dpi [private]
 

Definition at line 1436 of file fillval.h.

FIXED16 NoiseTranspFillAttribute::grain [private]
 

Definition at line 1442 of file fillval.h.

INT32 NoiseTranspFillAttribute::seed [private]
 

Definition at line 1439 of file fillval.h.

BOOL NoiseTranspFillAttribute::tileable [private]
 

Definition at line 1438 of file fillval.h.


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