NoiseFillAttribute Class Reference

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

#include <fillval.h>

Inheritance diagram for NoiseFillAttribute:

BitmapFillAttribute GradFillAttribute ColourFillAttribute FillGeometryAttribute AttributeValue CCObject SimpleCCObject List of all members.

Public Member Functions

 NoiseFillAttribute ()
 Implementation of NoiseFillAttribute.
 ~NoiseFillAttribute ()
virtual NodeAttributeMakeNode ()
 Make a AttrFlatColourFill node from this flat fill colour attribute.
virtual void SimpleCopy (AttributeValue *)
 See AttributeValue::SimpleCopy.
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 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 ()
virtual UINT32 GetFractalDim ()
virtual BOOL GetTileable ()
virtual UINT32 GetFractalDPI ()
virtual DocColourGetStartColour ()
 Gets the Start colour of this fill.
virtual DocColourGetEndColour ()
 Gets the End colour of this fill.
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 void SetStartColour (DocColour *)
 Sets the start colour of this fill.
virtual void SetEndColour (DocColour *)
 Sets the end colour of this fill.
virtual BOOL SetSeed (INT32 NewSeed)
virtual BOOL SetGraininess (FIXED16 NewGrain)
virtual BOOL IsAKindOfBitmapFill ()
virtual BOOL IsABitmapFill ()
virtual BOOL IsATextureFill ()
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 INT32 GetGeometryShape ()

Private Attributes

INT32 seed
UINT32 dpi
BOOL tileable
UINT32 dim
FIXED16 grain

Detailed Description

Specifies a noise fill attribute for an object.

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

Definition at line 841 of file fillval.h.


Constructor & Destructor Documentation

NoiseFillAttribute::NoiseFillAttribute  ) 
 

Implementation of NoiseFillAttribute.

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

Definition at line 3527 of file fillval.cpp.

03528 {
03529     MonotonicTime time;
03530     seed = time.Sample();
03531 
03532     dpi          = AttrFillGeometry::FractalDPI;
03533     dim          = 0;
03534     tileable     = TRUE;
03535 
03536     grain        = FIXED16(30.0);
03537 }

NoiseFillAttribute::~NoiseFillAttribute  ) 
 

Definition at line 3540 of file fillval.cpp.

03541 {
03542     DetachBitmap();
03543 }


Member Function Documentation

BOOL NoiseFillAttribute::AttachBitmap KernelBitmap NewBitmap  )  [virtual]
 

Attaches a bitmap to this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
See also:
BitmapFillAttribute::DetachBitmap()

Reimplemented from BitmapFillAttribute.

Definition at line 3650 of file fillval.cpp.

03651 {
03652     DetachBitmap();
03653 
03654     if (NewBitmap == NULL)
03655         return FALSE;
03656 
03657     OILBitmap* Bmp = NewBitmap->ActualBitmap;
03658     if (Bmp == NULL || !Bmp->IsTemp())
03659         return FALSE;
03660 
03661     NewBitmap = new KernelBitmap(Bmp, TRUE);
03662     BitmapRef.SetBitmap(NewBitmap);
03663     GetApplication()->GetGlobalFractalList()->AddFractal(this);
03664     
03665     return TRUE;
03666 }

void NoiseFillAttribute::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 from FillGeometryAttribute.

Definition at line 3617 of file fillval.cpp.

03618 {
03619     ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to NoiseFillAttribute::CacheFractalData");
03620     ERROR3IF(!IS_A(pCachedFractal,NoiseFillAttribute), "Not a NoiseFillAttribute during NoiseFillAttribute::CacheFractalData");
03621 
03622     pCachedFractal->SetStartPoint(GetStartPoint());
03623     pCachedFractal->SetEndPoint(GetEndPoint());
03624     pCachedFractal->SetEndPoint2(GetEndPoint2());
03625 
03626     pCachedFractal->SetFractalDPI(GetFractalDPI());
03627     pCachedFractal->SetFractalDim(GetFractalDim());
03628     pCachedFractal->SetTileable(GetTileable());
03629     pCachedFractal->SetSeed(GetSeed());
03630 
03631     pCachedFractal->SetGraininess(GetGraininess());
03632 }

