xref: /haiku/src/apps/mandelbrot/FractalEngine.h (revision 9daf130b6d02a4939ac82611b9cd06b8f9f1e611)
1 /*
2  * Copyright 2016, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Augustin Cavalier <waddlesplash>
7  *		kerwizzy
8  */
9 #ifndef FRACTALENGINE_H
10 #define FRACTALENGINE_H
11 
12 #include <SupportDefs.h>
13 #include <Looper.h>
14 #include <Messenger.h>
15 
16 class BBitmap;
17 
18 
19 class FractalEngine : public BLooper {
20 public:
21 	enum {
22 		MSG_RESIZE = 'Frct',
23 		MSG_RENDER,
24 		MSG_RENDER_COMPLETE,
25 	};
26 
27 	FractalEngine(BHandler* parent, BLooper* looper);
28 	~FractalEngine();
29 
30 	virtual void MessageReceived(BMessage* msg);
31 
32 private:
33 	BMessenger fMessenger;
34 	BBitmap* fBitmapStandby;
35 	BBitmap* fBitmapDisplay;
36 	uint16 fWidth;
37 	uint16 fHeight;
38 	uint8* fRenderBuffer;
39 	uint32 fRenderBufferLen;
40 
41 	const uint8* fColorset;
42 
43 	int32 (FractalEngine::*fDoSet)(double real, double imaginary);
44 	void (FractalEngine::*fRenderPixel)(double real, double imaginary);
45 
46 	void Render(double locationX, double locationY, double size);
47 	void RenderPixelSmooth(double real, double imaginary);
48 	void RenderPixelDefault(double real, double imaginary);
49 	int32 DoSet_Mandelbrot(double real, double imaginary);
50 	int32 DoSet_BurningShip(double real, double imaginary);
51 	int32 DoSet_Tricorn(double real, double imaginary);
52 	int32 DoSet_Julia(double real, double imaginary);
53 	int32 DoSet_OrbitTrap(double real, double imaginary);
54 	int32 DoSet_Multibrot(double real, double imaginary);
55 };
56 
57 
58 #endif	/* FRACTALENGINE_H */
59