2 * Copyright 2016, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
6 * Augustin Cavalier <waddlesplash>
9 #ifndef FRACTALENGINE_H
10 #define FRACTALENGINE_H
12 #include <SupportDefs.h>
14 #include <Messenger.h>
19 class FractalEngine
: public BLooper
{
22 MSG_CHANGE_SET
= 'Frct',
30 FractalEngine(BHandler
* parent
, BLooper
* looper
);
33 virtual void MessageReceived(BMessage
* msg
);
36 BMessenger fMessenger
;
37 BBitmap
* fBitmapStandby
;
38 BBitmap
* fBitmapDisplay
;
41 thread_id fRenderThreads
[4];
43 sem_id fRenderFinishedSem
;
54 uint32 fRenderBufferLen
;
56 const uint8
* fColorset
;
58 int32 (FractalEngine::*fDoSet
)(double real
, double imaginary
);
60 void Render(double locationX
, double locationY
, double size
);
61 static status_t
RenderThread(void* data
);
62 void RenderPixel(uint32 x
, uint32 y
, double real
, double imaginary
);
64 int32
DoSet_Mandelbrot(double real
, double imaginary
);
65 int32
DoSet_BurningShip(double real
, double imaginary
);
66 int32
DoSet_Tricorn(double real
, double imaginary
);
67 int32
DoSet_Julia(double real
, double imaginary
);
68 int32
DoSet_OrbitTrap(double real
, double imaginary
);
69 int32
DoSet_Multibrot(double real
, double imaginary
);
73 #endif /* FRACTALENGINE_H */