BOOL NoiseFillAttribute::CopyBitmap KernelBitmap BmpToCopy  )  [virtual]
 

Used to copy a bitmap from one fill to another.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
See also:
BitmapFillAttribute::AttachBitmap()

Reimplemented from BitmapFillAttribute.

Definition at line 3688 of file fillval.cpp.

03689 {
03690     if (BmpToCopy != NULL)  // Is there a bitmap to copy ?
03691     {
03692         DetachBitmap();
03693 
03694         return AttachBitmap(BmpToCopy);
03695     }
03696 
03697     return TRUE;
03698 }

BOOL NoiseFillAttribute::DetachBitmap  )  [virtual]
 

Detaches a bitmap from this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/9/94
See also:
BitmapFillAttribute::AttachBitmap()

Reimplemented from BitmapFillAttribute.

Definition at line 3669 of file fillval.cpp.

03670 {
03671     if (GetBitmap() == NULL)
03672         return FALSE;
03673 
03674     if (GetApplication()->GetGlobalFractalList()->RemoveFractal(this) &&
03675         BitmapRef.GetBitmap())
03676     {
03677         // The fractal was deleted, so make sure we NULL our pointer
03678         BitmapRef.GetBitmap()->ActualBitmap = NULL;
03679     }
03680 
03681     // now make sure the kernelbitmap is dead too
03682     BitmapRef.DeleteBmp();
03683 
03684     return TRUE;
03685 }

virtual DocColour* NoiseFillAttribute::GetEndColour  )  [inline, virtual]
 

Gets the End colour of this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/1/95
Parameters:
- [INPUTS]

Reimplemented from BitmapFillAttribute.

Definition at line 865 of file fillval.h.

