#include <fillval.h>
Inheritance diagram for FractalFillAttribute:
Public Member Functions | |
FractalFillAttribute () | |
Default Constuctor for fill attribute values. | |
~FractalFillAttribute () | |
Destructor for fractal fill attribute values. | |
virtual NodeAttribute * | MakeNode () |
Make a AttrFlatColourFill node from this flat fill colour attribute. | |
virtual void | SimpleCopy (AttributeValue *) |
See AttributeValue::SimpleCopy. | |
virtual FillGeometryAttribute & | operator= (FillGeometryAttribute &Attrib) |
Assign this with the value of 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 | Randomise () |
virtual BOOL | RecalcFractal () |
Recalculates the Fractal. | |
virtual UINT32 | GetFractalDim () |
virtual BOOL | GetTileable () |
virtual UINT32 | GetFractalDPI () |
virtual DocColour * | GetStartColour () |
Gets the Start colour of this fill. | |
virtual DocColour * | GetEndColour () |
Gets the End colour of this fill. | |
virtual INT32 | GetSeed () |
virtual FIXED16 | GetGraininess () |
virtual FIXED16 | GetGravity () |
virtual FIXED16 | GetSquash () |
virtual void | SetTesselation (INT32 NewTess) |
Set the prefered tesselation of this fractal. | |
virtual void | SetFractalDim (UINT32 NewDim) |
virtual BOOL | SetTileable (BOOL NewTile) |
virtual BOOL | SetFractalDPI (UINT32 NewDpi) |
Recalculates the Fractal at a new Dpi. | |
virtual void | SetStartColour (DocColour *) |
Sets the Start colour of this fill. | |
virtual void | SetEndColour (DocColour *) |
Sets the Start colour of this fill. | |
virtual BOOL | SetSeed (INT32 NewSeed) |
virtual BOOL | SetGraininess (FIXED16 NewGrain) |
virtual BOOL | SetGravity (FIXED16 NewGrav) |
virtual BOOL | SetSquash (FIXED16 NewSquash) |
virtual BOOL | IsAKindOfBitmapFill () |
virtual BOOL | IsABitmapFill () |
virtual BOOL | IsATextureFill () |
virtual BOOL | IsAFractalFill () |
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 () |
Public Attributes | |
INT32 | Seed |
FIXED16 | Graininess |
FIXED16 | Gravity |
FIXED16 | Squash |
INT32 | Dpi |
BOOL | Tileable |
Protected Attributes | |
INT32 | Dim |
Definition at line 913 of file fillval.h.
|
Default Constuctor for fill attribute values.
Definition at line 2957 of file fillval.cpp. 02958 { 02959 MonotonicTime time; 02960 Seed = time.Sample(); 02961 02962 Graininess = AttrFillGeometry::FractalGraininess; 02963 Gravity = AttrFillGeometry::FractalGravity; 02964 Dpi = AttrFillGeometry::FractalDPI; 02965 02966 Squash = 0; 02967 Dim = 0; 02968 Tileable = FALSE; 02969 02970 Tesselation = RT_RepeatInverted; 02971 }
|
|
Destructor for fractal fill attribute values.
Definition at line 2984 of file fillval.cpp. 02985 { 02986 DetachBitmap(); 02987 }
|
|
Attaches a bitmap to this fill.
Reimplemented from BitmapFillAttribute. Definition at line 3177 of file fillval.cpp. 03178 { 03179 // Sometimes we are asked to attach the same bitmap to the attribute 03180 // So if we try to detach it and then attach it, during the detach 03181 // the bitmap can get deleted, so then we will effectivelly attach 03182 // a deleted bitmap. To avoid this we add this fractal to the list again in 03183 // order to increment the usage count, then do the normal detach & attach 03184 // and finally remove the additional fractal from the list 03185 BOOL NeedUsageIncrement = FALSE; 03186 if ((NewBitmap != NULL) && (GetBitmap() != NULL)) 03187 { 03188 // only if the bitmap we have is the same as the one we are to attach 03189 if ((GetBitmap()->ActualBitmap != NULL) && 03190 (GetBitmap()->ActualBitmap == NewBitmap->ActualBitmap)) 03191 { 03192 NeedUsageIncrement = TRUE; // set the flag 03193 GetApplication()->GetGlobalFractalList()->AddFractal(this); // inc the usage count 03194 TRACEUSER( "Stefan", _T("NeedUsageIncrement = TRUE\n")); 03195 } 03196 } 03197 03198 // get rid of the old bitmap 03199 DetachBitmap(); 03200 03201 if (NewBitmap == NULL) 03202 return FALSE; 03203 03204 OILBitmap* Bmp = NewBitmap->ActualBitmap; 03205 if (Bmp == NULL || !Bmp->IsTemp()) 03206 return FALSE; 03207 03208 NewBitmap = new KernelBitmap(Bmp, TRUE); 03209 BitmapRef.SetBitmap(NewBitmap); 03210 GetApplication()->GetGlobalFractalList()->AddFractal(this); 03211 03212 // if we added an additional fractal, remove it 03213 if (NeedUsageIncrement) 03214 GetApplication()->GetGlobalFractalList()->RemoveFractal(this); 03215 03216 return TRUE; 03217 }
|
|
Copies any data from this FractalFillAttribute into the cached fractal pointed to on entry. This data is then checked via IsSameAsCachedFractal.
Reimplemented from FillGeometryAttribute. Definition at line 3116 of file fillval.cpp. 03117 { 03118 ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to FractalFillAttribute::CacheFractalData"); 03119 ERROR3IF(!IS_A(pCachedFractal,FractalFillAttribute), "Not a FractalFillAttribute during FractalFillAttribute::CacheFractalData"); 03120 03121 pCachedFractal->SetStartPoint(GetStartPoint()); 03122 pCachedFractal->SetEndPoint(GetEndPoint()); 03123 pCachedFractal->SetEndPoint2(GetEndPoint2()); 03124 03125 pCachedFractal->SetSeed(GetSeed()); 03126 pCachedFractal->SetGraininess(GetGraininess()); 03127 pCachedFractal->SetGravity(GetGravity()); 03128 pCachedFractal->SetSquash(GetSquash()); 03129 pCachedFractal->SetTileable(GetTileable()); 03130 pCachedFractal->SetFractalDPI(GetFractalDPI()); 03131 pCachedFractal->SetFractalDim(GetFractalDim()); 03132 }
|
|
Used to copy a bitmap from one fill to another.
Reimplemented from BitmapFillAttribute. Definition at line 3258 of file fillval.cpp. 03259 { 03260 if (BmpToCopy != NULL) // Is there a bitmap to copy ? 03261 { 03262 return AttachBitmap(BmpToCopy); 03263 } 03264 03265 return TRUE; 03266 }
|
|
Detaches a bitmap from this fill.
Reimplemented from BitmapFillAttribute. Definition at line 3230 of file fillval.cpp. 03231 { 03232 if (GetBitmap() == NULL) 03233 return FALSE; 03234 03235 if (GetApplication()->GetGlobalFractalList()->RemoveFractal(this) && BitmapRef.GetBitmap()) 03236 { 03237 // The fractal was deleted, so make sure we NULL our pointer 03238 BitmapRef.GetBitmap()->ActualBitmap = NULL; 03239 } 03240 03241 // now make sure the kernelbitmap is dead too 03242 BitmapRef.DeleteBmp(); 03243 03244 return TRUE; 03245 }
|
|
Gets the End colour of this fill.
Reimplemented from BitmapFillAttribute. Definition at line 938 of file fillval.h. 00938 { return &EndColour; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 933 of file fillval.h. 00933 { return Dim; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 935 of file fillval.h. 00935 { return Dpi; }
|
|
Reimplemented from BitmapFillAttribute. Definition at line 967 of file fillval.h. 00967 { return(FILLSHAPE_CLOUDS); }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 941 of file fillval.h. 00941 { return Graininess; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 942 of file fillval.h. 00942 { return Gravity; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 940 of file fillval.h. 00940 { return Seed; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 943 of file fillval.h. 00943 { return Squash; }
|
|
Gets the Start colour of this fill.
Reimplemented from BitmapFillAttribute. Definition at line 937 of file fillval.h. 00937 { return &Colour; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 934 of file fillval.h. 00934 { return Tileable; }
|
|
Reimplemented from BitmapFillAttribute. Definition at line 959 of file fillval.h. 00959 { return FALSE; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 961 of file fillval.h. 00961 { return TRUE; }
|
|
Reimplemented from BitmapFillAttribute. Definition at line 958 of file fillval.h. 00958 { return TRUE; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 960 of file fillval.h. 00960 { return TRUE; }
|
|
A virtual comparison operator used by the fractal cache to check for a matching fractal.
Reimplemented from FillGeometryAttribute. Definition at line 3149 of file fillval.cpp. 03150 { 03151 ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to FractalFillAttribute::IsSameAsCachedFractal"); 03152 ERROR3IF(!IS_A(pCachedFractal,FractalFillAttribute), "Not a FractalFillAttribute during FractalFillAttribute::IsSameAsCachedFractal"); 03153 03154 // a long winded check but separate lines help in debugging, i.e. when does ok go FALSE 03155 BOOL ok = (Seed == pCachedFractal->GetSeed()); 03156 ok = ok && (Graininess == pCachedFractal->GetGraininess()); 03157 ok = ok && (Gravity == pCachedFractal->GetGravity()); 03158 ok = ok && (Squash == pCachedFractal->GetSquash()); 03159 ok = ok && (Tileable == pCachedFractal->GetTileable()); 03160 ok = ok && ((UINT32)Dim == pCachedFractal->GetFractalDim()); 03161 //ok = ok && (Dpi == pCachedFractal->GetFractalDpi()); // not checked in Will's original code 03162 return ok; 03163 }
|
|
Make a AttrFlatColourFill node from this flat fill colour attribute.
Reimplemented from BitmapFillAttribute. Definition at line 3002 of file fillval.cpp. 03003 { 03004 // Create new attribute node 03005 AttrFractalColourFill *pAttr = new AttrFractalColourFill; 03006 if (pAttr==NULL) 03007 // error message has already been set by new 03008 return NULL; 03009 03010 // Copy attribute value into the new node. 03011 pAttr->GetAttributeValue()->SimpleCopy(this); 03012 03013 // Return the new node 03014 return pAttr; 03015 }
|
|
Assign this with the value of FillAttrib.
Reimplemented from BitmapFillAttribute. Definition at line 3029 of file fillval.cpp. 03030 { 03031 if (FillAttrib.IsKindOf(CC_RUNTIME_CLASS(FractalFillAttribute))) 03032 { 03033 Seed = ((FractalFillAttribute*)&FillAttrib)->Seed; 03034 Graininess = ((FractalFillAttribute*)&FillAttrib)->Graininess; 03035 Gravity = ((FractalFillAttribute*)&FillAttrib)->Gravity; 03036 Squash = ((FractalFillAttribute*)&FillAttrib)->Squash; 03037 Dpi = ((FractalFillAttribute*)&FillAttrib)->Dpi; 03038 Tileable = ((FractalFillAttribute*)&FillAttrib)->Tileable; 03039 Dim = ((FractalFillAttribute*)&FillAttrib)->Dim; 03040 } 03041 03042 return ColourFillAttribute::operator=(FillAttrib); 03043 }
|
|
A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
Reimplemented from BitmapFillAttribute. Definition at line 3061 of file fillval.cpp. 03062 { 03063 if (GetRuntimeClass() != Attrib.GetRuntimeClass()) 03064 return FALSE; 03065 03066 FractalFillAttribute* pAttrib = (FractalFillAttribute*)&Attrib; 03067 03068 if (IsPerspective()) 03069 { 03070 if (!pAttrib->IsPerspective()) 03071 return FALSE; 03072 03073 if (*GetEndPoint3() != *pAttrib->GetEndPoint3()) 03074 return FALSE; 03075 } 03076 03077 // check the colour ramps match 03078 if (!SameColourRampAs(pAttrib->GetColourRamp())) 03079 return FALSE; 03080 03081 // Are the Colours and Control points all the same ? 03082 03083 return ( 03084 03085 *GetStartColour() == *pAttrib->GetStartColour() && 03086 *GetEndColour() == *pAttrib->GetEndColour() && 03087 03088 *GetStartPoint() == *pAttrib->GetStartPoint() && 03089 *GetEndPoint() == *pAttrib->GetEndPoint() && 03090 *GetEndPoint2() == *pAttrib->GetEndPoint2() && 03091 03092 Seed == pAttrib->Seed && 03093 Graininess == pAttrib->Graininess && 03094 Gravity == pAttrib->Gravity && 03095 Squash == pAttrib->Squash && 03096 Dpi == pAttrib->Dpi && 03097 Tileable == pAttrib->Tileable && 03098 Dim == pAttrib->Dim 03099 ); 03100 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 3499 of file fillval.cpp. 03500 { 03501 DetachBitmap(); // Ensure the current fractal is removed from cache 03502 03503 MonotonicTime time; 03504 Seed = time.Sample(); 03505 03506 return TRUE; 03507 }
|
|
Recalculates the Fractal.
Reimplemented from FillGeometryAttribute. Definition at line 3358 of file fillval.cpp. 03359 { 03360 if (*GetStartPoint() == *GetEndPoint() || 03361 *GetStartPoint() == *GetEndPoint2()) 03362 { 03363 return FALSE; 03364 } 03365 03366 UINT32 OldDim = GetFractalDim(); 03367 03368 KernelBitmap* pBitmap = GenerateFractalBitmap( Seed, 03369 Graininess.MakeDouble(), 03370 Gravity.MakeDouble(), 03371 Squash.MakeDouble(), 03372 Dpi); 03373 03374 if (pBitmap == NULL) 03375 { 03376 TRACEUSER( "Mike", _T("Fractal Failed !!!\n")); 03377 return FALSE; // Error set by GenerateFractalBitmap 03378 } 03379 03380 // When asking GenerateFractalBitmap above to give us a bitmap, it might modify the Dim value. 03381 // DetachBitmap then tries to match this fractal with the cached fractals, so it could find a 03382 // wrong cached fractal (one with the same parameters as this, but with Dim value as set by 03383 // GenerateFractalBitmap, rather then the original value). In this case DetachBitmap acts on 03384 // the wrong fractal and could even cause destroying its bitmap, even though it is used by 03385 // some other attribute. To fix this we temporarily set Dim to the old value, call DetachBitmap 03386 // and then set the new value back. 03387 UINT32 NewDim = GetFractalDim(); 03388 if (NewDim != OldDim) 03389 { 03390 SetFractalDim(OldDim); 03391 DetachBitmap(); 03392 03393 SetFractalDim(NewDim); 03394 } 03395 03396 AttachBitmap(pBitmap); 03397 delete pBitmap; 03398 03399 return TRUE; 03400 }
|
|
Sets the Start colour of this fill.
Reimplemented from BitmapFillAttribute. Definition at line 3328 of file fillval.cpp. 03329 { 03330 if (NewCol == NULL) 03331 { 03332 AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(), 03333 _R(IDS_BLACKNAME), &EndColour); 03334 03335 if (Colour == EndColour) 03336 { 03337 AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(), 03338 _R(IDS_WHITENAME), &EndColour); 03339 } 03340 } 03341 else 03342 EndColour = *NewCol; 03343 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 3424 of file fillval.cpp. 03425 { 03426 Dim = NewDim; 03427 }
|
|
Recalculates the Fractal at a new Dpi.
Reimplemented from FillGeometryAttribute. Definition at line 3450 of file fillval.cpp.
|
|
Reimplemented from FillGeometryAttribute. Definition at line 3471 of file fillval.cpp. 03472 { 03473 DetachBitmap(); // Ensure the current fractal is removed from cache 03474 03475 Graininess = NewGrain; 03476 03477 return TRUE; 03478 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 3480 of file fillval.cpp. 03481 { 03482 DetachBitmap(); // Ensure the current fractal is removed from cache 03483 03484 Gravity = NewGrav; 03485 03486 return TRUE; 03487 }
|
|
Values local to this fractal type Reimplemented from FillGeometryAttribute. Definition at line 3462 of file fillval.cpp. 03463 { 03464 DetachBitmap(); // Ensure the current fractal is removed from cache 03465 03466 Seed = NewSeed; 03467 03468 return TRUE; 03469 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 3489 of file fillval.cpp. 03490 { 03491 DetachBitmap(); // Ensure the current fractal is removed from cache 03492 03493 Squash = NewSquash; 03494 03495 return TRUE; 03496 }
|
|
Sets the Start colour of this fill.
Reimplemented from BitmapFillAttribute. Definition at line 3300 of file fillval.cpp. 03301 { 03302 if (NewCol == NULL) 03303 { 03304 AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(), 03305 _R(IDS_WHITENAME), &Colour); 03306 03307 if (Colour == EndColour) 03308 { 03309 AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(), 03310 _R(IDS_BLACKNAME), &Colour); 03311 } 03312 } 03313 else 03314 Colour = *NewCol; 03315 }
|
|
Set the prefered tesselation of this fractal.
Reimplemented from BitmapFillAttribute. Definition at line 3416 of file fillval.cpp. 03417 { 03418 if (NewTess == RT_NoRepeatType) 03419 NewTess = RT_RepeatInverted; 03420 03421 Tesselation = NewTess; 03422 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 3429 of file fillval.cpp. 03430 { 03431 DetachBitmap(); // Ensure the current fractal is removed from cache 03432 03433 Tileable = NewTile; 03434 03435 return TRUE; 03436 }
|
|
See AttributeValue::SimpleCopy.
Reimplemented from BitmapFillAttribute. Definition at line 3281 of file fillval.cpp. 03282 { 03283 // Just use the assignment operator 03284 *this = *(FillGeometryAttribute*)pValue; 03285 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|