#include <fillval.h>
Inheritance diagram for FractalTranspFillAttribute:
Public Member Functions | |
FractalTranspFillAttribute () | |
Default Constuctor for fill attribute values. | |
~FractalTranspFillAttribute () | |
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) |
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 | Randomise () |
virtual BOOL | RecalcFractal () |
Recalculates the Fractal. | |
virtual UINT32 | GetFractalDim () |
virtual BOOL | GetTileable () |
virtual UINT32 | GetFractalDPI () |
virtual INT32 | GetSeed () |
virtual FIXED16 | GetGraininess () |
virtual FIXED16 | GetGravity () |
virtual FIXED16 | GetSquash () |
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 | SetGravity (FIXED16 NewGrav) |
virtual BOOL | SetSquash (FIXED16 NewSquash) |
virtual BOOL | IsAKindOfBitmapFill () |
virtual BOOL | IsABitmapFill () |
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 ColourFillAttribute * | MakeSimilarNonTranspFillGeometry (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 () |
Public Attributes | |
INT32 | Seed |
FIXED16 | Graininess |
FIXED16 | Gravity |
FIXED16 | Squash |
INT32 | Dpi |
BOOL | Tileable |
Protected Attributes | |
INT32 | Dim |
Definition at line 1457 of file fillval.h.
|
Default Constuctor for fill attribute values.
Definition at line 6799 of file fillval.cpp. 06800 { 06801 MonotonicTime time; 06802 Seed = time.Sample(); 06803 06804 Graininess = AttrFillGeometry::FractalGraininess; 06805 Gravity = AttrFillGeometry::FractalGravity; 06806 Dpi = AttrFillGeometry::FractalDPI; 06807 06808 Squash = 0; 06809 Dim = 0; 06810 Tileable = FALSE; 06811 06812 Tesselation = RT_RepeatInverted; 06813 }
|
|
Destructor for fractal fill attribute values.
Definition at line 6826 of file fillval.cpp. 06827 { 06828 DetachBitmap(); 06829 }
|
|
Attaches a bitmap to this fill.
Reimplemented from BitmapTranspFillAttribute. Definition at line 7026 of file fillval.cpp. 07027 { 07028 // Sometimes we are asked to attach the same bitmap to the attribute 07029 // So if we try to detach it and then attach it, during the detach 07030 // the bitmap can get deleted, so then we will effectivelly attach 07031 // a deleted bitmap. To avoid this we add this fractal to the list again in 07032 // order to increment the usage count, then do the normal detach & attach 07033 // and finally remove the additional fractal from the list 07034 BOOL NeedUsageIncrement = FALSE; 07035 if ((NewBitmap != NULL) && (GetBitmap() != NULL)) 07036 { 07037 // only if the bitmap we have is the same as the one we are to attach 07038 if ((GetBitmap()->ActualBitmap != NULL) && 07039 (GetBitmap()->ActualBitmap == NewBitmap->ActualBitmap)) 07040 { 07041 NeedUsageIncrement = TRUE; // set the flag 07042 GetApplication()->GetGlobalFractalList()->AddFractal(this); // inc the usage count 07043 TRACEUSER( "Stefan", _T("NeedUsageIncrement = TRUE\n")); 07044 } 07045 } 07046 07047 // get rid of the old bitmap 07048 DetachBitmap(); 07049 07050 if (NewBitmap == NULL) 07051 return FALSE; 07052 07053 OILBitmap* Bmp = NewBitmap->ActualBitmap; 07054 if (Bmp == NULL || !Bmp->IsTemp()) 07055 return FALSE; 07056 07057 NewBitmap = new KernelBitmap(Bmp, TRUE); 07058 BitmapRef.SetBitmap(NewBitmap); 07059 GetApplication()->GetGlobalFractalList()->AddFractal(this); 07060 07061 // if we added an additional fractal, remove it 07062 if (NeedUsageIncrement) 07063 GetApplication()->GetGlobalFractalList()->RemoveFractal(this); 07064 07065 return TRUE; 07066 }
|
|
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 6962 of file fillval.cpp. 06963 { 06964 ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to FractalTranspFillAttribute::CacheFractalData"); 06965 ERROR3IF(!IS_A(pCachedFractal,FractalTranspFillAttribute), "Not a FractalTranspFillAttribute during FractalTranspFillAttribute::CacheFractalData"); 06966 06967 pCachedFractal->SetStartPoint(GetStartPoint()); 06968 pCachedFractal->SetEndPoint(GetEndPoint()); 06969 pCachedFractal->SetEndPoint2(GetEndPoint2()); 06970 06971 pCachedFractal->SetFractalDPI(GetFractalDPI()); 06972 pCachedFractal->SetFractalDim(GetFractalDim()); 06973 pCachedFractal->SetTileable(GetTileable()); 06974 06975 pCachedFractal->SetSeed(GetSeed()); 06976 pCachedFractal->SetGraininess(GetGraininess()); 06977 pCachedFractal->SetGravity(GetGravity()); 06978 pCachedFractal->SetSquash(GetSquash()); 06979 }
|
|
Used to copy a bitmap from one fill to another.
Reimplemented from BitmapTranspFillAttribute. Definition at line 7106 of file fillval.cpp. 07107 { 07108 if (BmpToCopy != NULL) // Is there a bitmap to copy ? 07109 { 07110 DetachBitmap(); 07111 07112 return AttachBitmap(BmpToCopy); 07113 } 07114 07115 return TRUE; 07116 }
|
|
Detaches a bitmap from this fill.
Reimplemented from BitmapTranspFillAttribute. Definition at line 7079 of file fillval.cpp. 07080 { 07081 if (GetBitmap() == NULL) 07082 return FALSE; 07083 07084 if (GetApplication()->GetGlobalFractalList()->RemoveFractal(this) && BitmapRef.GetBitmap()) 07085 { 07086 // The fractal was deleted, so make sure we NULL our pointer 07087 BitmapRef.GetBitmap()->ActualBitmap = NULL; 07088 } 07089 07090 BitmapRef.DeleteBmp(); 07091 07092 return TRUE; 07093 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1477 of file fillval.h. 01477 { return Dim; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1479 of file fillval.h. 01479 { return Dpi; }
|
|
Reimplemented from BitmapTranspFillAttribute. Definition at line 1505 of file fillval.h. 01505 { return(FILLSHAPE_CLOUDS); }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1482 of file fillval.h. 01482 { return Graininess; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1483 of file fillval.h. 01483 { return Gravity; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1481 of file fillval.h. 01481 { return Seed; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1484 of file fillval.h. 01484 { return Squash; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1478 of file fillval.h. 01478 { return Tileable; }
|
|
Reimplemented from BitmapTranspFillAttribute. Definition at line 1497 of file fillval.h. 01497 { return FALSE; }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 1498 of file fillval.h. 01498 { return TRUE; }
|
|
Reimplemented from BitmapTranspFillAttribute. Definition at line 1496 of file fillval.h. 01496 { return TRUE; }
|
|
A virtual comparison operator used by the fractal cache to check for a matching fractal.
Reimplemented from FillGeometryAttribute. Definition at line 6996 of file fillval.cpp. 06997 { 06998 ERROR3IF(pCachedFractal==NULL, "NULL pointer passed to FractalTranspFillAttribute::IsSameAsCachedFractal"); 06999 ERROR3IF(!IS_A(pCachedFractal,FractalTranspFillAttribute), "Not a FractalTranspFillAttribute during FractalTranspFillAttribute::IsSameAsCachedFractal"); 07000 07001 // a long winded check but separate lines help in debugging, i.e. when does ok go FALSE? 07002 BOOL ok = ((UINT32)Dim == pCachedFractal->GetFractalDim()); 07003 // ok = ok && (Dpi == pCachedFractal->GetFractalDpi()); // not checked in Will's original code 07004 ok = ok && (Tileable == pCachedFractal->GetTileable()); 07005 07006 ok = ok && (Seed == pCachedFractal->GetSeed()); 07007 ok = ok && (Graininess == pCachedFractal->GetGraininess()); 07008 ok = ok && (Gravity == pCachedFractal->GetGravity()); 07009 ok = ok && (Squash == pCachedFractal->GetSquash()); 07010 07011 return ok; 07012 }
|
|
Make a AttrFlatColourFill node from this flat fill colour attribute.
Reimplemented from BitmapTranspFillAttribute. Definition at line 6844 of file fillval.cpp. 06845 { 06846 // Create new attribute node 06847 AttrFractalFill *pAttr = new AttrFractalTranspFill; 06848 if (pAttr==NULL) 06849 // error message has already been set by new 06850 return NULL; 06851 06852 // Copy attribute value into the new node. 06853 pAttr->GetAttributeValue()->SimpleCopy(this); 06854 06855 // Return the new node 06856 return pAttr; 06857 }
|
|
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).
Reimplemented from BitmapTranspFillAttribute. Definition at line 7291 of file fillval.cpp. 07292 { 07293 UINT32 *pStartTransp = GetStartTransp(); 07294 UINT32 *pEndTransp = GetEndTransp(); 07295 07296 if(pStartTransp == NULL || pEndTransp == NULL) 07297 return NULL; 07298 07299 FractalFillAttribute *pNewAttr = new FractalFillAttribute; 07300 if (pNewAttr != NULL) 07301 { 07302 pNewAttr->SetStartPoint(GetStartPoint()); 07303 pNewAttr->SetEndPoint(GetEndPoint()); 07304 pNewAttr->SetEndPoint2(GetEndPoint2()); 07305 pNewAttr->SetEndPoint3(GetEndPoint3()); 07306 07307 pNewAttr->SetTesselation(GetTesselation()); 07308 pNewAttr->SetDPI(GetDPI()); 07309 if(IsPerspective()) 07310 pNewAttr->MakePerspective(); 07311 07312 pNewAttr->AttachBitmap(GetBitmap()); 07313 pNewAttr->SetFractalDim(GetFractalDim()); 07314 pNewAttr->SetTileable(GetTileable()); 07315 pNewAttr->SetFractalDPI(GetFractalDPI()); 07316 pNewAttr->SetSeed(GetSeed()); 07317 pNewAttr->SetNoiseScale(GetNoiseScale()); 07318 07319 pNewAttr->SetGraininess(GetGraininess()); 07320 pNewAttr->SetGravity(GetGravity()); 07321 pNewAttr->SetSquash(GetSquash()); 07322 07323 INT32 StartTransparency = 255 - (INT32)(((double)(255 - *pStartTransp)) * TransparencyScale); 07324 INT32 EndTransparency = 255 - (INT32)(((double)(255 - *pEndTransp)) * TransparencyScale); 07325 07326 DocColour colorStart(StartTransparency, StartTransparency, StartTransparency); 07327 DocColour colorEnd1(EndTransparency, EndTransparency, EndTransparency); 07328 pNewAttr->SetStartColour(&colorStart); 07329 pNewAttr->SetEndColour(&colorEnd1); 07330 07331 pNewAttr->RecalcFractal(); 07332 } 07333 07334 return(pNewAttr); 07335 }
|
|
Make the Attribute the same as the other.
Reimplemented from BitmapTranspFillAttribute. Definition at line 6874 of file fillval.cpp. 06875 { 06876 if (FillAttrib.IsKindOf(CC_RUNTIME_CLASS(FractalTranspFillAttribute))) 06877 { 06878 Seed = ((FractalTranspFillAttribute*)&FillAttrib)->Seed; 06879 Graininess = ((FractalTranspFillAttribute*)&FillAttrib)->Graininess; 06880 Gravity = ((FractalTranspFillAttribute*)&FillAttrib)->Gravity; 06881 Squash = ((FractalTranspFillAttribute*)&FillAttrib)->Squash; 06882 Dpi = ((FractalTranspFillAttribute*)&FillAttrib)->Dpi; 06883 Tileable = ((FractalTranspFillAttribute*)&FillAttrib)->Tileable; 06884 Dim = ((FractalTranspFillAttribute*)&FillAttrib)->Dim; 06885 } 06886 06887 return TranspFillAttribute::operator=(FillAttrib); 06888 }
|
|
A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
Reimplemented from BitmapTranspFillAttribute. Definition at line 6906 of file fillval.cpp. 06907 { 06908 if (GetRuntimeClass() != Attrib.GetRuntimeClass()) 06909 return FALSE; 06910 06911 FractalTranspFillAttribute* pAttrib = (FractalTranspFillAttribute*)&Attrib; 06912 06913 if (IsPerspective()) 06914 { 06915 if (!pAttrib->IsPerspective()) 06916 return FALSE; 06917 06918 if (*GetEndPoint3() != *pAttrib->GetEndPoint3()) 06919 return FALSE; 06920 } 06921 06922 // check the transparency ramp matches 06923 if (!SameTransparencyRampAs(pAttrib->GetTranspRamp())) 06924 return FALSE; 06925 06926 // Are the Colours and Control points all the same ? 06927 return ( 06928 06929 *GetStartTransp() == *pAttrib->GetStartTransp() && 06930 *GetEndTransp() == *pAttrib->GetEndTransp() && 06931 06932 *GetStartPoint() == *pAttrib->GetStartPoint() && 06933 *GetEndPoint() == *pAttrib->GetEndPoint() && 06934 *GetEndPoint2() == *pAttrib->GetEndPoint2() && 06935 06936 GetTranspType() == pAttrib->GetTranspType() && 06937 06938 Seed == pAttrib->Seed && 06939 Graininess == pAttrib->Graininess && 06940 Gravity == pAttrib->Gravity && 06941 Squash == pAttrib->Squash && 06942 Dpi == pAttrib->Dpi && 06943 Tileable == pAttrib->Tileable && 06944 Dim == pAttrib->Dim 06945 ); 06946 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7261 of file fillval.cpp. 07262 { 07263 DetachBitmap(); // Ensure the current fractal is removed from cache 07264 07265 MonotonicTime time; 07266 Seed = time.Sample(); 07267 07268 return TRUE; 07269 }
|
|
Recalculates the Fractal.
Reimplemented from FillGeometryAttribute. Definition at line 7149 of file fillval.cpp. 07150 { 07151 if (*GetStartPoint() == *GetEndPoint() || 07152 *GetStartPoint() == *GetEndPoint2()) 07153 { 07154 return FALSE; 07155 } 07156 07157 UINT32 OldDim = GetFractalDim(); 07158 07159 KernelBitmap* pBitmap = GenerateFractalBitmap( Seed, 07160 Graininess.MakeDouble(), 07161 Gravity.MakeDouble(), 07162 Squash.MakeDouble(), 07163 Dpi); 07164 if (pBitmap == NULL) 07165 { 07166 TRACEUSER( "Mike", _T("Fractal Failed !!!\n")); 07167 return FALSE; // Error set by GenerateFractalBitmap 07168 } 07169 07170 // When asking GenerateFractalBitmap above to give us a bitmap, it might modify the Dim value. 07171 // DetachBitmap then tries to match this fractal with the cached fractals, so it could find a 07172 // wrong cached fractal (one with the same parameters as this, but with Dim value as set by 07173 // GenerateFractalBitmap, rather then the original value). In this case DetachBitmap acts on 07174 // the wrong fractal and could even cause destroying its bitmap, even though it is used by 07175 // some other attribute. To fix this we temporarily set Dim to the old value, call DetachBitmap 07176 // and then set the new value back. 07177 UINT32 NewDim = GetFractalDim(); 07178 if (NewDim != OldDim) 07179 { 07180 SetFractalDim(OldDim); 07181 DetachBitmap(); 07182 07183 SetFractalDim(NewDim); 07184 } 07185 07186 AttachBitmap(pBitmap); 07187 delete pBitmap; 07188 07189 return TRUE; 07190 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7202 of file fillval.cpp. 07203 { 07204 Dim = NewDim; 07205 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7216 of file fillval.cpp.
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7234 of file fillval.cpp. 07235 { 07236 DetachBitmap(); // Ensure the current fractal is removed from cache 07237 07238 Graininess = NewGrain; 07239 07240 return TRUE; 07241 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7243 of file fillval.cpp. 07244 { 07245 DetachBitmap(); // Ensure the current fractal is removed from cache 07246 07247 Gravity = NewGrav; 07248 07249 return TRUE; 07250 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7225 of file fillval.cpp. 07226 { 07227 DetachBitmap(); // Ensure the current fractal is removed from cache 07228 07229 Seed = NewSeed; 07230 07231 return TRUE; 07232 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7252 of file fillval.cpp. 07253 { 07254 DetachBitmap(); // Ensure the current fractal is removed from cache 07255 07256 Squash = NewSquash; 07257 07258 return TRUE; 07259 }
|
|
Reimplemented from BitmapTranspFillAttribute. Definition at line 7194 of file fillval.cpp. 07195 { 07196 if (NewTess == RT_NoRepeatType) 07197 NewTess = RT_RepeatInverted; 07198 07199 Tesselation = NewTess; 07200 }
|
|
Reimplemented from FillGeometryAttribute. Definition at line 7207 of file fillval.cpp. 07208 { 07209 DetachBitmap(); // Ensure the current fractal is removed from cache 07210 07211 Tileable = NewTile; 07212 07213 return TRUE; 07214 }
|
|
See AttributeValue::SimpleCopy.
Reimplemented from BitmapTranspFillAttribute. Definition at line 7131 of file fillval.cpp. 07132 { 07133 // Just use the assignment operator 07134 *this = *(FillGeometryAttribute*)pValue; 07135 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|