00865 { return &EndColour; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 861 of file fillval.h.

00861 { return dim; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 863 of file fillval.h.

00863 { return dpi; }

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

Reimplemented from BitmapFillAttribute.

Definition at line 889 of file fillval.h.

00889 { return(FILLSHAPE_PLASMA); }

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

Reimplemented from FillGeometryAttribute.

Definition at line 868 of file fillval.h.

00868 { return grain; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 867 of file fillval.h.

00867 { return seed; }

virtual DocColour* NoiseFillAttribute::GetStartColour  )  [inline, virtual]
 

Gets the Start colour of this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/1/95
Parameters:
- [INPUTS]

Reimplemented from BitmapFillAttribute.

Definition at line 864 of file fillval.h.

00864 { return &Colour; }

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

Reimplemented from FillGeometryAttribute.

Definition at line 862 of file fillval.h.

00862 { return tileable; }

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

Reimplemented from BitmapFillAttribute.

Definition at line 882 of file fillval.h.

00882 { return FALSE; }

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

Reimplemented from BitmapFillAttribute.

Definition at line 881 of file fillval.h.

00881 { return TRUE; }

virtual BOOL NoiseFillAttribute::IsANoiseFill  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 884 of file fillval.h.

00884 { return TRUE; }

virtual BOOL NoiseFillAttribute::IsATextureFill  )  [inline, virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 883 of file fillval.h.

00883 { return TRUE; }

BOOL NoiseFillAttribute::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 3635 of file fillval.cpp.

03636 {
03637     ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to NoiseFillAttribute::IsSameAsCachedFractal");
03638     ERROR3IF(!IS_A(pCachedFractal,NoiseFillAttribute), "Not a NoiseFillAttribute during NoiseFillAttribute::IsSameAsCachedFractal");
03639 
03640     return
03641     (   
03642         dim          == pCachedFractal->GetFractalDim()     &&
03643         tileable     == pCachedFractal->GetTileable()       &&
03644         seed         == pCachedFractal->GetSeed()           &&
03645         grain        == pCachedFractal->GetGraininess() 
03646     );
03647 }

NodeAttribute * NoiseFillAttribute::MakeNode  )  [virtual]
 

Make a AttrFlatColourFill node from this flat fill colour attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/8/94
Returns:
Pointer to the new node, or NULL if out of memory.

Errors: Out of memory

See also:
AttributeValue::MakeNode; AttrFlatColourFill

Reimplemented from BitmapFillAttribute.

Definition at line 3546 of file fillval.cpp.

03547 {
03548     // Create new attribute node
03549     AttrNoiseColourFill *pAttr = new AttrNoiseColourFill;
03550     if (pAttr==NULL)
03551         // error message has already been set by new
03552         return NULL;
03553 
03554     // Copy attribute value into the new node.
03555     pAttr->GetAttributeValue()->SimpleCopy(this);
03556 
03557     // Return the new node
03558     return pAttr;
03559 }

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

Make the Attribute the same as the other.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/94
Parameters:
FillAttrib - the attribute to copy, which must be an AttrFillGeometry [INPUTS]
Returns:
A reference

Reimplemented from BitmapFillAttribute.

Definition at line 3562 of file fillval.cpp.

03563 {
03564     if (FillAttrib.IsKindOf(CC_RUNTIME_CLASS(NoiseFillAttribute)))
03565     {
03566         tileable    = ((NoiseFillAttribute*)&FillAttrib)->tileable;
03567         grain       = ((NoiseFillAttribute*)&FillAttrib)->grain;
03568         seed        = ((NoiseFillAttribute*)&FillAttrib)->seed;
03569         dim         = ((NoiseFillAttribute*)&FillAttrib)->dim;
03570         dpi         = ((NoiseFillAttribute*)&FillAttrib)->dpi;
03571     }
03572     
03573     return ColourFillAttribute::operator=(FillAttrib);
03574 }

INT32 NoiseFillAttribute::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 BitmapFillAttribute.

Definition at line 3577 of file fillval.cpp.

03578 {
03579     // is this the same class of object?
03580     if (GetRuntimeClass() != Attrib.GetRuntimeClass())
03581         return FALSE;
03582 
03583     NoiseFillAttribute* pAttrib = (NoiseFillAttribute*)&Attrib;
03584 
03585     if (IsPerspective())
03586     { 
03587         if (!pAttrib->IsPerspective())
03588             return FALSE;
03589 
03590         if (*GetEndPoint3() != *pAttrib->GetEndPoint3())
03591             return FALSE;
03592     }
03593 
03594     // check the colour ramps match
03595     if (!SameColourRampAs(pAttrib->GetColourRamp()))
03596         return FALSE;
03597 
03598     return 
03599     (
03600         *GetStartColour()   == *pAttrib->GetStartColour()   &&
03601         *GetEndColour()     == *pAttrib->GetEndColour()     &&
03602     
03603         *GetStartPoint()    == *pAttrib->GetStartPoint()    &&
03604         *GetEndPoint()      == *pAttrib->GetEndPoint()      &&
03605         *GetEndPoint2()     == *pAttrib->GetEndPoint2()     &&
03606 
03607         dim                 == pAttrib->dim                 &&
03608         dpi                 == pAttrib->dpi                 &&
03609         tileable            == pAttrib->tileable            &&
03610 
03611         grain               == pAttrib->grain               &&
03612         seed                == pAttrib->seed
03613     ); 
03614 }

BOOL NoiseFillAttribute::RecalcFractal  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 3745 of file fillval.cpp.

03746 {
03747     if (*GetStartPoint() == *GetEndPoint() ||
03748         *GetStartPoint() == *GetEndPoint2())
03749     {
03750         return FALSE;
03751     }
03752 
03753     KernelBitmap* pBitmap = GenerateNoiseBitmap(grain,seed);
03754     if (pBitmap == NULL)
03755     {
03756         TRACEUSER( "Mike", _T("Noisy fractal Failed !!!\n"));
03757         return FALSE;   // Error set by GenerateFractalBitmap
03758     }
03759 
03760     AttachBitmap(pBitmap);
03761     delete pBitmap;
03762 
03763     return TRUE;
03764 }

void NoiseFillAttribute::SetEndColour DocColour NewCol  )  [virtual]
 

