xref: /haiku/src/libs/icon/transformer/Transformer.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /*
2  * Copyright 2006-2007, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 #ifndef TRANSFORMER_H
9 #define TRANSFORMER_H
10 
11 
12 #ifdef ICON_O_MATIC
13 #	include "IconObject.h"
14 #else
15 #	include <Message.h>
16 #	include <SupportDefs.h>
17 #endif
18 
19 #include "IconBuild.h"
20 
21 
22 _BEGIN_ICON_NAMESPACE
23 
24 
25 class VertexSource {
26  public:
27 								VertexSource();
28 	virtual						~VertexSource();
29 
30     virtual	void				rewind(unsigned path_id) = 0;
31     virtual	unsigned			vertex(double* x, double* y) = 0;
32 
33 	virtual	bool				WantsOpenPaths() const = 0;
34 	virtual	double				ApproximationScale() const = 0;
35 };
36 
37 
38 #ifdef ICON_O_MATIC
39 class Transformer : public VertexSource,
40 					public IconObject {
41 #else
42 class Transformer : public VertexSource {
43 #endif
44  public:
45 								Transformer(VertexSource& source,
46 											const char* name);
47 								Transformer(VertexSource& source,
48 											BMessage* archive);
49 
50 	virtual						~Transformer();
51 
52 	// Transformer
53 	virtual	Transformer*		Clone(VertexSource& source) const = 0;
54 
55 	virtual	void				rewind(unsigned path_id);
56     virtual	unsigned			vertex(double* x, double* y);
57 
58 	virtual	void				SetSource(VertexSource& source);
59 
60 	virtual	bool				WantsOpenPaths() const;
61 	virtual	double				ApproximationScale() const;
62 
63  protected:
64 			VertexSource&		fSource;
65 };
66 
67 
68 _END_ICON_NAMESPACE
69 
70 
71 #endif	// TRANSFORMER_H
72