1/*
2 * Copyright 2010-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Geoffry Song, goffrie@gmail.com
7 */
8#ifndef _BUTTERFLY_H_
9#define _BUTTERFLY_H_
10
11
12#include <ScreenSaver.h>
13
14
15class Butterfly : public BScreenSaver {
16public:
17								Butterfly(BMessage* archive, image_id imageID);
18
19	virtual	void				StartConfig(BView* view);
20	virtual status_t			StartSaver(BView* view, bool preview);
21	virtual void				Draw(BView* view, int32 frame);
22
23private:
24	inline	rgb_color			_HueToColor(float hue);
25	inline	BPoint				_Iterate();
26
27private:
28			// base value for calculating the curves on each iteration
29			float				fBase;
30			// previously calculated points
31			BPoint				fLast[3];
32			// transformation from graph coordinates to view coordinates
33			float				fScale;
34			BPoint				fTrans;
35			// bounding box of drawn figure
36			BRect				fBounds;
37};
38
39
40#endif  // _BUTTERFLY_H_
41