Sets the end colour of this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/94
Parameters:
- [INPUTS]

Reimplemented from BitmapFillAttribute.

Definition at line 3726 of file fillval.cpp.

03727 {
03728     if (NewCol == NULL)
03729     {
03730         AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
03731                                             _R(IDS_BLACKNAME), &EndColour);
03732 
03733         if (Colour == EndColour)
03734         {
03735             AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
03736                                                 _R(IDS_WHITENAME), &EndColour);
03737         }
03738     }
03739     else
03740         EndColour = *NewCol;
03741 }

void NoiseFillAttribute::SetFractalDim UINT32  NewDim  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 3775 of file fillval.cpp.

03776 {
03777     dim=NewDim;
03778 }

BOOL NoiseFillAttribute::SetFractalDPI UINT32  NewDpi  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 3789 of file fillval.cpp.

03790 {
03791     dpi = NewDpi;
03792 
03793     return TRUE;
03794 }

BOOL NoiseFillAttribute::SetGraininess FIXED16  NewGrain  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 3797 of file fillval.cpp.

03798 {
03799     DetachBitmap();     // Ensure the current fractal is removed from cache
03800 
03801     if (NewGrain<0) NewGrain=0;
03802     if (NewGrain>100) NewGrain=100;
03803     grain = NewGrain;   
03804 
03805     return TRUE;
03806 }

BOOL NoiseFillAttribute::SetSeed INT32  NewSeed  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 3809 of file fillval.cpp.

03810 {
03811     DetachBitmap();     // Ensure the current fractal is removed from cache
03812 
03813     seed = NewSeed; 
03814 
03815     return TRUE;
03816 }

void NoiseFillAttribute::SetStartColour DocColour NewCol  )  [virtual]
 

Sets the start colour of this fill.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/9/94
Parameters:
- [INPUTS]

Reimplemented from BitmapFillAttribute.

Definition at line 3708 of file fillval.cpp.

03709 {
03710     if (NewCol == NULL)
03711     {
03712         AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
03713                                             _R(IDS_WHITENAME), &Colour);
03714 
03715         if (Colour == EndColour)
03716         {
03717             AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
03718                                                 _R(IDS_BLACKNAME), &Colour);
03719         }
03720     }
03721     else
03722         Colour = *NewCol;
03723 }

void NoiseFillAttribute::SetTesselation INT32  NewTess  )  [virtual]
 

Reimplemented from BitmapFillAttribute.

Definition at line 3767 of file fillval.cpp.

03768 {
03769     if (NewTess == RT_NoRepeatType)
03770         NewTess = RT_Repeating;
03771 
03772     Tesselation = NewTess;
03773 }

BOOL NoiseFillAttribute::SetTileable BOOL  NewTile  )  [virtual]
 

Reimplemented from FillGeometryAttribute.

Definition at line 3780 of file fillval.cpp.

03781 {
03782     DetachBitmap();     // Ensure the current fractal is removed from cache
03783 
03784     tileable = NewTile;
03785 
03786     return TRUE;
03787 }

void NoiseFillAttribute::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 BitmapFillAttribute.

Definition at line 3701 of file fillval.cpp.

03702 {
03703     // Just use the assignment operator
03704     *this = *(FillGeometryAttribute*)pValue;
03705 }


Member Data Documentation

UINT32 NoiseFillAttribute::dim [private]
 

Definition at line 895 of file fillval.h.

UINT32 NoiseFillAttribute::dpi [private]
 

Definition at line 893 of file fillval.h.

FIXED16 NoiseFillAttribute::grain [private]
 

Definition at line 898 of file fillval.h.

INT32 NoiseFillAttribute::seed [private]
 

Definition at line 892 of file fillval.h.

BOOL NoiseFillAttribute::tileable [private]
 

Definition at line 894 of file fillval.h.


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