1 // Polygon.h 2 3 #ifndef IFS_H 4 #define IFS_H 5 6 #include <Screen.h> 7 #include <Point.h> 8 #include <Rect.h> 9 #include <Region.h> 10 11 typedef struct Similitude_Struct SIMI; 12 typedef struct Fractal_Struct FRACTAL; 13 14 #define FIX 12 15 #define UNIT ( 1<<FIX ) 16 #define MAX_SIMI 6 17 18 // settings for a PC 120Mhz... 19 #define MAX_DEPTH_2 10 20 #define MAX_DEPTH_3 6 21 #define MAX_DEPTH_4 4 22 #define MAX_DEPTH_5 3 23 24 struct buffer_info { 25 void* bits; 26 uint32 bytesPerRow; 27 uint32 bits_per_pixel; 28 color_space format; 29 clipping_rect bounds; 30 }; 31 32 struct Point { 33 int32 x; 34 int32 y; 35 }; 36 37 struct Similitude_Struct { 38 39 float c_x, c_y; 40 float r, r2, A, A2; 41 int32 Ct, St, Ct2, St2; 42 int32 Cx, Cy; 43 int32 R, R2; 44 }; 45 46 struct Fractal_Struct { 47 48 int Nb_Simi; 49 SIMI Components[5 * MAX_SIMI]; 50 int Depth, Col; 51 int Count, Speed; 52 int Width, Height, Lx, Ly; 53 float r_mean, dr_mean, dr2_mean; 54 int Cur_Pt, Max_Pt; 55 Point* buffer1; 56 Point* buffer2; 57 BBitmap* bitmap; 58 BBitmap* markBitmap; 59 }; 60 61 class IFS { 62 public: 63 IFS(BRect bounds); 64 virtual ~IFS(); 65 66 void Draw(BView* view, const buffer_info* info, 67 int32 frames); 68 69 void SetAdditive(bool additive); 70 void SetSpeed(int32 speed); 71 72 private: 73 void _DrawFractal(BView* view, 74 const buffer_info* info); 75 void _Trace(FRACTAL* F, 76 int32 xo, int32 yo); 77 void _RandomSimis(FRACTAL* f, 78 SIMI* cur, 79 int i) const; 80 void _FreeBuffers(FRACTAL* f); 81 void _FreeIFS(FRACTAL* f); 82 83 84 FRACTAL* fRoot; 85 FRACTAL* fCurrentFractal; 86 Point* fPointBuffer; 87 int32 fCurrentPoint; 88 89 bool fAdditive; 90 uint8 fCurrentMarkValue; 91 }; 92 93 #endif // ABOUT_VPOLYGON_HIEW_H 94